diff --git a/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs b/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs index 189a569c715..68e847041e2 100644 --- a/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs +++ b/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs @@ -297,7 +297,7 @@ string GenerateTableAlias(SqlExpression sqlExpression) { ColumnExpression c => c.Name, JsonScalarExpression jsonScalar - => jsonScalar.Path.LastOrDefault(s => s.PropertyName is not null).PropertyName + => jsonScalar.Path.Select(s => s.PropertyName).LastOrDefault() ?? GenerateTableAlias(jsonScalar.Json), ScalarSubqueryExpression scalarSubquery => scalarSubquery.Subquery.Projection[0].Alias, @@ -924,30 +924,30 @@ private SqlExpression CreateJoinPredicate( var outerKey = RemapLambdaBody(outer, outerKeySelector); var innerKey = RemapLambdaBody(inner, innerKeySelector); - if (outerKey is NewExpression { Arguments.Count: > 0 } outerNew) + if (outerKey is not NewExpression { Arguments.Count: > 0 } outerNew) { - var innerNew = (NewExpression)innerKey; + return CreateJoinPredicate(outerKey, innerKey); + } - SqlExpression? result = null; - for (var i = 0; i < outerNew.Arguments.Count; i++) - { - var joinPredicate = CreateJoinPredicate(outerNew.Arguments[i], innerNew.Arguments[i]); - result = result == null - ? joinPredicate - : _sqlExpressionFactory.AndAlso(result, joinPredicate); - } + var innerNew = (NewExpression)innerKey; - if (outerNew.Arguments.Count == 1) - { - result = _sqlExpressionFactory.AndAlso( - result!, - CreateJoinPredicate(Expression.Constant(true), Expression.Constant(true))); - } + SqlExpression? result = null; + for (var i = 0; i < outerNew.Arguments.Count; i++) + { + var joinPredicate = CreateJoinPredicate(outerNew.Arguments[i], innerNew.Arguments[i]); + result = result == null + ? joinPredicate + : _sqlExpressionFactory.AndAlso(result, joinPredicate); + } - return result!; + if (outerNew.Arguments.Count == 1) + { + result = _sqlExpressionFactory.AndAlso( + result!, + CreateJoinPredicate(Expression.Constant(true), Expression.Constant(true))); } - return CreateJoinPredicate(outerKey, innerKey); + return result!; } private SqlExpression CreateJoinPredicate(Expression outerKey, Expression innerKey) diff --git a/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs b/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs index 2bf1c665a3f..9a1d837b597 100644 --- a/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs +++ b/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs @@ -93,11 +93,10 @@ public virtual void Generic_fluent_api_methods_should_return_generic_types() || hidingMethod.ReturnType != type || !hidingMethod.GetParameters().Select(p => p.ParameterType) .SequenceEqual( - method.GetParameters().Select( - p => GetEquivalentGenericType( - p.ParameterType, - hidingMethod.GetGenericArguments(), - method.IsGenericMethod ? method.GetGenericArguments() : [])))) + method.GetParameters().Select(p => GetEquivalentGenericType( + p.ParameterType, + hidingMethod.GetGenericArguments(), + method.IsGenericMethod ? method.GetGenericArguments() : [])))) { continue; } @@ -135,8 +134,8 @@ public virtual void Generic_fluent_api_methods_should_return_generic_types() || hidingMethod.ReturnType.GetGenericTypeDefinition() != genericType || !hidingMethod.GetParameters().Skip(1).Select(p => p.ParameterType) .SequenceEqual( - method.GetParameters().Skip(1).Select( - p => GetEquivalentGenericType(p.ParameterType, + method.GetParameters().Skip(1).Select(p => GetEquivalentGenericType( + p.ParameterType, hidingMethod.GetGenericArguments(), method.IsGenericMethod ? method.GetGenericArguments() : [])))) { @@ -159,8 +158,9 @@ public virtual void Generic_fluent_api_methods_should_return_generic_types() nonGenericMethods.Count > 0, "\r\n-- Non-generic fluent returns that aren't hidden --\r\n" + string.Join( - Environment.NewLine, nonGenericMethods.Select( - m => $"{m.Method.ReturnType.ShortDisplayName()} {m.Type.Name}.{m.Method.Name}{FormatGenericArguments(m.Method)}({Format(m.Method.GetParameters())})"))); + Environment.NewLine, + nonGenericMethods.Select(m + => $"{m.Method.ReturnType.ShortDisplayName()} {m.Type.Name}.{m.Method.Name}{FormatGenericArguments(m.Method)}({Format(m.Method.GetParameters())})"))); } public static string FormatGenericArguments(MethodInfo methodInfo) @@ -183,7 +183,8 @@ protected Type GetEquivalentGenericType(Type parameterType, Type[] hidingGeneric { return typeof(Action<>).MakeGenericType(builderDefinition.MakeGenericType(hidingGenericArguments)); } - else if (builderArguments.Length == 1 + + if (builderArguments.Length == 1 && baseGenericArguments.Length == hidingGenericArguments.Length) { for (var i = 0; i < baseGenericArguments.Length; i++) @@ -372,15 +373,14 @@ protected virtual string ValidateMetadata(KeyValuePair - from readonlyMethod in typeTuple.ReadOnly - where !Fixture.UnmatchedMetadataMethods.Contains(readonlyMethod) - where typeTuple.Mutable != null - join mutableMethod in typeTuple.Mutable - on readonlyMethod.Name equals mutableMethod.Name into mutableGroup - from mutableMethod in mutableGroup.DefaultIfEmpty() - select (readonlyMethod, mutableMethod)) + Fixture.MetadataMethods.Select(typeTuple => + from readonlyMethod in typeTuple.ReadOnly + where !Fixture.UnmatchedMetadataMethods.Contains(readonlyMethod) + where typeTuple.Mutable != null + join mutableMethod in typeTuple.Mutable + on readonlyMethod.Name equals mutableMethod.Name into mutableGroup + from mutableMethod in mutableGroup.DefaultIfEmpty() + select (readonlyMethod, mutableMethod)) .SelectMany(m => m.Select(MatchMutable)) .Where(e => e != null) .ToList(); @@ -435,14 +435,13 @@ protected virtual string MatchMutable((MethodInfo Readonly, MethodInfo Mutable) public virtual void Convention_metadata_types_have_matching_methods() { var errors = - Fixture.MetadataMethods.Select( - typeTuple => - from mutableMethod in typeTuple.Mutable - where !Fixture.UnmatchedMetadataMethods.Contains(mutableMethod) - join conventionMethod in typeTuple.Convention - on GetConventionName(mutableMethod) equals conventionMethod.Name into conventionGroup - from conventionMethod in conventionGroup.DefaultIfEmpty() - select (mutableMethod, conventionMethod)) + Fixture.MetadataMethods.Select(typeTuple => + from mutableMethod in typeTuple.Mutable + where !Fixture.UnmatchedMetadataMethods.Contains(mutableMethod) + join conventionMethod in typeTuple.Convention + on GetConventionName(mutableMethod) equals conventionMethod.Name into conventionGroup + from conventionMethod in conventionGroup.DefaultIfEmpty() + select (mutableMethod, conventionMethod)) .SelectMany(m => m.Select(MatchConvention)) .Where(e => e != null) .ToList(); @@ -671,9 +670,8 @@ protected virtual string ValidateConventionBuilderMethods(IReadOnlyList - ValidateConventionBuilderMethodReturns(t.Value.ConventionBuilder, t.Value.Convention)) + Fixture.MetadataTypes.Select(t => + ValidateConventionBuilderMethodReturns(t.Value.ConventionBuilder, t.Value.Convention)) .Where(e => e != null) .ToList(); @@ -788,7 +786,8 @@ protected virtual string ValidateConventionBuilderMethodReturns(Type builderType parameters .Skip(1) .Select(p => GetEquivalentGenericType( - p.ParameterType, builderType.GetGenericArguments(), method.IsGenericMethod ? method.GetGenericArguments() : []))) + p.ParameterType, builderType.GetGenericArguments(), + method.IsGenericMethod ? method.GetGenericArguments() : []))) .ToArray(); var hidingMethod = extensionType.GetMethod( method.Name, @@ -813,22 +812,22 @@ protected virtual string ValidateConventionBuilderMethodReturns(Type builderType } return string.Join( - Environment.NewLine, unmatchedMethods.Select( - m => $"{m.ReturnType.ShortDisplayName()} {m.Type.Name}.{m.Method.Name}{FormatGenericArguments(m.Method)}({Format(m.Method.GetParameters())})")); + Environment.NewLine, + unmatchedMethods.Select(m + => $"{m.ReturnType.ShortDisplayName()} {m.Type.Name}.{m.Method.Name}{FormatGenericArguments(m.Method)}({Format(m.Method.GetParameters())})")); } [ConditionalFact] public virtual void Runtime_metadata_types_have_matching_methods() { var errors = - Fixture.MetadataMethods.Select( - typeTuple => - from readOnlyMethod in typeTuple.ReadOnly - where !Fixture.UnmatchedMetadataMethods.Contains(readOnlyMethod) - join runtimeMethod in typeTuple.Runtime - on readOnlyMethod.Name equals runtimeMethod?.Name into runtimeGroup - from runtimeMethod in runtimeGroup.DefaultIfEmpty() - select (readOnlyMethod, runtimeMethod)) + Fixture.MetadataMethods.Select(typeTuple => + from readOnlyMethod in typeTuple.ReadOnly + where !Fixture.UnmatchedMetadataMethods.Contains(readOnlyMethod) + join runtimeMethod in typeTuple.Runtime + on readOnlyMethod.Name equals runtimeMethod?.Name into runtimeGroup + from runtimeMethod in runtimeGroup.DefaultIfEmpty() + select (readOnlyMethod, runtimeMethod)) .SelectMany(m => m.Select(MatchRuntime)) .Where(e => e != null) .ToList(); @@ -1062,10 +1061,9 @@ where ns.StartsWith("Microsoft.Entity", StringComparison.Ordinal) // Check that the parameter has a non-public copy constructor, identifying C# 9 records || !it.GetConstructors()[0].GetParameters()[0].ParameterType .GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic) - .Any( - c => c.GetParameters() is var parameters - && parameters.Length == 1 - && parameters[0].Name == "original")) + .Any(c => c.GetParameters() is var parameters + && parameters.Length == 1 + && parameters[0].Name == "original")) select it) .ToList(); @@ -1107,7 +1105,7 @@ where type.IsVisible && !type.IsSealed && !type.GetCustomAttributes().Any() && type.GetMethod("$") == null // Exclude records - from method in type.GetMethods(AnyInstance) + from method in type.GetMethods(AnyInstance) where method.DeclaringType == type && !Fixture.VirtualMethodExceptions.Contains(method) && !Fixture.VirtualMethodExceptions.Contains(method) @@ -1150,9 +1148,8 @@ var asyncMethodsWithoutToken var missingOverloads = (from methodWithoutToken in asyncMethodsWithoutToken where !asyncMethodsWithToken - .Any( - methodWithToken => methodWithoutToken.Name == methodWithToken.Name - && methodWithoutToken.DeclaringType == methodWithToken.DeclaringType) + .Any(methodWithToken => methodWithoutToken.Name == methodWithToken.Name + && methodWithoutToken.DeclaringType == methodWithToken.DeclaringType) && !Fixture.AsyncMethodExceptions.Contains(methodWithoutToken) // ReSharper disable once PossibleNullReferenceException select methodWithoutToken.DeclaringType.Name + "." + methodWithoutToken.Name) @@ -1164,10 +1161,9 @@ var missingOverloads var missingSuffixMethods = asyncMethods - .Where( - method => !method.Name.EndsWith("Async", StringComparison.Ordinal) - && method.DeclaringType != null - && !Fixture.AsyncMethodExceptions.Contains(method)) + .Where(method => !method.Name.EndsWith("Async", StringComparison.Ordinal) + && method.DeclaringType != null + && !Fixture.AsyncMethodExceptions.Contains(method)) .Select(method => method.DeclaringType.Name + "." + method.Name) .ToList(); @@ -1443,7 +1439,7 @@ protected ApiConsistencyFixtureBase() public Dictionary MutableMetadataTypes { get; } = new(); public Dictionary ConventionMetadataTypes { get; } = new(); - public virtual HashSet NonCancellableAsyncMethods { get; } = new(); + public virtual HashSet NonCancellableAsyncMethods { get; } = []; public virtual Dictionary Throws_for_bad_JSON_value(nameof(Int8Type.Int8), json); @@ -22,11 +19,8 @@ protected class Int8Type public sbyte Int8 { get; set; } } - [ConditionalTheory] - [InlineData("""{"Prop"}""")] - [InlineData("""{"Prop"}:127}""")] - [InlineData("""{"Prop":"X"}""")] - [InlineData("""{"Prop":}""")] + [ConditionalTheory, InlineData("""{"Prop"}"""), InlineData("""{"Prop"}:127}"""), InlineData("""{"Prop":"X"}"""), + InlineData("""{"Prop":}""")] public virtual void Throws_for_bad_nullable_long_JSON_values(string json) => Throws_for_bad_JSON_value(nameof(NullableInt64Type.Int64), json); @@ -35,15 +29,11 @@ protected class NullableInt64Type public long? Int64 { get; set; } } - [ConditionalTheory] - [InlineData("""{"Prop":{"type""Point","coordinates":[2.0,4.0]}}""")] - [InlineData("""{"Prop":{"type":["Point","coordinates":[2.0,4.0]}}""")] - [InlineData("""{"Prop":{"type":"Point","coordinates":[2.0,,4.0]}}""")] - [InlineData("""{"Prop":[{"type":"Point","coordinates":[2.0,4.0]}]}""")] - [InlineData("""{"Prop":1}""")] - [InlineData("""{"Prop":true}""")] - [InlineData("""{"Prop":false}""")] - [InlineData("""{"Prop":"X"}""")] + [ConditionalTheory, InlineData("""{"Prop":{"type""Point","coordinates":[2.0,4.0]}}"""), + InlineData("""{"Prop":{"type":["Point","coordinates":[2.0,4.0]}}"""), + InlineData("""{"Prop":{"type":"Point","coordinates":[2.0,,4.0]}}"""), + InlineData("""{"Prop":[{"type":"Point","coordinates":[2.0,4.0]}]}"""), InlineData("""{"Prop":1}"""), InlineData("""{"Prop":true}"""), + InlineData("""{"Prop":false}"""), InlineData("""{"Prop":"X"}""")] public virtual void Throws_for_bad_point_as_GeoJson(string json) => Throws_for_bad_JSON_property_value( b => b.Metadata.SetJsonValueReaderWriterType(typeof(JsonTypesTestBase.JsonGeoJsonReaderWriter)), @@ -55,12 +45,8 @@ public class PointType public Point? Point { get; set; } } - [ConditionalTheory] - [InlineData("""{"Prop":[-128,[0,127]]}""")] - [InlineData("""{"Prop":[-128,{"P":127}]}""")] - [InlineData("""{"Prop":[-128,],23]}""")] - [InlineData("""{"Prop":[-128,},23]}""")] - [InlineData("""{"Prop":[-128,,23]}""")] + [ConditionalTheory, InlineData("""{"Prop":[-128,[0,127]]}"""), InlineData("""{"Prop":[-128,{"P":127}]}"""), + InlineData("""{"Prop":[-128,],23]}"""), InlineData("""{"Prop":[-128,},23]}"""), InlineData("""{"Prop":[-128,,23]}""")] public virtual void Throws_for_bad_collection_of_sbyte_JSON_values(string json) => Throws_for_bad_JSON_value>( nameof(Int8CollectionType.Int8), @@ -72,12 +58,8 @@ protected class Int8CollectionType public sbyte[] Int8 { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":[-128,[0,127]]}""")] - [InlineData("""{"Prop":[-128,{"P":127}]}""")] - [InlineData("""{"Prop":[-128,],23]}""")] - [InlineData("""{"Prop":[-128,},23]}""")] - [InlineData("""{"Prop":[-128,,23]}""")] + [ConditionalTheory, InlineData("""{"Prop":[-128,[0,127]]}"""), InlineData("""{"Prop":[-128,{"P":127}]}"""), + InlineData("""{"Prop":[-128,],23]}"""), InlineData("""{"Prop":[-128,},23]}"""), InlineData("""{"Prop":[-128,,23]}""")] public virtual void Throws_for_bad_collection_of_nullable_long_JSON_values(string json) => Throws_for_bad_JSON_value>( nameof(NullableInt64CollectionType.Int64), @@ -189,9 +171,8 @@ public object Create(DbContext context, bool designTime) } protected virtual void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - => optionsBuilder.ConfigureWarnings( - w => w.Ignore( - CoreEventId.MappedEntityTypeIgnoredWarning, - CoreEventId.MappedPropertyIgnoredWarning, - CoreEventId.MappedNavigationIgnoredWarning)); + => optionsBuilder.ConfigureWarnings(w => w.Ignore( + CoreEventId.MappedEntityTypeIgnoredWarning, + CoreEventId.MappedPropertyIgnoredWarning, + CoreEventId.MappedNavigationIgnoredWarning)); } diff --git a/test/EFCore.Specification.Tests/BuiltInDataTypesTestBase.cs b/test/EFCore.Specification.Tests/BuiltInDataTypesTestBase.cs index ada9f374292..9e34cfa59cc 100644 --- a/test/EFCore.Specification.Tests/BuiltInDataTypesTestBase.cs +++ b/test/EFCore.Specification.Tests/BuiltInDataTypesTestBase.cs @@ -18,9 +18,7 @@ public abstract class BuiltInDataTypesTestBase(TFixture fixture) : ICl protected DbContext CreateContext() => Fixture.CreateContext(); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_filter_projection_with_captured_enum_variable(bool async) { using var context = CreateContext(); @@ -28,8 +26,7 @@ public virtual async Task Can_filter_projection_with_captured_enum_variable(bool var query = context .Set() - .Select( - t => new EmailTemplateDto { Id = t.Id, TemplateType = (EmailTemplateTypeDto)t.TemplateType }) + .Select(t => new EmailTemplateDto { Id = t.Id, TemplateType = (EmailTemplateTypeDto)t.TemplateType }) .Where(t => t.TemplateType == templateType); var results = async @@ -40,16 +37,13 @@ public virtual async Task Can_filter_projection_with_captured_enum_variable(bool Assert.Equal(EmailTemplateTypeDto.PasswordResetRequest, results.Single().TemplateType); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_filter_projection_with_inline_enum_variable(bool async) { using var context = CreateContext(); var query = context .Set() - .Select( - t => new EmailTemplateDto { Id = t.Id, TemplateType = (EmailTemplateTypeDto)t.TemplateType }) + .Select(t => new EmailTemplateDto { Id = t.Id, TemplateType = (EmailTemplateTypeDto)t.TemplateType }) .Where(t => t.TemplateType == EmailTemplateTypeDto.PasswordResetRequest); var results = async @@ -234,20 +228,18 @@ private async Task QueryBuiltInDataTypesTest(EntityEntry sourc if (Fixture.StrictEquality) { Assert.Same( - entity, (await set.Where( - e => e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) == param4).ToListAsync()).Single()); + entity, (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) == param4).ToListAsync()).Single()); } else if (Fixture.SupportsDecimalComparisons) { double? param4l = -1.234567891; double? param4h = -1.234567889; Assert.Same( - entity, (await set.Where( - e => e.Id == 11 - && (EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) == param4 - || (EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) > param4l - && EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) < param4h))) + entity, (await set.Where(e => e.Id == 11 + && (EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) == param4 + || (EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) > param4l + && EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) < param4h))) .ToListAsync()).Single()); } @@ -306,20 +298,18 @@ private async Task QueryBuiltInDataTypesTest(EntityEntry sourc if (Fixture.StrictEquality) { Assert.Same( - entity, (await set.Where( - e => e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) == param11).ToListAsync()).Single()); + entity, (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) == param11).ToListAsync()).Single()); } else if (Fixture.SupportsDecimalComparisons) { var param11l = -1.2341F; var param11h = -1.2339F; Assert.Same( - entity, (await set.Where( - e => e.Id == 11 - && (EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) == param11 - || (EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) > param11l - && EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) < param11h))).ToListAsync()).Single()); + entity, (await set.Where(e => e.Id == 11 + && (EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) == param11 + || (EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) > param11l + && EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) < param11h))).ToListAsync()).Single()); } var param12 = true; @@ -611,9 +601,8 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDouble)) == param4).ToListAsync()) + entity, (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDouble)) == param4).ToListAsync()) .Single()); } else if (Fixture.SupportsDecimalComparisons) @@ -621,11 +610,10 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && (EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDouble)) == param4 - || (EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDouble)) > param4l - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDouble)) < param4h))) + entity, (await set.Where(e => e.Id == 11 + && (EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDouble)) == param4 + || (EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDouble)) > param4l + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDouble)) < param4h))) .ToListAsync()).Single()); } @@ -646,10 +634,9 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDateTimeOffset)) - == param7).ToListAsync()).Single()); + (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDateTimeOffset)) + == param7).ToListAsync()).Single()); } if (entityType.FindProperty(nameof(BuiltInNullableDataTypes.TestNullableTimeSpan)) != null) @@ -657,10 +644,9 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableTimeSpan)) - == param8) + (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableTimeSpan)) + == param8) .ToListAsync()).Single()); } @@ -669,10 +655,9 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDateOnly)) - == param9) + (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableDateOnly)) + == param9) .ToListAsync()).Single()); } @@ -681,10 +666,9 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableTimeOnly)) - == param10) + (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableTimeOnly)) + == param10) .ToListAsync()).Single()); } @@ -692,9 +676,8 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableSingle)) == param11).ToListAsync()) + entity, (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableSingle)) == param11).ToListAsync()) .Single()); } else if (Fixture.SupportsDecimalComparisons) @@ -702,11 +685,10 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && (EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableSingle)) == param11 - || (EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableSingle)) > param11l - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableSingle)) < param11h))) + entity, (await set.Where(e => e.Id == 11 + && (EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableSingle)) == param11 + || (EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableSingle)) > param11l + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableSingle)) < param11h))) .ToListAsync()).Single()); } @@ -758,10 +740,9 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt16)) - == param18).ToListAsync()).Single()); + (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt16)) + == param18).ToListAsync()).Single()); } if (entityType.FindProperty(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt32)) != null) @@ -769,10 +750,9 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt32)) - == param19) + (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt32)) + == param19) .ToListAsync()).Single()); } @@ -781,11 +761,10 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && EF.Property( - e, nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt64)) - == param20).ToListAsync()).Single()); + (await set.Where(e => e.Id == 11 + && EF.Property( + e, nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt64)) + == param20).ToListAsync()).Single()); } if (entityType.FindProperty(nameof(BuiltInNullableDataTypes.TestNullableCharacter)) != null) @@ -793,8 +772,8 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableCharacter)) == param21) + (await set + .Where(e => e.Id == 11 && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableCharacter)) == param21) .ToListAsync()).Single()); } @@ -803,10 +782,9 @@ private async Task QueryBuiltInNullableDataTypesTest(EntityEntry e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableSignedByte)) - == param22) + (await set.Where(e => e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableSignedByte)) + == param22) .ToListAsync()).Single()); } @@ -1035,10 +1013,9 @@ public virtual async Task Can_query_using_any_nullable_data_type_as_literal() { Assert.Same( entity, - (await context.Set().Where( - e => e.Id == 12 - && -e.TestNullableDouble + -1.23456789 < 1E-5 - && -e.TestNullableDouble + -1.23456789 > -1E-5).ToListAsync()).Single()); + (await context.Set().Where(e => e.Id == 12 + && -e.TestNullableDouble + -1.23456789 < 1E-5 + && -e.TestNullableDouble + -1.23456789 > -1E-5).ToListAsync()).Single()); } Assert.Same( @@ -1061,10 +1038,9 @@ public virtual async Task Can_query_using_any_nullable_data_type_as_literal() { Assert.Same( entity, - (await context.Set().Where( - e => e.Id == 12 - && e.TestNullableDateTimeOffset - == new DateTimeOffset(new DateTime(), TimeSpan.FromHours(-8.0))) + (await context.Set().Where(e => e.Id == 12 + && e.TestNullableDateTimeOffset + == new DateTimeOffset(new DateTime(), TimeSpan.FromHours(-8.0))) .ToListAsync()).Single()); } @@ -2201,47 +2177,45 @@ public virtual async Task Object_to_string_conversion() var expected = (await context.Set() .Where(e => e.Id == 13) .ToListAsync()) - .Select( - b => new - { - Sbyte = b.TestSignedByte.ToString(), - Byte = b.TestByte.ToString(), - Short = b.TestInt16.ToString(), - Ushort = b.TestUnsignedInt16.ToString(), - Int = b.TestInt32.ToString(), - Uint = b.TestUnsignedInt32.ToString(), - Long = b.TestInt64.ToString(), - Ulong = b.TestUnsignedInt64.ToString(), - Decimal = b.TestDecimal.ToString(), - Char = b.TestCharacter.ToString() - }) + .Select(b => new + { + Sbyte = b.TestSignedByte.ToString(), + Byte = b.TestByte.ToString(), + Short = b.TestInt16.ToString(), + Ushort = b.TestUnsignedInt16.ToString(), + Int = b.TestInt32.ToString(), + Uint = b.TestUnsignedInt32.ToString(), + Long = b.TestInt64.ToString(), + Ulong = b.TestUnsignedInt64.ToString(), + Decimal = b.TestDecimal.ToString(), + Char = b.TestCharacter.ToString() + }) .First(); Fixture.ListLoggerFactory.Clear(); var query = await context.Set() .Where(e => e.Id == 13) - .Select( - b => new - { - Sbyte = b.TestSignedByte.ToString(), - Byte = b.TestByte.ToString(), - Short = b.TestInt16.ToString(), - Ushort = b.TestUnsignedInt16.ToString(), - Int = b.TestInt32.ToString(), - Uint = b.TestUnsignedInt32.ToString(), - Long = b.TestInt64.ToString(), - Ulong = b.TestUnsignedInt64.ToString(), - Float = b.TestSingle.ToString(), - Double = b.TestDouble.ToString(), - Decimal = b.TestDecimal.ToString(), - Char = b.TestCharacter.ToString(), - DateTime = b.TestDateTime.ToString(), - DateTimeOffset = b.TestDateTimeOffset.ToString(), - TimeSpan = b.TestTimeSpan.ToString(), - DateOnly = b.TestDateOnly.ToString(), - TimeOnly = b.TestTimeOnly.ToString(), - }) + .Select(b => new + { + Sbyte = b.TestSignedByte.ToString(), + Byte = b.TestByte.ToString(), + Short = b.TestInt16.ToString(), + Ushort = b.TestUnsignedInt16.ToString(), + Int = b.TestInt32.ToString(), + Uint = b.TestUnsignedInt32.ToString(), + Long = b.TestInt64.ToString(), + Ulong = b.TestUnsignedInt64.ToString(), + Float = b.TestSingle.ToString(), + Double = b.TestDouble.ToString(), + Decimal = b.TestDecimal.ToString(), + Char = b.TestCharacter.ToString(), + DateTime = b.TestDateTime.ToString(), + DateTimeOffset = b.TestDateTimeOffset.ToString(), + TimeSpan = b.TestTimeSpan.ToString(), + DateOnly = b.TestDateOnly.ToString(), + TimeOnly = b.TestTimeOnly.ToString(), + }) .ToListAsync(); var actual = Assert.Single(query); @@ -2293,226 +2267,215 @@ public virtual string ReallyLargeString => string.Join("", Enumerable.Repeat(Environment.NewLine, 1001)); public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - w => w.Ignore( - CoreEventId.MappedEntityTypeIgnoredWarning, - CoreEventId.MappedPropertyIgnoredWarning, - CoreEventId.MappedNavigationIgnoredWarning)); + => base.AddOptions(builder).ConfigureWarnings(w => w.Ignore( + CoreEventId.MappedEntityTypeIgnoredWarning, + CoreEventId.MappedPropertyIgnoredWarning, + CoreEventId.MappedNavigationIgnoredWarning)); protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - eb => - { - eb.HasData( - new BuiltInDataTypes - { - Id = 13, - PartitionId = 1, - TestInt16 = -1234, - TestInt32 = -123456789, - TestInt64 = -1234567890123456789L, - TestDouble = -1.23456789, - TestDecimal = -1234567890.01M, - TestDateTime = DateTime.Parse("01/01/2000 12:34:56"), - TestDateTimeOffset = new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0)), - TestTimeSpan = new TimeSpan(0, 10, 9, 8, 7), - TestDateOnly = new DateOnly(2020, 3, 1), - TestTimeOnly = new TimeOnly(12, 30, 45, 123), - TestSingle = -1.234F, - TestBoolean = true, - TestByte = 255, - TestUnsignedInt16 = 1234, - TestUnsignedInt32 = 1234565789U, - TestUnsignedInt64 = 1234567890123456789UL, - TestCharacter = 'a', - TestSignedByte = -128, - Enum64 = Enum64.SomeValue, - Enum32 = Enum32.SomeValue, - Enum16 = Enum16.SomeValue, - Enum8 = Enum8.SomeValue, - EnumU64 = EnumU64.SomeValue, - EnumU32 = EnumU32.SomeValue, - EnumU16 = EnumU16.SomeValue, - EnumS8 = EnumS8.SomeValue - }); - - eb.HasData( - new sbyte[] { -10, -7, -4, -3, -2, -1, 0, 1, 2, 3, 8, 15 } - .Select( - (x, i) => - new BuiltInDataTypes - { - Id = 17 + i, - PartitionId = 2, - TestInt16 = x, - TestInt32 = x, - TestInt64 = x, - TestDouble = x * 0.25, - TestDecimal = x * 0.2M, - TestDateTime = DateTime.Parse("01/01/2000 12:34:56"), - TestDateTimeOffset = - new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0)), - TestTimeSpan = new TimeSpan(0, 10, 9, 8, 7), - TestDateOnly = new DateOnly(2020, 3, 1), - TestTimeOnly = new TimeOnly(12, 30, 45, 123), - TestSingle = x * 0.25F, - TestBoolean = x > 0, - TestByte = (byte)(10 + x), - TestUnsignedInt16 = (byte)(10 + x), - TestUnsignedInt32 = (byte)(10 + x), - TestUnsignedInt64 = (byte)(10 + x), - TestCharacter = 'a', - TestSignedByte = x, - Enum64 = Enum64.SomeValue, - Enum32 = Enum32.SomeValue, - Enum16 = Enum16.SomeValue, - Enum8 = Enum8.SomeValue, - EnumU64 = EnumU64.SomeValue, - EnumU32 = EnumU32.SomeValue, - EnumU16 = EnumU16.SomeValue, - EnumS8 = EnumS8.SomeValue - } - ) - ); - - eb.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(eb => + { + eb.HasData( + new BuiltInDataTypes + { + Id = 13, + PartitionId = 1, + TestInt16 = -1234, + TestInt32 = -123456789, + TestInt64 = -1234567890123456789L, + TestDouble = -1.23456789, + TestDecimal = -1234567890.01M, + TestDateTime = DateTime.Parse("01/01/2000 12:34:56"), + TestDateTimeOffset = new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0)), + TestTimeSpan = new TimeSpan(0, 10, 9, 8, 7), + TestDateOnly = new DateOnly(2020, 3, 1), + TestTimeOnly = new TimeOnly(12, 30, 45, 123), + TestSingle = -1.234F, + TestBoolean = true, + TestByte = 255, + TestUnsignedInt16 = 1234, + TestUnsignedInt32 = 1234565789U, + TestUnsignedInt64 = 1234567890123456789UL, + TestCharacter = 'a', + TestSignedByte = -128, + Enum64 = Enum64.SomeValue, + Enum32 = Enum32.SomeValue, + Enum16 = Enum16.SomeValue, + Enum8 = Enum8.SomeValue, + EnumU64 = EnumU64.SomeValue, + EnumU32 = EnumU32.SomeValue, + EnumU16 = EnumU16.SomeValue, + EnumS8 = EnumS8.SomeValue + }); + + eb.HasData( + new sbyte[] { -10, -7, -4, -3, -2, -1, 0, 1, 2, 3, 8, 15 } + .Select((x, i) => + new BuiltInDataTypes + { + Id = 17 + i, + PartitionId = 2, + TestInt16 = x, + TestInt32 = x, + TestInt64 = x, + TestDouble = x * 0.25, + TestDecimal = x * 0.2M, + TestDateTime = DateTime.Parse("01/01/2000 12:34:56"), + TestDateTimeOffset = + new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0)), + TestTimeSpan = new TimeSpan(0, 10, 9, 8, 7), + TestDateOnly = new DateOnly(2020, 3, 1), + TestTimeOnly = new TimeOnly(12, 30, 45, 123), + TestSingle = x * 0.25F, + TestBoolean = x > 0, + TestByte = (byte)(10 + x), + TestUnsignedInt16 = (byte)(10 + x), + TestUnsignedInt32 = (byte)(10 + x), + TestUnsignedInt64 = (byte)(10 + x), + TestCharacter = 'a', + TestSignedByte = x, + Enum64 = Enum64.SomeValue, + Enum32 = Enum32.SomeValue, + Enum16 = Enum16.SomeValue, + Enum8 = Enum8.SomeValue, + EnumU64 = EnumU64.SomeValue, + EnumU32 = EnumU32.SomeValue, + EnumU16 = EnumU16.SomeValue, + EnumS8 = EnumS8.SomeValue + } + ) + ); + + eb.Property(e => e.Id).ValueGeneratedNever(); + }); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); - modelBuilder.Entity( - eb => - { - eb.HasData( - new BuiltInNullableDataTypes - { - Id = 13, - PartitionId = 1, - TestNullableInt16 = -1234, - TestNullableInt32 = -123456789, - TestNullableInt64 = -1234567890123456789L, - TestNullableDouble = -1.23456789, - TestNullableDecimal = -1234567890.01M, - TestNullableDateTimeOffset = new DateTimeOffset(new DateTime(), TimeSpan.FromHours(-8.0)), - TestNullableTimeSpan = new TimeSpan(0, 10, 9, 8, 7), - TestNullableDateOnly = new DateOnly(2020, 3, 1), - TestNullableTimeOnly = new TimeOnly(12, 30, 45, 123), - TestNullableSingle = -1.234F, - TestNullableBoolean = true, - TestNullableByte = 255, - TestNullableUnsignedInt16 = 1234, - TestNullableUnsignedInt32 = 1234565789U, - TestNullableUnsignedInt64 = 1234567890123456789UL, - TestNullableCharacter = 'a', - TestNullableSignedByte = -128, - Enum64 = Enum64.SomeValue, - Enum32 = Enum32.SomeValue, - Enum16 = Enum16.SomeValue, - Enum8 = Enum8.SomeValue, - EnumU64 = EnumU64.SomeValue, - EnumU32 = EnumU32.SomeValue, - EnumU16 = EnumU16.SomeValue, - EnumS8 = EnumS8.SomeValue - }); - - eb.HasData( - new sbyte?[] { null, -10, -7, -4, -3, -2, -1, 0, 1, 2, 3, 8, 15 } - .Select( - (x, i) => - new BuiltInNullableDataTypes - { - Id = 17 + i, - PartitionId = 2, - TestNullableInt16 = x, - TestNullableInt32 = x, - TestNullableInt64 = x, - TestNullableDouble = x * 0.25, - TestNullableDecimal = x * 0.2M, - TestNullableDateTimeOffset = new DateTimeOffset(new DateTime(), TimeSpan.FromHours(-8.0)), - TestNullableTimeSpan = new TimeSpan(0, 10, 9, 8, 7), - TestNullableDateOnly = new DateOnly(2020, 3, 1), - TestNullableTimeOnly = new TimeOnly(12, 30, 45, 123), - TestNullableSingle = x * 0.25F, - TestNullableBoolean = x == null ? null : x > 0, - TestNullableByte = (byte?)(10 + x), - TestNullableUnsignedInt16 = (byte?)(10 + x), - TestNullableUnsignedInt32 = (byte?)(10 + x), - TestNullableUnsignedInt64 = (byte?)(10 + x), - TestNullableCharacter = 'a', - TestNullableSignedByte = x, - Enum64 = Enum64.SomeValue, - Enum32 = Enum32.SomeValue, - Enum16 = Enum16.SomeValue, - Enum8 = Enum8.SomeValue, - EnumU64 = EnumU64.SomeValue, - EnumU32 = EnumU32.SomeValue, - EnumU16 = EnumU16.SomeValue, - EnumS8 = EnumS8.SomeValue - } - ) - ); - - eb.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(eb => + { + eb.HasData( + new BuiltInNullableDataTypes + { + Id = 13, + PartitionId = 1, + TestNullableInt16 = -1234, + TestNullableInt32 = -123456789, + TestNullableInt64 = -1234567890123456789L, + TestNullableDouble = -1.23456789, + TestNullableDecimal = -1234567890.01M, + TestNullableDateTimeOffset = new DateTimeOffset(new DateTime(), TimeSpan.FromHours(-8.0)), + TestNullableTimeSpan = new TimeSpan(0, 10, 9, 8, 7), + TestNullableDateOnly = new DateOnly(2020, 3, 1), + TestNullableTimeOnly = new TimeOnly(12, 30, 45, 123), + TestNullableSingle = -1.234F, + TestNullableBoolean = true, + TestNullableByte = 255, + TestNullableUnsignedInt16 = 1234, + TestNullableUnsignedInt32 = 1234565789U, + TestNullableUnsignedInt64 = 1234567890123456789UL, + TestNullableCharacter = 'a', + TestNullableSignedByte = -128, + Enum64 = Enum64.SomeValue, + Enum32 = Enum32.SomeValue, + Enum16 = Enum16.SomeValue, + Enum8 = Enum8.SomeValue, + EnumU64 = EnumU64.SomeValue, + EnumU32 = EnumU32.SomeValue, + EnumU16 = EnumU16.SomeValue, + EnumS8 = EnumS8.SomeValue + }); + + eb.HasData( + new sbyte?[] { null, -10, -7, -4, -3, -2, -1, 0, 1, 2, 3, 8, 15 } + .Select((x, i) => + new BuiltInNullableDataTypes + { + Id = 17 + i, + PartitionId = 2, + TestNullableInt16 = x, + TestNullableInt32 = x, + TestNullableInt64 = x, + TestNullableDouble = x * 0.25, + TestNullableDecimal = x * 0.2M, + TestNullableDateTimeOffset = new DateTimeOffset(new DateTime(), TimeSpan.FromHours(-8.0)), + TestNullableTimeSpan = new TimeSpan(0, 10, 9, 8, 7), + TestNullableDateOnly = new DateOnly(2020, 3, 1), + TestNullableTimeOnly = new TimeOnly(12, 30, 45, 123), + TestNullableSingle = x * 0.25F, + TestNullableBoolean = x == null ? null : x > 0, + TestNullableByte = (byte?)(10 + x), + TestNullableUnsignedInt16 = (byte?)(10 + x), + TestNullableUnsignedInt32 = (byte?)(10 + x), + TestNullableUnsignedInt64 = (byte?)(10 + x), + TestNullableCharacter = 'a', + TestNullableSignedByte = x, + Enum64 = Enum64.SomeValue, + Enum32 = Enum32.SomeValue, + Enum16 = Enum16.SomeValue, + Enum8 = Enum8.SomeValue, + EnumU64 = EnumU64.SomeValue, + EnumU32 = EnumU32.SomeValue, + EnumU16 = EnumU16.SomeValue, + EnumS8 = EnumS8.SomeValue + } + ) + ); + + eb.Property(e => e.Id).ValueGeneratedNever(); + }); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); MakeRequired(modelBuilder); MakeRequired(modelBuilder); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.ByteArray5).HasMaxLength(5); - b.Property(e => e.String3).HasMaxLength(3); - b.Property(e => e.ByteArray9000).HasMaxLength(LongStringLength); - b.Property(e => e.String9000).HasMaxLength(LongStringLength); - b.Property(e => e.StringUnbounded).HasMaxLength(-1); - b.Property(e => e.StringUnbounded).HasMaxLength(LongStringLength); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.ByteArray5).HasMaxLength(5); + b.Property(e => e.String3).HasMaxLength(3); + b.Property(e => e.ByteArray9000).HasMaxLength(LongStringLength); + b.Property(e => e.String9000).HasMaxLength(LongStringLength); + b.Property(e => e.StringUnbounded).HasMaxLength(-1); + b.Property(e => e.StringUnbounded).HasMaxLength(LongStringLength); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.StringAnsi).IsUnicode(false); - b.Property(e => e.StringAnsi3).HasMaxLength(3).IsUnicode(false); - b.Property(e => e.StringAnsi9000).IsUnicode(false).HasMaxLength(LongStringLength); - b.Property(e => e.StringUnicode).IsUnicode(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.StringAnsi).IsUnicode(false); + b.Property(e => e.StringAnsi3).HasMaxLength(3).IsUnicode(false); + b.Property(e => e.StringAnsi9000).IsUnicode(false).HasMaxLength(LongStringLength); + b.Property(e => e.StringUnicode).IsUnicode(); + }); - modelBuilder.Entity( - b => + modelBuilder.Entity(b => + { + foreach (var property in modelBuilder.Entity().Metadata + .GetProperties().Where(p => p.Name != "Id")) { - foreach (var property in modelBuilder.Entity().Metadata - .GetProperties().Where(p => p.Name != "Id")) - { - b.Property(property.ClrType, property.Name); - } - }); + b.Property(property.ClrType, property.Name); + } + }); - modelBuilder.Entity( - b => + modelBuilder.Entity(b => + { + foreach (var property in modelBuilder.Entity().Metadata + .GetProperties().Where(p => p.Name != "Id")) { - foreach (var property in modelBuilder.Entity().Metadata - .GetProperties().Where(p => p.Name != "Id")) - { - b.Property(property.ClrType, property.Name); - } - }); + b.Property(property.ClrType, property.Name); + } + }); - modelBuilder.Entity( - b => - { - b.HasData( - new EmailTemplate - { - Id = Guid.Parse("3C56082A-005A-4FFB-A9CF-F5EBD641E07D"), - TemplateType = EmailTemplateType.PasswordResetRequest - }); - }); + modelBuilder.Entity(b => + { + b.HasData( + new EmailTemplate + { + Id = Guid.Parse("3C56082A-005A-4FFB-A9CF-F5EBD641E07D"), TemplateType = EmailTemplateType.PasswordResetRequest + }); + }); modelBuilder.Entity() .HasData( diff --git a/test/EFCore.Specification.Tests/BulkUpdates/ComplexTypeBulkUpdatesTestBase.cs b/test/EFCore.Specification.Tests/BulkUpdates/ComplexTypeBulkUpdatesTestBase.cs index 763af7947b9..3373873e7ca 100644 --- a/test/EFCore.Specification.Tests/BulkUpdates/ComplexTypeBulkUpdatesTestBase.cs +++ b/test/EFCore.Specification.Tests/BulkUpdates/ComplexTypeBulkUpdatesTestBase.cs @@ -10,16 +10,14 @@ namespace Microsoft.EntityFrameworkCore.BulkUpdates; public abstract class ComplexTypeBulkUpdatesTestBase(TFixture fixture) : BulkUpdatesTestBase(fixture) where TFixture : ComplexTypeBulkUpdatesFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_complex_type(bool async) => AssertDelete( async, ss => ss.Set().Select(c => c.ShippingAddress), rowsAffectedCount: 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_projected_complex_type_via_OrderBy_Skip(bool async) => AssertUpdate( async, @@ -28,16 +26,14 @@ public virtual Task Update_projected_complex_type_via_OrderBy_Skip(bool async) s => s.SetProperty(c => c.ZipCode, 12345), rowsAffectedCount: 3); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_entity_type_with_complex_type(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Name == "Monty Elias"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_property_inside_complex_type(bool async) => AssertUpdate( async, @@ -46,8 +42,7 @@ public virtual Task Update_property_inside_complex_type(bool async) s => s.SetProperty(c => c.ShippingAddress.ZipCode, 12345), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_property_inside_nested_complex_type(bool async) => AssertUpdate( async, @@ -56,8 +51,7 @@ public virtual Task Update_property_inside_nested_complex_type(bool async) s => s.SetProperty(c => c.ShippingAddress.Country.FullName, "United States Modified"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_multiple_properties_inside_multiple_complex_types_and_on_entity_type(bool async) => AssertUpdate( async, @@ -69,8 +63,7 @@ public virtual Task Update_multiple_properties_inside_multiple_complex_types_and .SetProperty(c => c.BillingAddress.ZipCode, 54321), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_projected_complex_type(bool async) => AssertUpdate( async, @@ -79,26 +72,23 @@ public virtual Task Update_projected_complex_type(bool async) s => s.SetProperty(c => c.ZipCode, 12345), rowsAffectedCount: 3); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_multiple_projected_complex_types_via_anonymous_type(bool async) => AssertUpdate( async, - ss => ss.Set().Select( - c => new - { - c.ShippingAddress, - c.BillingAddress, - Customer = c - }), + ss => ss.Set().Select(c => new + { + c.ShippingAddress, + c.BillingAddress, + Customer = c + }), x => x.Customer, s => s .SetProperty(x => x.ShippingAddress.ZipCode, x => x.BillingAddress.ZipCode) .SetProperty(x => x.BillingAddress.ZipCode, 54321), rowsAffectedCount: 3); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_complex_type_to_parameter(bool async) { var newAddress = new Address @@ -107,7 +97,7 @@ public virtual Task Update_complex_type_to_parameter(bool async) AddressLine2 = "New AddressLine2", ZipCode = 99999, Country = new Country { Code = "FR", FullName = "France" }, - Tags = new List { "new_tag1", "new_tag2" } + Tags = ["new_tag1", "new_tag2"] }; return AssertUpdate( @@ -118,8 +108,7 @@ public virtual Task Update_complex_type_to_parameter(bool async) rowsAffectedCount: 3); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_nested_complex_type_to_parameter(bool async) { var newCountry = new Country { Code = "FR", FullName = "France" }; @@ -132,8 +121,7 @@ public virtual Task Update_nested_complex_type_to_parameter(bool async) rowsAffectedCount: 3); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_complex_type_to_another_database_complex_type(bool async) => AssertUpdate( async, @@ -142,8 +130,7 @@ public virtual Task Update_complex_type_to_another_database_complex_type(bool as s => s.SetProperty(x => x.ShippingAddress, x => x.BillingAddress), rowsAffectedCount: 3); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_complex_type_to_inline_without_lambda(bool async) => AssertUpdate( async, @@ -156,12 +143,11 @@ public virtual Task Update_complex_type_to_inline_without_lambda(bool async) AddressLine2 = "New AddressLine2", ZipCode = 99999, Country = new Country { Code = "FR", FullName = "France" }, - Tags = new List { "new_tag1", "new_tag2" } + Tags = ["new_tag1", "new_tag2"] }), rowsAffectedCount: 3); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_complex_type_to_inline_with_lambda(bool async) => AssertUpdate( async, @@ -178,8 +164,7 @@ public virtual Task Update_complex_type_to_inline_with_lambda(bool async) }), rowsAffectedCount: 3); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_complex_type_to_another_database_complex_type_with_subquery(bool async) => AssertUpdate( async, @@ -188,13 +173,12 @@ public virtual Task Update_complex_type_to_another_database_complex_type_with_su s => s.SetProperty(x => x.ShippingAddress, x => x.BillingAddress), rowsAffectedCount: 2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_collection_inside_complex_type(bool async) => AssertUpdate( async, ss => ss.Set(), c => c, - s => s.SetProperty(x => x.ShippingAddress.Tags, new List { "new_tag1", "new_tag2" }), + s => s.SetProperty(x => x.ShippingAddress.Tags, ["new_tag1", "new_tag2"]), rowsAffectedCount: 3); } diff --git a/test/EFCore.Specification.Tests/BulkUpdates/FiltersInheritanceBulkUpdatesTestBase.cs b/test/EFCore.Specification.Tests/BulkUpdates/FiltersInheritanceBulkUpdatesTestBase.cs index 6f1bf72c4b2..0bdbe0b43de 100644 --- a/test/EFCore.Specification.Tests/BulkUpdates/FiltersInheritanceBulkUpdatesTestBase.cs +++ b/test/EFCore.Specification.Tests/BulkUpdates/FiltersInheritanceBulkUpdatesTestBase.cs @@ -10,48 +10,42 @@ namespace Microsoft.EntityFrameworkCore.BulkUpdates; public abstract class FiltersInheritanceBulkUpdatesTestBase(TFixture fixture) : BulkUpdatesTestBase(fixture) where TFixture : InheritanceBulkUpdatesFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_where_hierarchy(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Name == "Great spotted kiwi"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_where_hierarchy_subquery(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Name == "Great spotted kiwi").OrderBy(e => e.Name).Skip(0).Take(3), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_where_hierarchy_derived(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Name == "Great spotted kiwi"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_where_using_hierarchy(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Animals.Where(a => a.CountryId > 0).Count() > 0), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_where_using_hierarchy_derived(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Animals.OfType().Where(a => a.CountryId > 0).Count() > 0), rowsAffectedCount: 1); - [ConditionalTheory(Skip = "Issue#28525")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#28525"), MemberData(nameof(IsAsyncData))] public virtual Task Delete_GroupBy_Where_Select_First(bool async) => AssertDelete( async, @@ -61,29 +55,24 @@ public virtual Task Delete_GroupBy_Where_Select_First(bool async) .Select(g => g.First()), rowsAffectedCount: 1); - [ConditionalTheory(Skip = "Issue#26753")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#26753"), MemberData(nameof(IsAsyncData))] public virtual Task Delete_GroupBy_Where_Select_First_2(bool async) => AssertDelete( async, - ss => ss.Set().Where( - e => e - == ss.Set().GroupBy(e => e.CountryId) - .Where(g => g.Count() < 3).Select(g => g.First()).FirstOrDefault()), + ss => ss.Set().Where(e => e + == ss.Set().GroupBy(e => e.CountryId) + .Where(g => g.Count() < 3).Select(g => g.First()).FirstOrDefault()), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_GroupBy_Where_Select_First_3(bool async) => AssertDelete( async, - ss => ss.Set().Where( - e => ss.Set().GroupBy(e => e.CountryId) - .Where(g => g.Count() < 3).Select(g => g.First()).Any(i => i == e)), + ss => ss.Set().Where(e => ss.Set().GroupBy(e => e.CountryId) + .Where(g => g.Count() < 3).Select(g => g.First()).Any(i => i == e)), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_base_type(bool async) => AssertUpdate( async, @@ -93,8 +82,7 @@ public virtual Task Update_base_type(bool async) rowsAffectedCount: 1, (b, a) => a.ForEach(e => Assert.Equal("Animal", e.Name))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_base_type_with_OfType(bool async) => AssertUpdate( async, @@ -104,8 +92,7 @@ public virtual Task Update_base_type_with_OfType(bool async) rowsAffectedCount: 1, (b, a) => a.ForEach(e => Assert.Equal("NewBird", e.Name))); - [ConditionalTheory(Skip = "InnerJoin")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "InnerJoin"), MemberData(nameof(IsAsyncData))] public virtual Task Update_where_hierarchy_subquery(bool async) => AssertUpdate( async, @@ -114,8 +101,7 @@ public virtual Task Update_where_hierarchy_subquery(bool async) s => s.SetProperty(e => e.Name, "Animal"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_base_property_on_derived_type(bool async) => AssertUpdate( async, @@ -124,8 +110,7 @@ public virtual Task Update_base_property_on_derived_type(bool async) s => s.SetProperty(e => e.Name, "SomeOtherKiwi"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_derived_property_on_derived_type(bool async) => AssertUpdate( async, @@ -134,8 +119,7 @@ public virtual Task Update_derived_property_on_derived_type(bool async) s => s.SetProperty(e => e.FoundOn, Island.North), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_base_and_derived_types(bool async) => AssertUpdate( async, @@ -146,8 +130,7 @@ public virtual Task Update_base_and_derived_types(bool async) .SetProperty(e => e.FoundOn, Island.North), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_where_using_hierarchy(bool async) => AssertUpdate( async, @@ -156,8 +139,7 @@ public virtual Task Update_where_using_hierarchy(bool async) s => s.SetProperty(e => e.Name, "Monovia"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_where_using_hierarchy_derived(bool async) => AssertUpdate( async, diff --git a/test/EFCore.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesFixtureBase.cs b/test/EFCore.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesFixtureBase.cs index f8841a46d87..fff397f1375 100644 --- a/test/EFCore.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesFixtureBase.cs +++ b/test/EFCore.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesFixtureBase.cs @@ -8,12 +8,11 @@ namespace Microsoft.EntityFrameworkCore.BulkUpdates; public abstract class InheritanceBulkUpdatesFixtureBase : InheritanceQueryFixtureBase, IBulkUpdatesFixtureBase { public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - w => w.Log(CoreEventId.FirstWithoutOrderByAndFilterWarning) - .Ignore( - CoreEventId.MappedEntityTypeIgnoredWarning, - CoreEventId.MappedPropertyIgnoredWarning, - CoreEventId.MappedNavigationIgnoredWarning)); + => base.AddOptions(builder).ConfigureWarnings(w => w.Log(CoreEventId.FirstWithoutOrderByAndFilterWarning) + .Ignore( + CoreEventId.MappedEntityTypeIgnoredWarning, + CoreEventId.MappedPropertyIgnoredWarning, + CoreEventId.MappedNavigationIgnoredWarning)); public abstract void UseTransaction(DatabaseFacade facade, IDbContextTransaction transaction); } diff --git a/test/EFCore.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesTestBase.cs b/test/EFCore.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesTestBase.cs index d020ebb7c58..86f99175f6d 100644 --- a/test/EFCore.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesTestBase.cs +++ b/test/EFCore.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesTestBase.cs @@ -10,48 +10,42 @@ namespace Microsoft.EntityFrameworkCore.BulkUpdates; public abstract class InheritanceBulkUpdatesTestBase(TFixture fixture) : BulkUpdatesTestBase(fixture) where TFixture : InheritanceBulkUpdatesFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_where_hierarchy(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Name == "Great spotted kiwi"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_where_hierarchy_subquery(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Name == "Great spotted kiwi").OrderBy(e => e.Name).Skip(0).Take(3), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_where_hierarchy_derived(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Name == "Great spotted kiwi"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_where_using_hierarchy(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Animals.Where(a => a.CountryId > 0).Count() > 0), rowsAffectedCount: 2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_where_using_hierarchy_derived(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.Animals.OfType().Where(a => a.CountryId > 0).Count() > 0), rowsAffectedCount: 1); - [ConditionalTheory(Skip = "Issue#28525")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#28525"), MemberData(nameof(IsAsyncData))] public virtual Task Delete_GroupBy_Where_Select_First(bool async) => AssertDelete( async, @@ -61,29 +55,24 @@ public virtual Task Delete_GroupBy_Where_Select_First(bool async) .Select(g => g.First()), rowsAffectedCount: 2); - [ConditionalTheory(Skip = "Issue#26753")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#26753"), MemberData(nameof(IsAsyncData))] public virtual Task Delete_GroupBy_Where_Select_First_2(bool async) => AssertDelete( async, - ss => ss.Set().Where( - e => e - == ss.Set().GroupBy(e => e.CountryId) - .Where(g => g.Count() < 3).Select(g => g.First()).FirstOrDefault()), + ss => ss.Set().Where(e => e + == ss.Set().GroupBy(e => e.CountryId) + .Where(g => g.Count() < 3).Select(g => g.First()).FirstOrDefault()), rowsAffectedCount: 2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_GroupBy_Where_Select_First_3(bool async) => AssertDelete( async, - ss => ss.Set().Where( - e => ss.Set().GroupBy(e => e.CountryId) - .Where(g => g.Count() < 3).Select(g => g.First()).Any(i => i == e)), + ss => ss.Set().Where(e => ss.Set().GroupBy(e => e.CountryId) + .Where(g => g.Count() < 3).Select(g => g.First()).Any(i => i == e)), rowsAffectedCount: 2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_base_type(bool async) => AssertUpdate( async, @@ -93,8 +82,7 @@ public virtual Task Update_base_type(bool async) rowsAffectedCount: 1, (b, a) => a.ForEach(e => Assert.Equal("Animal", e.Name))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_base_type_with_OfType(bool async) => AssertUpdate( async, @@ -104,8 +92,7 @@ public virtual Task Update_base_type_with_OfType(bool async) rowsAffectedCount: 1, (b, a) => a.ForEach(e => Assert.Equal("NewBird", e.Name))); - [ConditionalTheory(Skip = "InnerJoin")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "InnerJoin"), MemberData(nameof(IsAsyncData))] public virtual Task Update_where_hierarchy_subquery(bool async) => AssertUpdate( async, @@ -114,8 +101,7 @@ public virtual Task Update_where_hierarchy_subquery(bool async) s => s.SetProperty(e => e.Name, "Animal"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_base_property_on_derived_type(bool async) => AssertUpdate( async, @@ -124,8 +110,7 @@ public virtual Task Update_base_property_on_derived_type(bool async) s => s.SetProperty(e => e.Name, "SomeOtherKiwi"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_derived_property_on_derived_type(bool async) => AssertUpdate( async, @@ -134,8 +119,7 @@ public virtual Task Update_derived_property_on_derived_type(bool async) s => s.SetProperty(e => e.FoundOn, Island.North), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_base_and_derived_types(bool async) => AssertUpdate( async, @@ -146,8 +130,7 @@ public virtual Task Update_base_and_derived_types(bool async) .SetProperty(e => e.FoundOn, Island.North), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_where_using_hierarchy(bool async) => AssertUpdate( async, @@ -156,8 +139,7 @@ public virtual Task Update_where_using_hierarchy(bool async) s => s.SetProperty(e => e.Name, "Monovia"), rowsAffectedCount: 2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_where_using_hierarchy_derived(bool async) => AssertUpdate( async, @@ -166,8 +148,7 @@ public virtual Task Update_where_using_hierarchy_derived(bool async) s => s.SetProperty(e => e.Name, "Monovia"), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_interface_in_property_expression(bool async) => AssertUpdate( async, @@ -176,8 +157,7 @@ public virtual Task Update_with_interface_in_property_expression(bool async) s => s.SetProperty(c => ((ISugary)c).SugarGrams, 0), rowsAffectedCount: 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_interface_in_EF_Property_in_property_expression(bool async) => AssertUpdate( async, diff --git a/test/EFCore.Specification.Tests/BulkUpdates/NonSharedModelBulkUpdatesTestBase.cs b/test/EFCore.Specification.Tests/BulkUpdates/NonSharedModelBulkUpdatesTestBase.cs index 933d19a8039..fd1d6d1937a 100644 --- a/test/EFCore.Specification.Tests/BulkUpdates/NonSharedModelBulkUpdatesTestBase.cs +++ b/test/EFCore.Specification.Tests/BulkUpdates/NonSharedModelBulkUpdatesTestBase.cs @@ -5,13 +5,13 @@ namespace Microsoft.EntityFrameworkCore.BulkUpdates; #nullable disable -public abstract class NonSharedModelBulkUpdatesTestBase(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture +public abstract class NonSharedModelBulkUpdatesTestBase(NonSharedFixture fixture) + : NonSharedModelTestBase(fixture), IClassFixture { protected override string StoreName => "NonSharedModelBulkUpdatesTests"; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Delete_aggregate_root_when_eager_loaded_owned_collection(bool async) { var contextFactory = await InitializeAsync(onModelCreating: mb => mb.Entity().Ignore(e => e.OwnedReference)); @@ -22,8 +22,7 @@ await AssertDelete( // Composing the OrderBy().Skip() operators causes the query to not be natively translatable as a simple DELETE (in most databases), // causing a subquery pushdown (WHERE Id IN (...)). - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Delete_with_owned_collection_and_non_natively_translatable_query(bool async) { var contextFactory = await InitializeAsync(onModelCreating: mb => mb.Entity().Ignore(e => e.OwnedReference)); @@ -32,8 +31,7 @@ await AssertDelete( context => context.Set().OrderBy(o => o.Title).Skip(1), rowsAffectedCount: 0); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Delete_aggregate_root_when_table_sharing_with_owned(bool async) { var contextFactory = await InitializeAsync(); @@ -42,8 +40,7 @@ await AssertDelete( context => context.Set(), rowsAffectedCount: 0); } - [ConditionalTheory] // #33937, #33946 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #33937, #33946 public virtual async Task Replace_ColumnExpression_in_column_setter(bool async) { var contextFactory = await InitializeAsync(); @@ -59,12 +56,11 @@ await AssertUpdate( protected class Context28671(DbContextOptions options) : DbContext(options) { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.OwnsOne(e => e.OwnedReference); - b.OwnsMany(e => e.OwnedCollections); - }); + => modelBuilder.Entity(b => + { + b.OwnsOne(e => e.OwnedReference); + b.OwnsMany(e => e.OwnedCollections); + }); } public class Owner @@ -94,8 +90,7 @@ public class OtherReference public string Title { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Update_non_owned_property_on_entity_with_owned(bool async) { var contextFactory = await InitializeAsync( @@ -112,8 +107,7 @@ await AssertUpdate( rowsAffectedCount: 0); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Update_non_owned_property_on_entity_with_owned2(bool async) { var contextFactory = await InitializeAsync( @@ -130,8 +124,7 @@ await AssertUpdate( rowsAffectedCount: 0); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Update_non_owned_property_on_entity_with_owned_in_join(bool async) { var contextFactory = await InitializeAsync( @@ -148,8 +141,7 @@ await AssertUpdate( rowsAffectedCount: 0); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Update_owned_and_non_owned_properties_with_table_sharing(bool async) { var contextFactory = await InitializeAsync( @@ -168,8 +160,7 @@ await AssertUpdate( rowsAffectedCount: 0); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Delete_entity_with_auto_include(bool async) { var contextFactory = await InitializeAsync(); @@ -197,8 +188,7 @@ public class Context30572_Dependent public int Number { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Delete_predicate_based_on_optional_navigation(bool async) { var contextFactory = await InitializeAsync(); @@ -228,8 +218,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Update_with_alias_uniquification_in_setter_subquery(bool async) { var contextFactory = await InitializeAsync(); @@ -249,21 +238,19 @@ public DbSet Orders protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity( - b => - { - b.Property(o => o.Id).ValueGeneratedNever(); - b.HasData(new Order { Id = 1 }); - }); - - modelBuilder.Entity( - b => - { - b.Property(op => op.Id).ValueGeneratedNever(); - b.HasData( - new OrderProduct { Id = 1, Amount = 8 }, - new OrderProduct { Id = 2, Amount = 9 }); - }); + modelBuilder.Entity(b => + { + b.Property(o => o.Id).ValueGeneratedNever(); + b.HasData(new Order { Id = 1 }); + }); + + modelBuilder.Entity(b => + { + b.Property(op => op.Id).ValueGeneratedNever(); + b.HasData( + new OrderProduct { Id = 1, Amount = 8 }, + new OrderProduct { Id = 2, Amount = 9 }); + }); } } diff --git a/test/EFCore.Specification.Tests/BulkUpdates/NorthwindBulkUpdatesTestBase.cs b/test/EFCore.Specification.Tests/BulkUpdates/NorthwindBulkUpdatesTestBase.cs index be92bfd6294..239ff1995b1 100644 --- a/test/EFCore.Specification.Tests/BulkUpdates/NorthwindBulkUpdatesTestBase.cs +++ b/test/EFCore.Specification.Tests/BulkUpdates/NorthwindBulkUpdatesTestBase.cs @@ -10,16 +10,14 @@ namespace Microsoft.EntityFrameworkCore.BulkUpdates; public abstract class NorthwindBulkUpdatesTestBase(TFixture fixture) : BulkUpdatesTestBase(fixture) where TFixture : NorthwindBulkUpdatesFixture, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_non_entity_projection(bool async) => AssertDelete( async, ss => ss.Set().Where(od => od.OrderID < 10250).Select(e => e.ProductID), rowsAffectedCount: 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_non_entity_projection_2(bool async) => AssertDelete( async, @@ -27,8 +25,7 @@ public virtual Task Delete_non_entity_projection_2(bool async) .Select(e => new OrderDetail { OrderID = e.OrderID, ProductID = e.ProductID }), rowsAffectedCount: 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_non_entity_projection_3(bool async) => AssertDelete( async, @@ -36,8 +33,7 @@ public virtual Task Delete_non_entity_projection_3(bool async) .Select(e => new { OrderDetail = e, e.ProductID }), rowsAffectedCount: 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_without_property_to_set_throws(bool async) => AssertUpdate( async, @@ -46,8 +42,7 @@ public virtual Task Update_without_property_to_set_throws(bool async) _ => { }, rowsAffectedCount: 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_invalid_lambda_in_set_property_throws(bool async) => AssertUpdate( async, @@ -56,8 +51,7 @@ public virtual Task Update_with_invalid_lambda_in_set_property_throws(bool async s => s.SetProperty(e => e.MaybeScalar(e => e.OrderID), 10300), rowsAffectedCount: 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_multiple_tables_throws(bool async) => AssertUpdate( async, @@ -70,8 +64,7 @@ public virtual Task Update_multiple_tables_throws(bool async) .SetProperty(c => c.e.OrderDate, new DateTime(2020, 1, 1)), rowsAffectedCount: 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_unmapped_property_throws(bool async) => AssertUpdate( async, @@ -80,24 +73,21 @@ public virtual Task Update_unmapped_property_throws(bool async) s => s.SetProperty(c => c.IsLondon, true), rowsAffectedCount: 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_TagWith(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300).TagWith("MyDelete"), rowsAffectedCount: 140); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300), rowsAffectedCount: 140); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Delete_Where_parameter(bool async) { int? quantity = 1; @@ -115,91 +105,79 @@ await AssertDelete( rowsAffectedCount: 0); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_OrderBy(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300).OrderBy(e => e.OrderID), rowsAffectedCount: 140); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_OrderBy_Skip(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300).OrderBy(e => e.OrderID).Skip(100), rowsAffectedCount: 40); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_OrderBy_Take(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300).OrderBy(e => e.OrderID).Take(100), rowsAffectedCount: 100); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_OrderBy_Skip_Take(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300).OrderBy(e => e.OrderID).Skip(100).Take(100), rowsAffectedCount: 40); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_Skip(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300).Skip(100), rowsAffectedCount: 40); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_Take(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300).Take(100), rowsAffectedCount: 100); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_Skip_Take(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300).Skip(100).Take(100), rowsAffectedCount: 40); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_predicate_with_GroupBy_aggregate(bool async) => AssertDelete( async, ss => ss.Set() - .Where( - e => e.OrderID - < ss.Set() - .GroupBy(o => o.CustomerID) - .Where(g => g.Count() > 11) - .Select(g => g.First()).First().OrderID), + .Where(e => e.OrderID + < ss.Set() + .GroupBy(o => o.CustomerID) + .Where(g => g.Count() > 11) + .Select(g => g.First()).First().OrderID), rowsAffectedCount: 284); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_predicate_with_GroupBy_aggregate_2(bool async) => AssertDelete( async, ss => ss.Set() - .Where( - e => ss.Set() - .GroupBy(o => o.CustomerID) - .Where(g => g.Count() > 9) - .Select(g => g.First()).Contains(e.Order)), + .Where(e => ss.Set() + .GroupBy(o => o.CustomerID) + .Where(g => g.Count() > 9) + .Select(g => g.First()).Contains(e.Order)), rowsAffectedCount: 109); - [ConditionalTheory(Skip = "Issue#28525")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#28525"), MemberData(nameof(IsAsyncData))] public virtual Task Delete_GroupBy_Where_Select(bool async) => AssertDelete( async, @@ -209,68 +187,59 @@ public virtual Task Delete_GroupBy_Where_Select(bool async) .Select(g => g.First()), rowsAffectedCount: 284); - [ConditionalTheory(Skip = "Issue#26753")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#26753"), MemberData(nameof(IsAsyncData))] public virtual Task Delete_GroupBy_Where_Select_2(bool async) => AssertDelete( async, ss => ss.Set() - .Where( - od => od - == ss.Set().GroupBy(od => od.OrderID).Where(g => g.Count() > 5).Select(g => g.First()) - .FirstOrDefault()), + .Where(od => od + == ss.Set().GroupBy(od => od.OrderID).Where(g => g.Count() > 5).Select(g => g.First()) + .FirstOrDefault()), rowsAffectedCount: 284); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_Skip_Take_Skip_Take_causing_subquery(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300).Skip(100).Take(100).Skip(20).Take(5), rowsAffectedCount: 5); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_Distinct(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10300).Distinct(), rowsAffectedCount: 140); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_SelectMany(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10250).SelectMany(e => e.OrderDetails), rowsAffectedCount: 5); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_SelectMany_subquery(bool async) => AssertDelete( async, ss => ss.Set().Where(e => e.OrderID < 10250).SelectMany(e => e.OrderDetails.Where(i => i.ProductID > 0)), rowsAffectedCount: 5); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_using_navigation(bool async) => AssertDelete( async, ss => ss.Set().Where(od => od.Order.OrderDate.Value.Year == 2000), rowsAffectedCount: 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_using_navigation_2(bool async) => AssertDelete( async, ss => ss.Set().Where(od => od.Order.Customer.CustomerID.StartsWith("F")), rowsAffectedCount: 164); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Union(bool async) => AssertDelete( async, @@ -278,8 +247,7 @@ public virtual Task Delete_Union(bool async) .Union(ss.Set().Where(od => od.OrderID > 11250)), rowsAffectedCount: 5); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Concat(bool async) => AssertDelete( async, @@ -287,8 +255,7 @@ public virtual Task Delete_Concat(bool async) .Concat(ss.Set().Where(od => od.OrderID > 11250)), rowsAffectedCount: 5); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Intersect(bool async) => AssertDelete( async, @@ -296,8 +263,7 @@ public virtual Task Delete_Intersect(bool async) .Intersect(ss.Set().Where(od => od.OrderID > 11250)), rowsAffectedCount: 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Except(bool async) => AssertDelete( async, @@ -305,8 +271,7 @@ public virtual Task Delete_Except(bool async) .Except(ss.Set().Where(od => od.OrderID > 11250)), rowsAffectedCount: 5); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_Where_optional_navigation_predicate(bool async) => AssertDelete( async, @@ -315,8 +280,7 @@ where od.Order.Customer.City.StartsWith("Se") select od, rowsAffectedCount: 66); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_with_join(bool async) => AssertDelete( async, @@ -326,8 +290,7 @@ on od.OrderID equals o.OrderID select od, rowsAffectedCount: 140); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_with_LeftJoin(bool async) => AssertDelete( async, @@ -339,8 +302,7 @@ public virtual Task Delete_with_LeftJoin(bool async) (od, o) => od), rowsAffectedCount: 74); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_with_LeftJoin_via_flattened_GroupJoin(bool async) => AssertDelete( async, @@ -351,8 +313,7 @@ from o in grouping.DefaultIfEmpty() select od, rowsAffectedCount: 74); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_with_cross_join(bool async) => AssertDelete( async, @@ -361,8 +322,7 @@ from o in ss.Set().Where(o => o.OrderID < 10300).OrderBy(e => e.OrderID). select od, rowsAffectedCount: 74); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_with_cross_apply(bool async) => AssertDelete( async, @@ -371,8 +331,7 @@ from o in ss.Set().Where(o => o.OrderID < od.OrderID).OrderBy(e => e.Orde select od, rowsAffectedCount: 71); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_with_outer_apply(bool async) => AssertDelete( async, @@ -381,8 +340,7 @@ from o in ss.Set().Where(o => o.OrderID < od.OrderID).OrderBy(e => e.Orde select od, rowsAffectedCount: 74); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Delete_with_RightJoin(bool async) => AssertDelete( async, @@ -394,8 +352,7 @@ public virtual Task Delete_with_RightJoin(bool async) (od, o) => od), rowsAffectedCount: 74); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_constant_TagWith(bool async) => AssertUpdate( async, @@ -405,8 +362,7 @@ public virtual Task Update_Where_set_constant_TagWith(bool async) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_constant(bool async) => AssertUpdate( async, @@ -416,8 +372,7 @@ public virtual Task Update_Where_set_constant(bool async) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_constant_via_lambda(bool async) => AssertUpdate( async, @@ -427,8 +382,7 @@ public virtual Task Update_Where_set_constant_via_lambda(bool async) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Update_Where_parameter_set_constant(bool async) { var customer = "ALFKI"; @@ -450,8 +404,7 @@ await AssertUpdate( (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_parameter(bool async) { var value = "Abc"; @@ -464,8 +417,7 @@ public virtual Task Update_Where_set_parameter(bool async) (b, a) => Assert.All(a, c => Assert.Equal("Abc", c.ContactName))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_parameter_from_closure_array(bool async) { var array = new[] { "Abc", "Def" }; @@ -478,8 +430,7 @@ public virtual Task Update_Where_set_parameter_from_closure_array(bool async) (b, a) => Assert.All(a, c => Assert.Equal("Abc", c.ContactName))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_parameter_from_inline_list(bool async) => AssertUpdate( async, @@ -489,8 +440,7 @@ public virtual Task Update_Where_set_parameter_from_inline_list(bool async) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Abc", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_parameter_from_multilevel_property_access(bool async) { var container = new Container { Containee = new Containee { Property = "Abc" } }; @@ -514,8 +464,7 @@ private class Containee public string Property { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_Skip_set_constant(bool async) => AssertUpdate( async, @@ -525,8 +474,7 @@ public virtual Task Update_Where_Skip_set_constant(bool async) rowsAffectedCount: 4, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_Take_set_constant(bool async) => AssertUpdate( async, @@ -536,8 +484,7 @@ public virtual Task Update_Where_Take_set_constant(bool async) rowsAffectedCount: 4, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_Skip_Take_set_constant(bool async) => AssertUpdate( async, @@ -547,8 +494,7 @@ public virtual Task Update_Where_Skip_Take_set_constant(bool async) rowsAffectedCount: 4, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_OrderBy_set_constant(bool async) => AssertUpdate( async, @@ -558,8 +504,7 @@ public virtual Task Update_Where_OrderBy_set_constant(bool async) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_OrderBy_Skip_set_constant(bool async) => AssertUpdate( async, @@ -569,8 +514,7 @@ public virtual Task Update_Where_OrderBy_Skip_set_constant(bool async) rowsAffectedCount: 4, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_OrderBy_Take_set_constant(bool async) => AssertUpdate( async, @@ -580,8 +524,7 @@ public virtual Task Update_Where_OrderBy_Take_set_constant(bool async) rowsAffectedCount: 4, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_OrderBy_Skip_Take_set_constant(bool async) => AssertUpdate( async, @@ -591,8 +534,7 @@ public virtual Task Update_Where_OrderBy_Skip_Take_set_constant(bool async) rowsAffectedCount: 4, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_OrderBy_Skip_Take_Skip_Take_set_constant(bool async) => AssertUpdate( async, @@ -602,67 +544,58 @@ public virtual Task Update_Where_OrderBy_Skip_Take_Skip_Take_set_constant(bool a rowsAffectedCount: 2, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_GroupBy_aggregate_set_constant(bool async) => AssertUpdate( async, ss => ss.Set() - .Where( - c => c.CustomerID - == ss.Set() - .GroupBy(e => e.CustomerID).Where(g => g.Count() > 11).Select(e => e.Key).FirstOrDefault()), + .Where(c => c.CustomerID + == ss.Set() + .GroupBy(e => e.CustomerID).Where(g => g.Count() > 11).Select(e => e.Key).FirstOrDefault()), e => e, s => s.SetProperty(c => c.ContactName, "Updated"), rowsAffectedCount: 1, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_GroupBy_First_set_constant(bool async) => AssertUpdate( async, ss => ss.Set() - .Where( - c => c.CustomerID - == ss.Set() - .GroupBy(e => e.CustomerID).Where(g => g.Count() > 11).Select(e => e.First().CustomerID).FirstOrDefault()), + .Where(c => c.CustomerID + == ss.Set() + .GroupBy(e => e.CustomerID).Where(g => g.Count() > 11).Select(e => e.First().CustomerID).FirstOrDefault()), e => e, s => s.SetProperty(c => c.ContactName, "Updated"), rowsAffectedCount: 1, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory(Skip = "Issue#26753")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#26753"), MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_GroupBy_First_set_constant_2(bool async) => AssertUpdate( async, ss => ss.Set() - .Where( - c => c - == ss.Set() - .GroupBy(e => e.CustomerID).Where(g => g.Count() > 11).Select(e => e.First().Customer).FirstOrDefault()), + .Where(c => c + == ss.Set() + .GroupBy(e => e.CustomerID).Where(g => g.Count() > 11).Select(e => e.First().Customer).FirstOrDefault()), e => e, s => s.SetProperty(c => c.ContactName, "Updated"), rowsAffectedCount: 1, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_GroupBy_First_set_constant_3(bool async) => AssertUpdate( async, ss => ss.Set() - .Where( - c => ss.Set() - .GroupBy(e => e.CustomerID).Where(g => g.Count() > 11).Select(e => e.First().Customer).Contains(c)), + .Where(c => ss.Set() + .GroupBy(e => e.CustomerID).Where(g => g.Count() > 11).Select(e => e.First().Customer).Contains(c)), e => e, s => s.SetProperty(c => c.ContactName, "Updated"), rowsAffectedCount: 24, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_Distinct_set_constant(bool async) => AssertUpdate( async, @@ -672,8 +605,7 @@ public virtual Task Update_Where_Distinct_set_constant(bool async) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_using_navigation_set_null(bool async) => AssertUpdate( async, @@ -683,8 +615,7 @@ public virtual Task Update_Where_using_navigation_set_null(bool async) rowsAffectedCount: 14, (b, a) => Assert.All(a, c => Assert.Null(c.OrderDate))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_using_navigation_2_set_constant(bool async) => AssertUpdate( async, @@ -694,8 +625,7 @@ public virtual Task Update_Where_using_navigation_2_set_constant(bool async) rowsAffectedCount: 40, (b, a) => Assert.All(a, c => Assert.Equal(1, c.Quantity))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_SelectMany_set_null(bool async) => AssertUpdate( async, @@ -705,8 +635,7 @@ public virtual Task Update_Where_SelectMany_set_null(bool async) rowsAffectedCount: 63, (b, a) => Assert.All(a, c => Assert.Null(c.OrderDate))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_property_plus_constant(bool async) => AssertUpdate( async, @@ -716,8 +645,7 @@ public virtual Task Update_Where_set_property_plus_constant(bool async) rowsAffectedCount: 8, (b, a) => b.Zip(a).ForEach(e => Assert.Equal(e.First.ContactName + "Abc", e.Second.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_property_plus_parameter(bool async) { var value = "Abc"; @@ -730,8 +658,7 @@ public virtual Task Update_Where_set_property_plus_parameter(bool async) (b, a) => b.Zip(a).ForEach(e => Assert.Equal(e.First.ContactName + "Abc", e.Second.ContactName))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_property_plus_property(bool async) => AssertUpdate( async, @@ -741,8 +668,7 @@ public virtual Task Update_Where_set_property_plus_property(bool async) rowsAffectedCount: 8, (b, a) => b.Zip(a).ForEach(e => Assert.Equal(e.First.ContactName + e.First.CustomerID, e.Second.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_constant_using_ef_property(bool async) => AssertUpdate( async, @@ -752,8 +678,7 @@ public virtual Task Update_Where_set_constant_using_ef_property(bool async) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_set_null(bool async) => AssertUpdate( async, @@ -763,8 +688,7 @@ public virtual Task Update_Where_set_null(bool async) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Null(c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_multiple_set(bool async) { var value = "Abc"; @@ -782,8 +706,7 @@ public virtual Task Update_Where_multiple_set(bool async) })); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Union_set_constant(bool async) => AssertUpdate( async, @@ -794,8 +717,7 @@ public virtual Task Update_Union_set_constant(bool async) rowsAffectedCount: 12, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Concat_set_constant(bool async) => AssertUpdate( async, @@ -806,8 +728,7 @@ public virtual Task Update_Concat_set_constant(bool async) rowsAffectedCount: 12, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Except_set_constant(bool async) => AssertUpdate( async, @@ -818,8 +739,7 @@ public virtual Task Update_Except_set_constant(bool async) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Intersect_set_constant(bool async) => AssertUpdate( async, @@ -830,8 +750,7 @@ public virtual Task Update_Intersect_set_constant(bool async) rowsAffectedCount: 0, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_join_set_constant(bool async) => AssertUpdate( async, @@ -844,8 +763,7 @@ on c.CustomerID equals o.CustomerID rowsAffectedCount: 2, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_LeftJoin(bool async) => AssertUpdate( async, @@ -861,8 +779,7 @@ public virtual Task Update_with_LeftJoin(bool async) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_LeftJoin_via_flattened_GroupJoin(bool async) => AssertUpdate( async, @@ -876,8 +793,7 @@ from o in grouping.DefaultIfEmpty() rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_RightJoin(bool async) => AssertUpdate( async, @@ -892,8 +808,7 @@ public virtual Task Update_with_RightJoin(bool async) rowsAffectedCount: 2, (b, a) => Assert.All(a, o => Assert.Equal(new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc), o.OrderDate))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_cross_join_set_constant(bool async) => AssertUpdate( async, @@ -905,8 +820,7 @@ from o in ss.Set().Where(o => o.OrderID < 10300) rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_cross_apply_set_constant(bool async) => AssertUpdate( async, @@ -918,8 +832,7 @@ from o in ss.Set().Where(o => o.OrderID < 10300 && o.OrderDate.Value.Year rowsAffectedCount: 0, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_outer_apply_set_constant(bool async) => AssertUpdate( async, @@ -931,8 +844,7 @@ from o in ss.Set().Where(o => o.OrderID < 10300 && o.OrderDate.Value.Year rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_cross_join_left_join_set_constant(bool async) => AssertUpdate( async, @@ -952,8 +864,7 @@ from o in grouping.DefaultIfEmpty() rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_cross_join_cross_apply_set_constant(bool async) => AssertUpdate( async, @@ -966,8 +877,7 @@ from o in ss.Set().Where(o => o.OrderID < 10300 && o.OrderDate.Value.Year rowsAffectedCount: 0, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_cross_join_outer_apply_set_constant(bool async) => AssertUpdate( async, @@ -985,8 +895,7 @@ from o in ss.Set().Where(o => o.OrderID < 10300 && o.OrderDate.Value.Year rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.Equal("Updated", c.ContactName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_SelectMany_subquery_set_null(bool async) => AssertUpdate( async, @@ -997,8 +906,7 @@ public virtual Task Update_Where_SelectMany_subquery_set_null(bool async) rowsAffectedCount: 35, (b, a) => Assert.All(a, c => Assert.Null(c.OrderDate))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_Join_set_property_from_joined_single_result_table(bool async) => AssertUpdate( async, @@ -1009,8 +917,7 @@ public virtual Task Update_Where_Join_set_property_from_joined_single_result_tab rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.NotNull(c.City))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_Join_set_property_from_joined_table(bool async) => AssertUpdate( async, @@ -1022,8 +929,7 @@ from c2 in ss.Set().Where(c => c.CustomerID == "ALFKI") rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.NotNull(c.City))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_Where_Join_set_property_from_joined_single_result_scalar(bool async) => AssertUpdate( async, @@ -1034,8 +940,7 @@ public virtual Task Update_Where_Join_set_property_from_joined_single_result_sca rowsAffectedCount: 8, (b, a) => Assert.All(a, c => Assert.NotNull(c.City))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Update_with_two_inner_joins(bool async) => AssertUpdate( async, diff --git a/test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs b/test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs index 160df915116..9fb2a07cab7 100644 --- a/test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs +++ b/test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs @@ -10,681 +10,428 @@ public abstract class ComplexTypesTrackingTestBase(TFixture fixture) : { protected TFixture Fixture { get; } = fixture; - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_objects(EntityState state, bool async) => TrackAndSaveTest(state, async, c => CreatePub(c)); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_type_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, c => CreatePub(c)); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_types(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, c => CreatePub(c)); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_types(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, c => CreatePub(c)); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_structs(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithStructs); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_readonly_struct_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithStructs); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_structs(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithStructs); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_structs(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithStructs); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_readonly_structs(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithReadonlyStructs); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_readonly_readonly_struct_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithReadonlyStructs); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_readonly_structs(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithReadonlyStructs); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_readonly_structs(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithReadonlyStructs); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_record_objects(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithRecords); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_record_type_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithRecords); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_record_complex_types(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithRecords); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_record_complex_types(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithRecords); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_objects_with_fields(EntityState state, bool async) => TrackAndSaveTest(state, async, CreateFieldPub); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_type_properties_modified_with_fields(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreateFieldPub); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_types_with_fields(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreateFieldPub); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_types_with_fields(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreateFieldPub); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_structs_with_fields(EntityState state, bool async) => TrackAndSaveTest(state, async, CreateFieldPubWithStructs); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_readonly_struct_properties_modified_with_fields(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreateFieldPubWithStructs); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_structs_with_fields(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreateFieldPubWithStructs); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_structs_with_fields(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreateFieldPubWithStructs); - [ConditionalTheory(Skip = "Constructor binding #31621")] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory(Skip = "Constructor binding #31621"), InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Unchanged, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_readonly_structs_with_fields(EntityState state, bool async) => TrackAndSaveTest(state, async, CreateFieldPubWithReadonlyStructs); - [ConditionalTheory(Skip = "Constructor binding #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Constructor binding #31621"), InlineData(false), InlineData(true)] public virtual void Can_mark_complex_readonly_readonly_struct_properties_modified_with_fields(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreateFieldPubWithReadonlyStructs); - [ConditionalTheory(Skip = "Constructor binding #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Constructor binding #31621"), InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_readonly_structs_with_fields(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreateFieldPubWithReadonlyStructs); - [ConditionalTheory(Skip = "Constructor binding #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Constructor binding #31621"), InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_readonly_structs_with_fields(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreateFieldPubWithReadonlyStructs); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_record_objects_with_fields(EntityState state, bool async) => TrackAndSaveTest(state, async, CreateFieldPubWithRecords); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_record_type_properties_modified_with_fields(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreateFieldPubWithRecords); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_record_complex_types_with_fields(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreateFieldPubWithRecords); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_record_complex_types_with_fields(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreateFieldPubWithRecords); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_type_collections(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithCollections); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_type_collection_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithCollections); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_type_collections(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithCollections); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_type_collections(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithCollections); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Unchanged, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_struct_collections(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithStructCollections); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_mark_complex_struct_collection_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithStructCollections); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_struct_collections(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithStructCollections); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_struct_collections(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithStructCollections); - [ConditionalTheory(Skip = "Issue #31621")] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory(Skip = "Issue #31621"), InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Unchanged, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_readonly_struct_collections(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithReadonlyStructCollections); - [ConditionalTheory(Skip = "Issue #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31621"), InlineData(false), InlineData(true)] public virtual void Can_mark_complex_readonly_struct_collection_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithReadonlyStructCollections); - [ConditionalTheory(Skip = "Issue #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31621"), InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_readonly_struct_collections(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithReadonlyStructCollections); - [ConditionalTheory(Skip = "Issue #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31621"), InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_readonly_struct_collections(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithReadonlyStructCollections); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_record_collections(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithRecordCollections); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_record_collection_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithRecordCollections); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_record_collections(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithRecordCollections); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_record_collections(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithRecordCollections); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_field_collections(EntityState state, bool async) => TrackAndSaveTest(state, async, CreateFieldCollectionPub); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_field_collection_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreateFieldCollectionPub); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_field_collections(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreateFieldCollectionPub); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_field_collections(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreateFieldCollectionPub); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Unchanged, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_struct_collections_with_fields(EntityState state, bool async) => TrackAndSaveTest(state, async, CreateFieldCollectionPubWithStructs); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_mark_complex_struct_collections_with_fields_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreateFieldCollectionPubWithStructs); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_struct_collections_with_fields(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreateFieldCollectionPubWithStructs); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_struct_collections_with_fields(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreateFieldCollectionPubWithStructs); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_record_collections_with_fields(EntityState state, bool async) => TrackAndSaveTest(state, async, CreateFieldCollectionPubWithRecords); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_record_collections_with_fields_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreateFieldCollectionPubWithRecords); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_record_collections_with_fields(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreateFieldCollectionPubWithRecords); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_record_collections_with_fields(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreateFieldCollectionPubWithRecords); - [ConditionalTheory(Skip = "Constructor binding #31621")] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory(Skip = "Constructor binding #31621"), InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Unchanged, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_readonly_struct_collections_with_fields(EntityState state, bool async) => TrackAndSaveTest(state, async, CreateFieldCollectionPubWithReadonlyStructs); - [ConditionalTheory(Skip = "Constructor binding #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Constructor binding #31621"), InlineData(false), InlineData(true)] public virtual void Can_mark_complex_readonly_struct_collections_with_fields_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreateFieldCollectionPubWithReadonlyStructs); - [ConditionalTheory(Skip = "Constructor binding #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Constructor binding #31621"), InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_readonly_struct_collections_with_fields(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreateFieldCollectionPubWithReadonlyStructs); - [ConditionalTheory(Skip = "Constructor binding #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Constructor binding #31621"), InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_readonly_struct_collections_with_fields(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreateFieldCollectionPubWithReadonlyStructs); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Unchanged, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_type_array_collections(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(false), InlineData(true)] public virtual void Can_mark_complex_type_array_collection_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_type_array_collections(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_type_array_collections(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Unchanged, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_struct_array_collections(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithStructArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(false), InlineData(true)] public virtual void Can_mark_complex_struct_array_collection_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithStructArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_struct_array_collections(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithStructArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_struct_array_collections(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithStructArrayCollections); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Unchanged, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_readonly_struct_array_collections(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithReadonlyStructArrayCollections); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_mark_complex_readonly_struct_array_collection_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithReadonlyStructArrayCollections); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_readonly_struct_array_collections(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithReadonlyStructArrayCollections); - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_readonly_struct_array_collections(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithReadonlyStructArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Unchanged, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_record_array_collections(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithRecordArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(false), InlineData(true)] public virtual void Can_mark_complex_record_array_collection_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithRecordArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_record_array_collections(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithRecordArrayCollections); - [ConditionalTheory(Skip = "Issue #36483")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #36483"), InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_record_array_collections(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithRecordArrayCollections); - [ConditionalTheory] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Deleted, true)] + [ConditionalTheory, InlineData(EntityState.Added, false), InlineData(EntityState.Added, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Deleted, true)] public virtual Task Can_track_entity_with_complex_property_bag_collections(EntityState state, bool async) => TrackAndSaveTest(state, async, CreatePubWithPropertyBagCollections); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_mark_complex_property_bag_collection_properties_modified(bool trackFromQuery) => MarkModifiedTest(trackFromQuery, CreatePubWithPropertyBagCollections); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_read_original_values_for_properties_of_complex_property_bag_collections(bool trackFromQuery) => ReadOriginalValuesTest(trackFromQuery, CreatePubWithPropertyBagCollections); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_write_original_values_for_properties_of_complex_property_bag_collections(bool trackFromQuery) => WriteOriginalValuesTest(trackFromQuery, CreatePubWithPropertyBagCollections); private async Task TrackAndSaveTest(EntityState state, bool async, Func createPub) where TEntity : class - => await ExecuteWithStrategyInTransactionAsync( - async context => + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var pub = createPub(context); + var entry = state switch { - var pub = createPub(context); - var entry = state switch - { - EntityState.Unchanged => context.Attach(pub), - EntityState.Deleted => context.Remove(pub), - EntityState.Modified => context.Update(pub), - EntityState.Added => async ? await context.AddAsync(pub) : context.Add(pub), - _ => throw new ArgumentOutOfRangeException(nameof(state), state, null) - }; + EntityState.Unchanged => context.Attach(pub), + EntityState.Deleted => context.Remove(pub), + EntityState.Modified => context.Update(pub), + EntityState.Added => async ? await context.AddAsync(pub) : context.Add(pub), + _ => throw new ArgumentOutOfRangeException(nameof(state), state, null) + }; + + Assert.Equal(state, entry.State); + + var hasCollections = entry.Metadata.GetComplexProperties().Any(p => p.Name == "Activities"); + if (hasCollections) + { + AssertCollectionPropertyValues(entry); + AssertCollectionPropertiesModified(entry, state); + } + else + { + AssertPropertyValues(entry); + AssertPropertiesModified(entry, state == EntityState.Modified); + } + + if (state == EntityState.Added || state == EntityState.Unchanged) + { + _ = async ? await context.SaveChangesAsync() : context.SaveChanges(); - Assert.Equal(state, entry.State); + Assert.Equal(EntityState.Unchanged, entry.State); - var hasCollections = entry.Metadata.GetComplexProperties().Any(p => p.Name == "Activities"); if (hasCollections) { AssertCollectionPropertyValues(entry); - AssertCollectionPropertiesModified(entry, state); } else { AssertPropertyValues(entry); - AssertPropertiesModified(entry, state == EntityState.Modified); - } - - if (state == EntityState.Added || state == EntityState.Unchanged) - { - _ = async ? await context.SaveChangesAsync() : context.SaveChanges(); - - Assert.Equal(EntityState.Unchanged, entry.State); - - if (hasCollections) - { - AssertCollectionPropertyValues(entry); - } - else - { - AssertPropertyValues(entry); - } } - }); + } + }); private void MarkModifiedTest(bool trackFromQuery, Func createPub) where TEntity : class @@ -953,9 +700,7 @@ private void WriteOriginalValuesTest(bool trackFromQuery, Func( - () => async ? context.SaveChangesAsync() : Task.FromResult(context.SaveChanges()))).Message); + (await Assert.ThrowsAsync(() + => async ? context.SaveChangesAsync() : Task.FromResult(context.SaveChanges()))).Message); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Throws_only_when_saving_with_null_second_level_complex_property(bool async) { - using var context = CreateContext(); + await using var context = CreateContext(); var yogurt = CreateYogurt(context, nullManufacturer: true); - var entry = async ? await context.AddAsync(yogurt) : context.Add(yogurt); + _ = async ? await context.AddAsync(yogurt) : context.Add(yogurt); Assert.Equal( CoreStrings.NullRequiredComplexProperty("Culture", "Manufacturer"), - (await Assert.ThrowsAsync( - () => async ? context.SaveChangesAsync() : Task.FromResult(context.SaveChanges()))).Message); + (await Assert.ThrowsAsync(() + => async ? context.SaveChangesAsync() : Task.FromResult(context.SaveChanges()))).Message); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_save_null_second_level_complex_property_with_required_properties(bool async) { - using var context = CreateContext(); + await using var context = CreateContext(); + + List a = [1, 2]; await context.Database.CreateExecutionStrategy().ExecuteAsync( context, async context => { - using var transaction = context.Database.BeginTransaction(); + await using var transaction = await context.Database.BeginTransactionAsync(); var yogurt = CreateYogurt(context, nullLicense: true); - var entry = async ? await context.AddAsync(yogurt) : context.Add(yogurt); + _ = async ? await context.AddAsync(yogurt) : context.Add(yogurt); if (async) { @@ -1102,20 +843,18 @@ await context.Database.CreateExecutionStrategy().ExecuteAsync( }); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_save_null_third_level_complex_property_with_all_optional_properties(bool async) { - using var context = CreateContext(); + await using var context = CreateContext(); await context.Database.CreateExecutionStrategy().ExecuteAsync( context, async context => { - using var transaction = context.Database.BeginTransaction(); + await using var transaction = await context.Database.BeginTransactionAsync(); var yogurt = CreateYogurt(context, nullTag: true); - var entry = async ? await context.AddAsync(yogurt) : context.Add(yogurt); + _ = async ? await context.AddAsync(yogurt) : context.Add(yogurt); if (async) { @@ -1136,9 +875,7 @@ await context.Database.CreateExecutionStrategy().ExecuteAsync( }); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Detect_changes_in_complex_struct_type_properties(bool trackFromQuery) { using var context = CreateContext(); @@ -1227,9 +964,7 @@ public virtual void Detect_changes_in_complex_struct_type_properties(bool trackF } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Detects_changes_in_complex_readonly_struct_type_properties(bool trackFromQuery) { using var context = CreateContext(); @@ -1372,9 +1107,7 @@ public virtual void Detects_changes_in_complex_readonly_struct_type_properties(b } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Detects_changes_in_complex_record_type_properties(bool trackFromQuery) { using var context = CreateContext(); @@ -1460,9 +1193,7 @@ public virtual void Detects_changes_in_complex_record_type_properties(bool track } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_detect_reordered_elements_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -1490,9 +1221,7 @@ public virtual void Can_detect_reordered_elements_in_complex_type_collections(bo Assert.True(collectionEntry.IsModified); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_detect_added_elements_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -1502,20 +1231,21 @@ public virtual void Can_detect_added_elements_in_complex_type_collections(bool t Assert.Equal(EntityState.Unchanged, entry.State); - pub.Activities.Add(new ActivityWithCollection - { - Name = "New Activity", - Day = DayOfWeek.Saturday, - CoverCharge = 10.0m, - Description = "A new activity", - IsTeamBased = false, - Notes = ["New", "Notes"], - Teams = - [ - new Team { Name = "New Champions", Members = ["A", "B", "C"] }, - new Team { Name = "New Runners Up", Members = ["X", "Y", "Z"] } - ] - }); + pub.Activities.Add( + new ActivityWithCollection + { + Name = "New Activity", + Day = DayOfWeek.Saturday, + CoverCharge = 10.0m, + Description = "A new activity", + IsTeamBased = false, + Notes = ["New", "Notes"], + Teams = + [ + new Team { Name = "New Champions", Members = ["A", "B", "C"] }, + new Team { Name = "New Runners Up", Members = ["X", "Y", "Z"] } + ] + }); context.ChangeTracker.DetectChanges(); @@ -1538,9 +1268,7 @@ public virtual void Can_detect_added_elements_in_complex_type_collections(bool t Assert.Equal("New Runners Up", newActivity.Teams[1].Name); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_detect_removed_elements_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -1566,9 +1294,7 @@ public virtual void Can_detect_removed_elements_in_complex_type_collections(bool Assert.True(collectionEntry.IsModified); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_detect_replaced_elements_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -1619,9 +1345,7 @@ public virtual void Can_detect_replaced_elements_in_complex_type_collections(boo Assert.Equal("Replaced Runners Up", runnersUpEntry.Property(nameof(Team.Name)).CurrentValue); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_detect_duplicates_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -1652,40 +1376,40 @@ public virtual void Can_detect_duplicates_in_complex_type_collections(bool track Assert.Equal(EntityState.Added, activitiesEntry[2].State); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_handle_null_elements_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); var pub = CreatePubWithCollections(context); pub.Activities.Clear(); - pub.Activities.Add(new ActivityWithCollection - { - Name = "Activity with null Teams", - Day = DayOfWeek.Sunday, - CoverCharge = 0.0m, - Description = "Added after null", - IsTeamBased = false, - Notes = ["Note after null"], - Teams = null! - }); + pub.Activities.Add( + new ActivityWithCollection + { + Name = "Activity with null Teams", + Day = DayOfWeek.Sunday, + CoverCharge = 0.0m, + Description = "Added after null", + IsTeamBased = false, + Notes = ["Note after null"], + Teams = null! + }); var entry = trackFromQuery ? TrackFromQuery(context, pub) : context.Attach(pub); Assert.Equal(EntityState.Unchanged, entry.State); pub.Activities.Add(null!); - pub.Activities.Add(new ActivityWithCollection - { - Name = "Activity with empty Teams", - Day = DayOfWeek.Sunday, - CoverCharge = 0.0m, - Description = "Added with empty teams", - IsTeamBased = false, - Notes = ["Empty teams note"], - Teams = [] - }); + pub.Activities.Add( + new ActivityWithCollection + { + Name = "Activity with empty Teams", + Day = DayOfWeek.Sunday, + CoverCharge = 0.0m, + Description = "Added with empty teams", + IsTeamBased = false, + Notes = ["Empty teams note"], + Teams = [] + }); context.ChangeTracker.DetectChanges(); @@ -1727,9 +1451,7 @@ public virtual void Can_handle_null_elements_in_complex_type_collections(bool tr Assert.Throws(() => nullCoverChargeEntry.CurrentValue = 3.0m).Message); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_detect_swapped_complex_objects_in_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -1776,9 +1498,7 @@ public virtual void Can_detect_swapped_complex_objects_in_collections(bool track Assert.Equal([1, 1], team2Entry.GetInfrastructure().GetOrdinals()); } - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_detect_changes_to_struct_collection_elements(bool trackFromQuery) { using var context = CreateContext(); @@ -1807,9 +1527,7 @@ public virtual void Can_detect_changes_to_struct_collection_elements(bool trackF Assert.Equal(12.5m, pub.Activities[0].CoverCharge); } - [ConditionalTheory(Skip = "Issue #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31621"), InlineData(false), InlineData(true)] public virtual void Can_detect_changes_to_readonly_struct_collection_elements(bool trackFromQuery) { using var context = CreateContext(); @@ -1820,12 +1538,7 @@ public virtual void Can_detect_changes_to_readonly_struct_collection_elements(bo var newTeams = new List { - pub.Activities[0].Teams[0], - new TeamReadonlyStruct - { - Name = "New Readonly Team", - Members = ["X", "Y", "Z"] - } + pub.Activities[0].Teams[0], new() { Name = "New Readonly Team", Members = ["X", "Y", "Z"] } }; pub.Activities[0] = new ActivityReadonlyStructWithCollection @@ -1858,25 +1571,24 @@ public virtual void Can_detect_changes_to_readonly_struct_collection_elements(bo Assert.Equal(new[] { "X", "Y", "Z" }, pub.Activities[0].Teams[1].Members); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_handle_collection_with_mixed_null_and_duplicate_elements(bool trackFromQuery) { using var context = CreateContext(); var pub = CreatePubWithCollections(context); pub.Activities.Add(null!); - pub.Activities.Add(new ActivityWithCollection - { - Name = pub.Activities[0].Name, - Day = pub.Activities[0].Day, - Description = pub.Activities[0].Description, - Notes = pub.Activities[0].Notes?.ToArray(), - CoverCharge = pub.Activities[0].CoverCharge, - IsTeamBased = pub.Activities[0].IsTeamBased, - Teams = null! - }); + pub.Activities.Add( + new ActivityWithCollection + { + Name = pub.Activities[0].Name, + Day = pub.Activities[0].Day, + Description = pub.Activities[0].Description, + Notes = pub.Activities[0].Notes?.ToArray(), + CoverCharge = pub.Activities[0].CoverCharge, + IsTeamBased = pub.Activities[0].IsTeamBased, + Teams = null! + }); var entry = trackFromQuery ? TrackFromQuery(context, pub) : context.Attach(pub); Assert.Equal(EntityState.Unchanged, entry.State); @@ -1906,9 +1618,7 @@ public virtual void Can_handle_collection_with_mixed_null_and_duplicate_elements Assert.Null(duplicate.Teams); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_detect_changes_to_record_collection_elements(bool trackFromQuery) { using var context = CreateContext(); @@ -1936,9 +1646,7 @@ public virtual void Can_detect_changes_to_record_collection_elements(bool trackF Assert.Equal(20.0m, activityEntry.Property("CoverCharge").CurrentValue); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_detect_nested_collection_changes_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -1970,9 +1678,7 @@ public virtual void Can_detect_nested_collection_changes_in_complex_type_collect Assert.Equal("New Team", teamEntry.Property("Name").CurrentValue); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_detect_changes_to_nested_teams_members_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -1999,9 +1705,7 @@ public virtual void Can_detect_changes_to_nested_teams_members_in_complex_type_c Assert.Contains("New Member", pub.Activities[0].Teams[0].Members); } - [ConditionalTheory(Skip = "Issue #31411")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31411"), InlineData(false), InlineData(true)] public virtual void Can_detect_changes_to_nested_struct_teams_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -2011,11 +1715,7 @@ public virtual void Can_detect_changes_to_nested_struct_teams_in_complex_type_co Assert.Equal(EntityState.Unchanged, entry.State); var teams = pub.Activities[0].Teams.ToList(); - teams[0] = new TeamStruct - { - Name = teams[0].Name, - Members = [.. teams[0].Members, "Additional Member"] - }; + teams[0] = new TeamStruct { Name = teams[0].Name, Members = [.. teams[0].Members, "Additional Member"] }; var activity = pub.Activities[0]; activity.Teams = teams; pub.Activities[0] = activity; @@ -2036,9 +1736,7 @@ public virtual void Can_detect_changes_to_nested_struct_teams_in_complex_type_co Assert.Contains("Additional Member", pub.Activities[0].Teams[0].Members); } - [ConditionalTheory(Skip = "Issue #31621")] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory(Skip = "Issue #31621"), InlineData(false), InlineData(true)] public virtual void Can_detect_changes_to_nested_readonly_struct_teams_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -2048,11 +1746,7 @@ public virtual void Can_detect_changes_to_nested_readonly_struct_teams_in_comple Assert.Equal(EntityState.Unchanged, entry.State); var teams = pub.Activities[0].Teams.ToList(); - teams[0] = new TeamReadonlyStruct - { - Name = teams[0].Name, - Members = [.. teams[0].Members, "Additional Member"] - }; + teams[0] = new TeamReadonlyStruct { Name = teams[0].Name, Members = [.. teams[0].Members, "Additional Member"] }; pub.Activities[0] = new ActivityReadonlyStructWithCollection { @@ -2081,9 +1775,7 @@ public virtual void Can_detect_changes_to_nested_readonly_struct_teams_in_comple Assert.Contains("Additional Member", pub.Activities[0].Teams[0].Members); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_detect_changes_to_record_teams_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -2113,9 +1805,7 @@ public virtual void Can_detect_changes_to_record_teams_in_complex_type_collectio Assert.Contains("Additional Member", pub.Activities[0].Teams[0].Members); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Can_handle_empty_nested_teams_in_complex_type_collections(bool trackFromQuery) { using var context = CreateContext(); @@ -2124,16 +1814,17 @@ public virtual void Can_handle_empty_nested_teams_in_complex_type_collections(bo var entry = trackFromQuery ? TrackFromQuery(context, pub) : context.Attach(pub); Assert.Equal(EntityState.Unchanged, entry.State); - pub.Activities.Add(new ActivityWithCollection - { - Name = "Activity with empty Teams", - Day = DayOfWeek.Thursday, - CoverCharge = 1.0m, - Description = "Testing empty nested collections", - IsTeamBased = false, - Notes = ["Note"], - Teams = [] - }); + pub.Activities.Add( + new ActivityWithCollection + { + Name = "Activity with empty Teams", + Day = DayOfWeek.Thursday, + CoverCharge = 1.0m, + Description = "Testing empty nested collections", + IsTeamBased = false, + Notes = ["Note"], + Teams = [] + }); context.ChangeTracker.DetectChanges(); @@ -2162,10 +1853,14 @@ public virtual void Throws_when_accessing_complex_entries_using_incorrect_cardin var entry = context.Attach(pub); - Assert.Equal(CoreStrings.ComplexReferenceIsCollection(entry.Metadata.DisplayName(), nameof(PubWithCollections.Activities), "ComplexProperty", "ComplexCollection"), + Assert.Equal( + CoreStrings.ComplexReferenceIsCollection( + entry.Metadata.DisplayName(), nameof(PubWithCollections.Activities), "ComplexProperty", "ComplexCollection"), Assert.Throws(() => entry.ComplexProperty(e => e.Activities)).Message); - Assert.Equal(CoreStrings.ComplexCollectionIsReference(entry.Metadata.DisplayName(), nameof(PubWithCollections.FeaturedTeam), "ComplexCollection", "ComplexProperty"), + Assert.Equal( + CoreStrings.ComplexCollectionIsReference( + entry.Metadata.DisplayName(), nameof(PubWithCollections.FeaturedTeam), "ComplexCollection", "ComplexProperty"), Assert.Throws(() => entry.ComplexCollection(e => (IList)e.FeaturedTeam)).Message); } @@ -2297,7 +1992,7 @@ protected void AssertPropertiesModified(EntityEntry entry, bool expected) var eveningRunnersUpEntry = eveningEntry.ComplexProperty("RunnersUp"); Assert.Equal(expected, eveningRunnersUpEntry.Property("Name").IsModified); - Assert.Equal(expected, eveningRunnersUpEntry.Property("Members").IsModified!); + Assert.Equal(expected, eveningRunnersUpEntry.Property("Members").IsModified); var teamEntry = entry.ComplexProperty("FeaturedTeam"); Assert.Equal(expected, teamEntry.Property("Name").IsModified); @@ -2396,85 +2091,80 @@ public virtual bool UseProxies protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - b => - { - b.ComplexProperty( - e => e.LunchtimeActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty( - e => e.EveningActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexProperty( + e => e.LunchtimeActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty( + e => e.EveningActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty(e => e.FeaturedTeam); + }); - modelBuilder.Entity( - b => - { - b.ComplexProperty( - e => e.LunchtimeActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty( - e => e.EveningActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexProperty( + e => e.LunchtimeActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty( + e => e.EveningActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty(e => e.FeaturedTeam); + }); - modelBuilder.Entity( - b => - { - b.ComplexProperty( - e => e.LunchtimeActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty( - e => e.EveningActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexProperty( + e => e.LunchtimeActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty( + e => e.EveningActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty(e => e.FeaturedTeam); + }); - modelBuilder.Entity( - b => - { - b.ComplexProperty( - e => e.LunchtimeActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty( - e => e.EveningActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexProperty( + e => e.LunchtimeActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty( + e => e.EveningActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty(e => e.FeaturedTeam); + }); - modelBuilder.Entity( - b => - { - b.ComplexCollection( - e => e.Activities, b => b.ComplexCollection(e => e.Teams)); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexCollection( + e => e.Activities, b => b.ComplexCollection(e => e.Teams)); + b.ComplexProperty(e => e.FeaturedTeam); + }); // TODO: Issue #31411 //modelBuilder.Entity( @@ -2500,21 +2190,19 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con // b.ComplexProperty(e => e.FeaturedTeam); // }); - modelBuilder.Entity( - b => - { - b.ComplexCollection( - e => e.Activities, b => b.ComplexCollection(e => e.Teams)); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexCollection( + e => e.Activities, b => b.ComplexCollection(e => e.Teams)); + b.ComplexProperty(e => e.FeaturedTeam); + }); - modelBuilder.Entity( - b => - { - b.ComplexCollection( - e => e.Activities, b => b.ComplexCollection(e => e.Teams)); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexCollection( + e => e.Activities, b => b.ComplexCollection(e => e.Teams)); + b.ComplexProperty(e => e.FeaturedTeam); + }); // TODO: Issue #31411 //modelBuilder.Entity( @@ -2539,21 +2227,20 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con // b.ComplexProperty(e => e.FeaturedTeam); // }); - modelBuilder.Entity( - b => - { - b.ComplexCollection( - e => e.Activities, b => b.ComplexCollection(e => e.Teams)); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexCollection( + e => e.Activities, b => b.ComplexCollection(e => e.Teams)); + b.ComplexProperty(e => e.FeaturedTeam); + }); - modelBuilder.Entity( - b => - { - b.ComplexCollection( - e => e.Activities, b => - { - b.ComplexCollection(e => e.Teams, "TeamPropertyBag", teamBuilder => + modelBuilder.Entity(b => + { + b.ComplexCollection( + e => e.Activities, b => + { + b.ComplexCollection( + e => e.Teams, "TeamPropertyBag", teamBuilder => { teamBuilder.Property("Name"); teamBuilder.Property>("Members"); @@ -2561,8 +2248,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con teamBuilder.Property("IsActive"); teamBuilder.Property("Rating"); }); - }); - b.ComplexProperty(e => e.FeaturedTeam, "FeaturedTeamPropertyBag", featuredTeamBuilder => + }); + b.ComplexProperty( + e => e.FeaturedTeam, "FeaturedTeamPropertyBag", featuredTeamBuilder => { featuredTeamBuilder.Property("Name"); featuredTeamBuilder.Property>("Members"); @@ -2570,45 +2258,43 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con featuredTeamBuilder.Property("IsActive"); featuredTeamBuilder.Property("Rating"); }); - }); + }); if (!UseProxies) { - modelBuilder.Entity( - b => - { - b.ComplexProperty( - e => e.LunchtimeActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty( - e => e.EveningActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexProperty( + e => e.LunchtimeActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty( + e => e.EveningActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty(e => e.FeaturedTeam); + }); - modelBuilder.Entity( - b => - { - b.ComplexProperty( - e => e.LunchtimeActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty( - e => e.EveningActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexProperty( + e => e.LunchtimeActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty( + e => e.EveningActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty(e => e.FeaturedTeam); + }); // TODO: Allow binding of complex properties to constructors #31621 //modelBuilder.Entity( @@ -2629,34 +2315,32 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con // b.ComplexProperty(e => e.FeaturedTeam); // }); - modelBuilder.Entity( - b => - { - b.ComplexProperty( - e => e.LunchtimeActivity, b => - { - b.ComplexProperty(e => e!.Champions); - b.ComplexProperty(e => e!.RunnersUp); - }); - b.ComplexProperty( - e => e.EveningActivity, b => - { - b.ComplexProperty(e => e.Champions); - b.ComplexProperty(e => e.RunnersUp); - }); - b.ComplexProperty(e => e.FeaturedTeam); - }); - - modelBuilder.Entity( - b => - { - b.ComplexCollection( - e => e.Activities, b => - { - b.ComplexCollection(e => e.Teams); - }); - b.ComplexProperty(e => e.FeaturedTeam); - }); + modelBuilder.Entity(b => + { + b.ComplexProperty( + e => e.LunchtimeActivity, b => + { + b.ComplexProperty(e => e!.Champions); + b.ComplexProperty(e => e!.RunnersUp); + }); + b.ComplexProperty( + e => e.EveningActivity, b => + { + b.ComplexProperty(e => e.Champions); + b.ComplexProperty(e => e.RunnersUp); + }); + b.ComplexProperty(e => e.FeaturedTeam); + }); + + modelBuilder.Entity(b => + { + b.ComplexCollection( + e => e.Activities, b => + { + b.ComplexCollection(e => e.Teams); + }); + b.ComplexProperty(e => e.FeaturedTeam); + }); // TODO: Issue #31411 //modelBuilder.Entity( @@ -2682,55 +2366,53 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con // b.ComplexProperty(e => e.FeaturedTeam); // }); - modelBuilder.Entity( - b => + modelBuilder.Entity(b => + { + b.ComplexCollection( + e => e.Activities, b => + { + b.ComplexCollection(e => e.Teams); + }); + b.ComplexProperty(e => e.FeaturedTeam); + }); + } + + modelBuilder.Entity(b => + { + b.ComplexProperty( + e => e.Culture, b => { - b.ComplexCollection( - e => e.Activities, b => + b.ComplexProperty( + e => e.License, b => + { + b.ComplexProperty(e => e.Tag); + b.ComplexProperty(e => e.Tog); + }); + b.ComplexProperty( + e => e.Manufacturer, b => { - b.ComplexCollection(e => e.Teams); + b.ComplexProperty(e => e.Tag); + b.ComplexProperty(e => e.Tog); }); - b.ComplexProperty(e => e.FeaturedTeam); }); - } - - modelBuilder.Entity( - b => - { - b.ComplexProperty( - e => e.Culture, b => - { - b.ComplexProperty( - e => e.License, b => - { - b.ComplexProperty(e => e.Tag); - b.ComplexProperty(e => e.Tog); - }); - b.ComplexProperty( - e => e.Manufacturer, b => - { - b.ComplexProperty(e => e.Tag); - b.ComplexProperty(e => e.Tog); - }); - }); - b.ComplexProperty( - e => e.Milk, b => - { - b.ComplexProperty( - e => e.License, b => - { - b.ComplexProperty(e => e.Tag); - b.ComplexProperty(e => e.Tog); - }); - b.ComplexProperty( - e => e.Manufacturer, b => - { - b.ComplexProperty(e => e.Tag); - b.ComplexProperty(e => e.Tog); - }); - }); - }); + b.ComplexProperty( + e => e.Milk, b => + { + b.ComplexProperty( + e => e.License, b => + { + b.ComplexProperty(e => e.Tag); + b.ComplexProperty(e => e.Tog); + }); + b.ComplexProperty( + e => e.Manufacturer, b => + { + b.ComplexProperty(e => e.Tag); + b.ComplexProperty(e => e.Tog); + }); + }); + }); } } @@ -3036,7 +2718,6 @@ public class ActivityWithPropertyBagCollection public List> Teams { get; set; } = []; } - protected PubWithReadonlyStructs CreatePubWithReadonlyStructs(DbContext context) { var pub = Fixture.UseProxies @@ -3240,7 +2921,9 @@ public class PubWithCollections public class PubWithStructCollections { public virtual Guid Id { get; set; } + public virtual string Name { get; set; } = null!; + // TODO: Use ObservableList #31621 public virtual List Activities { get; set; } = []; public virtual TeamStruct FeaturedTeam { get; set; } @@ -3249,7 +2932,9 @@ public class PubWithStructCollections public class PubWithReadonlyStructCollections { public virtual Guid Id { get; set; } + public virtual string Name { get; set; } = null!; + // TODO: Use ObservableList #31621 public virtual List Activities { get; set; } = []; public virtual TeamReadonlyStruct FeaturedTeam { get; set; } @@ -3314,7 +2999,9 @@ public class FieldPubWithCollections public class FieldPubWithStructCollections { public Guid Id { get; set; } + public string Name { get; set; } = null!; + // TODO: Use ObservableList #31621 public List Activities = []; public TeamStruct FeaturedTeam; @@ -3323,7 +3010,9 @@ public class FieldPubWithStructCollections public class FieldPubWithReadonlyStructCollections { public Guid Id { get; set; } + public string Name { get; set; } = null!; + // TODO: Use ObservableList #31621 public List Activities = []; public TeamReadonlyStruct FeaturedTeam; @@ -3712,7 +3401,12 @@ public struct Tog public string? Text { get; set; } } - protected Yogurt CreateYogurt(DbContext context, bool nullMilk = false, bool nullManufacturer = false, bool nullTag = false, bool nullLicense = false) + protected Yogurt CreateYogurt( + DbContext context, + bool nullMilk = false, + bool nullManufacturer = false, + bool nullTag = false, + bool nullLicense = false) { var yogurt = Fixture.UseProxies ? context.CreateProxy() @@ -3787,61 +3481,61 @@ protected PubWithCollections CreatePubWithCollections(DbContext context) pub.Activities = [ new ActivityWithCollection - { - Name = "Pub Quiz", - Day = DayOfWeek.Monday, - Description = "A general knowledge pub quiz.", - Notes = ["One", "Two", "Three"], - CoverCharge = 2.0m, - IsTeamBased = true, - Teams = - [ - new Team - { - Name = "Clueless", - Members = + { + Name = "Pub Quiz", + Day = DayOfWeek.Monday, + Description = "A general knowledge pub quiz.", + Notes = ["One", "Two", "Three"], + CoverCharge = 2.0m, + IsTeamBased = true, + Teams = + [ + new Team { - "Boris", - "David", - "Theresa" - } - }, - new Team - { - Name = "ZZ", - Members = + Name = "Clueless", + Members = + { + "Boris", + "David", + "Theresa" + } + }, + new Team { - "Has Beard", - "Has Beard", - "Is Called Beard" + Name = "ZZ", + Members = + { + "Has Beard", + "Has Beard", + "Is Called Beard" + } } - } - ] - }, - new ActivityWithCollection - { - Name = "Music Quiz", - Day = DayOfWeek.Friday, - Description = "A music pub quiz.", - Notes = [], - CoverCharge = 5.0m, - IsTeamBased = true, - Teams = - [ - new Team - { - Name = "Dazed and Confused", - Members = + ] + }, + new ActivityWithCollection + { + Name = "Music Quiz", + Day = DayOfWeek.Friday, + Description = "A music pub quiz.", + Notes = [], + CoverCharge = 5.0m, + IsTeamBased = true, + Teams = + [ + new Team { - "Robert", - "Jimmy", - "John", - "Jason" - } - }, - new Team { Name = "Banksy", Members = [] } - ] - } + Name = "Dazed and Confused", + Members = + { + "Robert", + "Jimmy", + "John", + "Jason" + } + }, + new Team { Name = "Banksy", Members = [] } + ] + } ]; pub.FeaturedTeam = new Team { Name = "Not In This Lifetime", Members = { "Slash", "Axl" } }; @@ -3861,230 +3555,6 @@ protected PubWithStructCollections CreatePubWithStructCollections(DbContext cont pub.Activities = [ new ActivityStructWithCollection - { - Name = "Pub Quiz", - Day = DayOfWeek.Monday, - Description = "A general knowledge pub quiz.", - Notes = ["One", "Two", "Three"], - CoverCharge = 2.0m, - IsTeamBased = true, - Teams = - [ - new TeamStruct - { - Name = "Clueless", - Members = - [ - "Boris", - "David", - "Theresa" - ] - }, - new TeamStruct - { - Name = "ZZ", - Members = - [ - "Has Beard", - "Has Beard", - "Is Called Beard" - ] - } - ] - }, - new ActivityStructWithCollection(), - new ActivityStructWithCollection - { - Name = "Music Quiz", - Day = DayOfWeek.Friday, - Description = "A music pub quiz.", - Notes = [], - CoverCharge = 5.0m, - IsTeamBased = true, - Teams = - [ - new TeamStruct - { - Name = "Dazed and Confused", - Members = - [ - "Robert", - "Jimmy", - "John", - "Jason" - ] - }, - new TeamStruct { Name = "Banksy", Members = [] } - ] - } - ]; - - pub.FeaturedTeam = new TeamStruct { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] }; - - return pub; - } - - protected PubWithReadonlyStructCollections CreatePubWithReadonlyStructCollections(DbContext context) - { - var pub = Fixture.UseProxies - ? context.CreateProxy() - : new PubWithReadonlyStructCollections(); - - pub.Id = Guid.NewGuid(); - pub.Name = "The FBI"; - - pub.Activities = - [ - new ActivityReadonlyStructWithCollection - { - Name = "Pub Quiz", - Day = DayOfWeek.Monday, - Description = "A general knowledge pub quiz.", - Notes = ["One", "Two", "Three"], - CoverCharge = 2.0m, - IsTeamBased = true, - Teams = - [ - new TeamReadonlyStruct - { - Name = "Clueless", - Members = - [ - "Boris", - "David", - "Theresa" - ] - }, - new TeamReadonlyStruct - { - Name = "ZZ", - Members = - [ - "Has Beard", - "Has Beard", - "Is Called Beard" - ] - } - ] - }, - new ActivityReadonlyStructWithCollection(), - new ActivityReadonlyStructWithCollection - { - Name = "Music Quiz", - Day = DayOfWeek.Friday, - Description = "A music pub quiz.", - Notes = [], - CoverCharge = 5.0m, - IsTeamBased = true, - Teams = - [ - new TeamReadonlyStruct - { - Name = "Dazed and Confused", - Members = - [ - "Robert", - "Jimmy", - "John", - "Jason" - ] - }, - new TeamReadonlyStruct { Name = "Banksy", Members = [] } - ] - } - ]; - - pub.FeaturedTeam = new TeamReadonlyStruct { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] }; - - return pub; - } - - protected PubWithRecordCollections CreatePubWithRecordCollections(DbContext context) - { - var pub = Fixture.UseProxies - ? context.CreateProxy() - : new PubWithRecordCollections(); - - pub.Id = Guid.NewGuid(); - pub.Name = "The FBI"; - - pub.Activities = - [ - new ActivityRecordWithCollection - { - Name = "Pub Quiz", - Day = DayOfWeek.Monday, - Description = "A general knowledge pub quiz.", - Notes = ["One", "Two", "Three"], - CoverCharge = 2.0m, - IsTeamBased = true, - Teams = - [ - new TeamRecord - { - Name = "Clueless", - Members = - [ - "Boris", - "David", - "Theresa" - ] - }, - new TeamRecord - { - Name = "ZZ", - Members = - [ - "Has Beard", - "Has Beard", - "Is Called Beard" - ] - } - ] - }, - new ActivityRecordWithCollection - { - Name = "Music Quiz", - Day = DayOfWeek.Friday, - Description = "A music pub quiz.", - Notes = [], - CoverCharge = 5.0m, - IsTeamBased = true, - Teams = - [ - new TeamRecord - { - Name = "Dazed and Confused", - Members = - [ - "Robert", - "Jimmy", - "John", - "Jason" - ] - }, - new TeamRecord { Name = "Banksy", Members = [] } - ] - } - ]; - - pub.FeaturedTeam = new TeamRecord { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] }; - - return pub; - } - - protected PubWithArrayCollections CreatePubWithArrayCollections(DbContext context) - { - var pub = Fixture.UseProxies - ? context.CreateProxy() - : new PubWithArrayCollections(); - - pub.Id = Guid.NewGuid(); - pub.Name = "The FBI"; - - pub.Activities = - [ - new ActivityWithArrayCollection { Name = "Pub Quiz", Day = DayOfWeek.Monday, @@ -4094,29 +3564,30 @@ protected PubWithArrayCollections CreatePubWithArrayCollections(DbContext contex IsTeamBased = true, Teams = [ - new Team + new TeamStruct { Name = "Clueless", Members = - { + [ "Boris", "David", "Theresa" - } + ] }, - new Team + new TeamStruct { Name = "ZZ", Members = - { + [ "Has Beard", "Has Beard", "Is Called Beard" - } + ] } ] }, - new ActivityWithArrayCollection + new ActivityStructWithCollection(), + new ActivityStructWithCollection { Name = "Music Quiz", Day = DayOfWeek.Friday, @@ -4126,39 +3597,39 @@ protected PubWithArrayCollections CreatePubWithArrayCollections(DbContext contex IsTeamBased = true, Teams = [ - new Team + new TeamStruct { Name = "Dazed and Confused", Members = - { + [ "Robert", "Jimmy", "John", "Jason" - } + ] }, - new Team { Name = "Banksy", Members = [] } + new TeamStruct { Name = "Banksy", Members = [] } ] } ]; - pub.FeaturedTeam = new Team { Name = "Not In This Lifetime", Members = { "Slash", "Axl" } }; + pub.FeaturedTeam = new TeamStruct { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] }; return pub; } - protected PubWithStructArrayCollections CreatePubWithStructArrayCollections(DbContext context) + protected PubWithReadonlyStructCollections CreatePubWithReadonlyStructCollections(DbContext context) { var pub = Fixture.UseProxies - ? context.CreateProxy() - : new PubWithStructArrayCollections(); + ? context.CreateProxy() + : new PubWithReadonlyStructCollections(); pub.Id = Guid.NewGuid(); pub.Name = "The FBI"; pub.Activities = [ - new ActivityStructWithArrayCollection + new ActivityReadonlyStructWithCollection { Name = "Pub Quiz", Day = DayOfWeek.Monday, @@ -4168,7 +3639,7 @@ protected PubWithStructArrayCollections CreatePubWithStructArrayCollections(DbCo IsTeamBased = true, Teams = [ - new TeamStruct + new TeamReadonlyStruct { Name = "Clueless", Members = @@ -4178,7 +3649,7 @@ protected PubWithStructArrayCollections CreatePubWithStructArrayCollections(DbCo "Theresa" ] }, - new TeamStruct + new TeamReadonlyStruct { Name = "ZZ", Members = @@ -4190,7 +3661,8 @@ protected PubWithStructArrayCollections CreatePubWithStructArrayCollections(DbCo } ] }, - new ActivityStructWithArrayCollection + new ActivityReadonlyStructWithCollection(), + new ActivityReadonlyStructWithCollection { Name = "Music Quiz", Day = DayOfWeek.Friday, @@ -4200,7 +3672,7 @@ protected PubWithStructArrayCollections CreatePubWithStructArrayCollections(DbCo IsTeamBased = true, Teams = [ - new TeamStruct + new TeamReadonlyStruct { Name = "Dazed and Confused", Members = @@ -4211,28 +3683,28 @@ protected PubWithStructArrayCollections CreatePubWithStructArrayCollections(DbCo "Jason" ] }, - new TeamStruct { Name = "Banksy", Members = [] } + new TeamReadonlyStruct { Name = "Banksy", Members = [] } ] } ]; - pub.FeaturedTeam = new TeamStruct { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] }; + pub.FeaturedTeam = new TeamReadonlyStruct { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] }; return pub; } - protected PubWithReadonlyStructArrayCollections CreatePubWithReadonlyStructArrayCollections(DbContext context) + protected PubWithRecordCollections CreatePubWithRecordCollections(DbContext context) { var pub = Fixture.UseProxies - ? context.CreateProxy() - : new PubWithReadonlyStructArrayCollections(); + ? context.CreateProxy() + : new PubWithRecordCollections(); pub.Id = Guid.NewGuid(); pub.Name = "The FBI"; pub.Activities = [ - new ActivityReadonlyStructWithArrayCollection + new ActivityRecordWithCollection { Name = "Pub Quiz", Day = DayOfWeek.Monday, @@ -4242,19 +3714,29 @@ protected PubWithReadonlyStructArrayCollections CreatePubWithReadonlyStructArray IsTeamBased = true, Teams = [ - new TeamReadonlyStruct("Clueless", [ - "Boris", - "David", - "Theresa" - ]), - new TeamReadonlyStruct("ZZ", [ - "Has Beard", - "Has Beard", - "Is Called Beard" - ]) + new TeamRecord + { + Name = "Clueless", + Members = + [ + "Boris", + "David", + "Theresa" + ] + }, + new TeamRecord + { + Name = "ZZ", + Members = + [ + "Has Beard", + "Has Beard", + "Is Called Beard" + ] + } ] }, - new ActivityReadonlyStructWithArrayCollection + new ActivityRecordWithCollection { Name = "Music Quiz", Day = DayOfWeek.Friday, @@ -4264,34 +3746,39 @@ protected PubWithReadonlyStructArrayCollections CreatePubWithReadonlyStructArray IsTeamBased = true, Teams = [ - new TeamReadonlyStruct("Dazed and Confused", [ - "Robert", - "Jimmy", - "John", - "Jason" - ]), - new TeamReadonlyStruct("Banksy", []) + new TeamRecord + { + Name = "Dazed and Confused", + Members = + [ + "Robert", + "Jimmy", + "John", + "Jason" + ] + }, + new TeamRecord { Name = "Banksy", Members = [] } ] } ]; - pub.FeaturedTeam = new TeamReadonlyStruct("Not In This Lifetime", ["Slash", "Axl"]); + pub.FeaturedTeam = new TeamRecord { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] }; return pub; } - protected PubWithRecordArrayCollections CreatePubWithRecordArrayCollections(DbContext context) + protected PubWithArrayCollections CreatePubWithArrayCollections(DbContext context) { var pub = Fixture.UseProxies - ? context.CreateProxy() - : new PubWithRecordArrayCollections(); + ? context.CreateProxy() + : new PubWithArrayCollections(); pub.Id = Guid.NewGuid(); pub.Name = "The FBI"; pub.Activities = [ - new ActivityRecordWithArrayCollection + new ActivityWithArrayCollection { Name = "Pub Quiz", Day = DayOfWeek.Monday, @@ -4301,29 +3788,29 @@ protected PubWithRecordArrayCollections CreatePubWithRecordArrayCollections(DbCo IsTeamBased = true, Teams = [ - new TeamRecord + new Team { Name = "Clueless", Members = - [ + { "Boris", "David", "Theresa" - ] + } }, - new TeamRecord + new Team { Name = "ZZ", Members = - [ + { "Has Beard", "Has Beard", "Is Called Beard" - ] + } } ] }, - new ActivityRecordWithArrayCollection + new ActivityWithArrayCollection { Name = "Music Quiz", Day = DayOfWeek.Friday, @@ -4333,39 +3820,39 @@ protected PubWithRecordArrayCollections CreatePubWithRecordArrayCollections(DbCo IsTeamBased = true, Teams = [ - new TeamRecord + new Team { Name = "Dazed and Confused", Members = - [ + { "Robert", "Jimmy", "John", "Jason" - ] + } }, - new TeamRecord { Name = "Banksy", Members = [] } + new Team { Name = "Banksy", Members = [] } ] } ]; - pub.FeaturedTeam = new TeamRecord { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] }; + pub.FeaturedTeam = new Team { Name = "Not In This Lifetime", Members = { "Slash", "Axl" } }; return pub; } - protected PubWithPropertyBagCollections CreatePubWithPropertyBagCollections(DbContext context) + protected PubWithStructArrayCollections CreatePubWithStructArrayCollections(DbContext context) { var pub = Fixture.UseProxies - ? context.CreateProxy() - : new PubWithPropertyBagCollections(); + ? context.CreateProxy() + : new PubWithStructArrayCollections(); pub.Id = Guid.NewGuid(); pub.Name = "The FBI"; pub.Activities = [ - new ActivityWithPropertyBagCollection + new ActivityStructWithArrayCollection { Name = "Pub Quiz", Day = DayOfWeek.Monday, @@ -4375,19 +3862,239 @@ protected PubWithPropertyBagCollections CreatePubWithPropertyBagCollections(DbCo IsTeamBased = true, Teams = [ - new Dictionary - { - ["Name"] = "Clueless", - ["Members"] = new List { "Boris", "David", "Theresa" }, - ["Founded"] = new DateTime(2015, 3, 15), - ["IsActive"] = true, - ["Rating"] = 4.2 - }, - new Dictionary + new TeamStruct { - ["Name"] = "ZZ", - ["Members"] = new List { "Has Beard", "Has Beard", "Is Called Beard" }, - ["Founded"] = new DateTime(2020, 1, 1), + Name = "Clueless", + Members = + [ + "Boris", + "David", + "Theresa" + ] + }, + new TeamStruct + { + Name = "ZZ", + Members = + [ + "Has Beard", + "Has Beard", + "Is Called Beard" + ] + } + ] + }, + new ActivityStructWithArrayCollection + { + Name = "Music Quiz", + Day = DayOfWeek.Friday, + Description = "A music pub quiz.", + Notes = [], + CoverCharge = 5.0m, + IsTeamBased = true, + Teams = + [ + new TeamStruct + { + Name = "Dazed and Confused", + Members = + [ + "Robert", + "Jimmy", + "John", + "Jason" + ] + }, + new TeamStruct { Name = "Banksy", Members = [] } + ] + } + ]; + + pub.FeaturedTeam = new TeamStruct { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] }; + + return pub; + } + + protected PubWithReadonlyStructArrayCollections CreatePubWithReadonlyStructArrayCollections(DbContext context) + { + var pub = Fixture.UseProxies + ? context.CreateProxy() + : new PubWithReadonlyStructArrayCollections(); + + pub.Id = Guid.NewGuid(); + pub.Name = "The FBI"; + + pub.Activities = + [ + new ActivityReadonlyStructWithArrayCollection + { + Name = "Pub Quiz", + Day = DayOfWeek.Monday, + Description = "A general knowledge pub quiz.", + Notes = ["One", "Two", "Three"], + CoverCharge = 2.0m, + IsTeamBased = true, + Teams = + [ + new TeamReadonlyStruct( + "Clueless", [ + "Boris", + "David", + "Theresa" + ]), + new TeamReadonlyStruct( + "ZZ", [ + "Has Beard", + "Has Beard", + "Is Called Beard" + ]) + ] + }, + new ActivityReadonlyStructWithArrayCollection + { + Name = "Music Quiz", + Day = DayOfWeek.Friday, + Description = "A music pub quiz.", + Notes = [], + CoverCharge = 5.0m, + IsTeamBased = true, + Teams = + [ + new TeamReadonlyStruct( + "Dazed and Confused", [ + "Robert", + "Jimmy", + "John", + "Jason" + ]), + new TeamReadonlyStruct("Banksy", []) + ] + } + ]; + + pub.FeaturedTeam = new TeamReadonlyStruct("Not In This Lifetime", ["Slash", "Axl"]); + + return pub; + } + + protected PubWithRecordArrayCollections CreatePubWithRecordArrayCollections(DbContext context) + { + var pub = Fixture.UseProxies + ? context.CreateProxy() + : new PubWithRecordArrayCollections(); + + pub.Id = Guid.NewGuid(); + pub.Name = "The FBI"; + + pub.Activities = + [ + new ActivityRecordWithArrayCollection + { + Name = "Pub Quiz", + Day = DayOfWeek.Monday, + Description = "A general knowledge pub quiz.", + Notes = ["One", "Two", "Three"], + CoverCharge = 2.0m, + IsTeamBased = true, + Teams = + [ + new TeamRecord + { + Name = "Clueless", + Members = + [ + "Boris", + "David", + "Theresa" + ] + }, + new TeamRecord + { + Name = "ZZ", + Members = + [ + "Has Beard", + "Has Beard", + "Is Called Beard" + ] + } + ] + }, + new ActivityRecordWithArrayCollection + { + Name = "Music Quiz", + Day = DayOfWeek.Friday, + Description = "A music pub quiz.", + Notes = [], + CoverCharge = 5.0m, + IsTeamBased = true, + Teams = + [ + new TeamRecord + { + Name = "Dazed and Confused", + Members = + [ + "Robert", + "Jimmy", + "John", + "Jason" + ] + }, + new TeamRecord { Name = "Banksy", Members = [] } + ] + } + ]; + + pub.FeaturedTeam = new TeamRecord { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] }; + + return pub; + } + + protected PubWithPropertyBagCollections CreatePubWithPropertyBagCollections(DbContext context) + { + var pub = Fixture.UseProxies + ? context.CreateProxy() + : new PubWithPropertyBagCollections(); + + pub.Id = Guid.NewGuid(); + pub.Name = "The FBI"; + + pub.Activities = + [ + new ActivityWithPropertyBagCollection + { + Name = "Pub Quiz", + Day = DayOfWeek.Monday, + Description = "A general knowledge pub quiz.", + Notes = ["One", "Two", "Three"], + CoverCharge = 2.0m, + IsTeamBased = true, + Teams = + [ + new Dictionary + { + ["Name"] = "Clueless", + ["Members"] = new List + { + "Boris", + "David", + "Theresa" + }, + ["Founded"] = new DateTime(2015, 3, 15), + ["IsActive"] = true, + ["Rating"] = 4.2 + }, + new Dictionary + { + ["Name"] = "ZZ", + ["Members"] = new List + { + "Has Beard", + "Has Beard", + "Is Called Beard" + }, + ["Founded"] = new DateTime(2020, 1, 1), ["IsActive"] = false, ["Rating"] = 3.8 } @@ -4406,7 +4113,13 @@ protected PubWithPropertyBagCollections CreatePubWithPropertyBagCollections(DbCo new Dictionary { ["Name"] = "Dazed and Confused", - ["Members"] = new List { "Robert", "Jimmy", "John", "Jason" }, + ["Members"] = new List + { + "Robert", + "Jimmy", + "John", + "Jason" + }, ["Founded"] = new DateTime(2018, 7, 20), ["IsActive"] = true, ["Rating"] = 4.9 @@ -4499,11 +4212,7 @@ protected static FieldPubWithCollections CreateFieldCollectionPub(DbContext cont ] } ], - FeaturedTeam = new Team - { - Name = "Not In This Lifetime", - Members = { "Slash", "Axl" } - } + FeaturedTeam = new Team { Name = "Not In This Lifetime", Members = { "Slash", "Axl" } } }; protected static FieldPubWithStructCollections CreateFieldCollectionPubWithStructs(DbContext context) @@ -4514,62 +4223,62 @@ protected static FieldPubWithStructCollections CreateFieldCollectionPubWithStruc Activities = [ new ActivityStructWithCollection - { - Name = "Pub Quiz", - Day = DayOfWeek.Monday, - Description = "A general knowledge pub quiz.", - Notes = ["One", "Two", "Three"], - CoverCharge = 2.0m, - IsTeamBased = true, - Teams = - [ - new TeamStruct - { - Name = "Clueless", - Members = - [ - "Boris", - "David", - "Theresa" - ] - }, - new TeamStruct - { - Name = "ZZ", - Members = - [ - "Has Beard", - "Has Beard", - "Is Called Beard" - ] - } - ] - }, - new ActivityStructWithCollection(), - new ActivityStructWithCollection - { - Name = "Music Quiz", - Day = DayOfWeek.Friday, - Description = "A music pub quiz.", - Notes = [], - CoverCharge = 5.0m, - IsTeamBased = true, - Teams = - [ - new TeamStruct - { - Name = "Dazed and Confused", - Members = - [ - "Robert", - "Jimmy", - "John", - "Jason" - ] - }, - new TeamStruct { Name = "Banksy", Members = [] } - ] - } + { + Name = "Pub Quiz", + Day = DayOfWeek.Monday, + Description = "A general knowledge pub quiz.", + Notes = ["One", "Two", "Three"], + CoverCharge = 2.0m, + IsTeamBased = true, + Teams = + [ + new TeamStruct + { + Name = "Clueless", + Members = + [ + "Boris", + "David", + "Theresa" + ] + }, + new TeamStruct + { + Name = "ZZ", + Members = + [ + "Has Beard", + "Has Beard", + "Is Called Beard" + ] + } + ] + }, + new ActivityStructWithCollection(), + new ActivityStructWithCollection + { + Name = "Music Quiz", + Day = DayOfWeek.Friday, + Description = "A music pub quiz.", + Notes = [], + CoverCharge = 5.0m, + IsTeamBased = true, + Teams = + [ + new TeamStruct + { + Name = "Dazed and Confused", + Members = + [ + "Robert", + "Jimmy", + "John", + "Jason" + ] + }, + new TeamStruct { Name = "Banksy", Members = [] } + ] + } ], FeaturedTeam = new TeamStruct { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] } }; @@ -4582,61 +4291,61 @@ protected static FieldPubWithRecordCollections CreateFieldCollectionPubWithRecor Activities = [ new FieldActivityRecordWithCollection - { - Name = "Pub Quiz", - Day = DayOfWeek.Monday, - Description = "A general knowledge pub quiz.", - Notes = ["One", "Two", "Three"], - CoverCharge = 2.0m, - IsTeamBased = true, - Teams = - [ - new FieldTeamRecord - { - Name = "Clueless", - Members = - [ - "Boris", - "David", - "Theresa" - ] - }, - new FieldTeamRecord - { - Name = "ZZ", - Members = - [ - "Has Beard", - "Has Beard", - "Is Called Beard" - ] - } - ] - }, - new FieldActivityRecordWithCollection - { - Name = "Music Quiz", - Day = DayOfWeek.Friday, - Description = "A music pub quiz.", - Notes = [], - CoverCharge = 5.0m, - IsTeamBased = true, - Teams = - [ - new FieldTeamRecord - { - Name = "Dazed and Confused", - Members = - [ - "Robert", - "Jimmy", - "John", - "Jason" - ] - }, - new FieldTeamRecord { Name = "Banksy", Members = [] } - ] - } + { + Name = "Pub Quiz", + Day = DayOfWeek.Monday, + Description = "A general knowledge pub quiz.", + Notes = ["One", "Two", "Three"], + CoverCharge = 2.0m, + IsTeamBased = true, + Teams = + [ + new FieldTeamRecord + { + Name = "Clueless", + Members = + [ + "Boris", + "David", + "Theresa" + ] + }, + new FieldTeamRecord + { + Name = "ZZ", + Members = + [ + "Has Beard", + "Has Beard", + "Is Called Beard" + ] + } + ] + }, + new FieldActivityRecordWithCollection + { + Name = "Music Quiz", + Day = DayOfWeek.Friday, + Description = "A music pub quiz.", + Notes = [], + CoverCharge = 5.0m, + IsTeamBased = true, + Teams = + [ + new FieldTeamRecord + { + Name = "Dazed and Confused", + Members = + [ + "Robert", + "Jimmy", + "John", + "Jason" + ] + }, + new FieldTeamRecord { Name = "Banksy", Members = [] } + ] + } ], FeaturedTeam = new FieldTeamRecord { Name = "Not In This Lifetime", Members = ["Slash", "Axl"] } }; @@ -4649,34 +4358,34 @@ protected static FieldPubWithReadonlyStructCollections CreateFieldCollectionPubW Activities = [ new ActivityReadonlyStructWithCollection - { - Name = "Pub Quiz", - Day = DayOfWeek.Monday, - Description = "A general knowledge pub quiz.", - Notes = ["One", "Two", "Three"], - CoverCharge = 2.0m, - IsTeamBased = true, - Teams = - [ - new TeamReadonlyStruct("Clueless", ["Boris", "David", "Theresa"]), - new TeamReadonlyStruct("ZZ", ["Has Beard", "Has Beard", "Is Called Beard"]) - ] - }, - new ActivityReadonlyStructWithCollection(), - new ActivityReadonlyStructWithCollection - { - Name = "Music Quiz", - Day = DayOfWeek.Friday, - Description = "A music pub quiz.", - Notes = [], - CoverCharge = 5.0m, - IsTeamBased = true, - Teams = - [ - new TeamReadonlyStruct("Dazed and Confused", ["Robert", "Jimmy", "John", "Jason"]), - new TeamReadonlyStruct("Banksy", []) - ] - } + { + Name = "Pub Quiz", + Day = DayOfWeek.Monday, + Description = "A general knowledge pub quiz.", + Notes = ["One", "Two", "Three"], + CoverCharge = 2.0m, + IsTeamBased = true, + Teams = + [ + new TeamReadonlyStruct("Clueless", ["Boris", "David", "Theresa"]), + new TeamReadonlyStruct("ZZ", ["Has Beard", "Has Beard", "Is Called Beard"]) + ] + }, + new ActivityReadonlyStructWithCollection(), + new ActivityReadonlyStructWithCollection + { + Name = "Music Quiz", + Day = DayOfWeek.Friday, + Description = "A music pub quiz.", + Notes = [], + CoverCharge = 5.0m, + IsTeamBased = true, + Teams = + [ + new TeamReadonlyStruct("Dazed and Confused", ["Robert", "Jimmy", "John", "Jason"]), + new TeamReadonlyStruct("Banksy", []) + ] + } ], FeaturedTeam = new TeamReadonlyStruct("Not In This Lifetime", ["Slash", "Axl"]) }; diff --git a/test/EFCore.Specification.Tests/ComplianceTestBase.cs b/test/EFCore.Specification.Tests/ComplianceTestBase.cs index 71fc841c307..8fa60418ab7 100644 --- a/test/EFCore.Specification.Tests/ComplianceTestBase.cs +++ b/test/EFCore.Specification.Tests/ComplianceTestBase.cs @@ -15,10 +15,9 @@ public abstract class ComplianceTestBase [ConditionalFact] public virtual void All_test_bases_must_be_implemented() { - var concreteTests = TargetAssembly.GetTypes().Where( - c => c.BaseType != typeof(object) - && !c.IsAbstract - && (c.IsPublic || c.IsNestedPublic)) + var concreteTests = TargetAssembly.GetTypes().Where(c => c.BaseType != typeof(object) + && !c.IsAbstract + && (c.IsPublic || c.IsNestedPublic)) .ToList(); var nonImplementedBases = (from baseType in GetBaseTestClasses() diff --git a/test/EFCore.Specification.Tests/CompositeKeyEndToEndTestBase.cs b/test/EFCore.Specification.Tests/CompositeKeyEndToEndTestBase.cs index 7c6a94b89a9..f6351cc3e9d 100644 --- a/test/EFCore.Specification.Tests/CompositeKeyEndToEndTestBase.cs +++ b/test/EFCore.Specification.Tests/CompositeKeyEndToEndTestBase.cs @@ -206,41 +206,35 @@ protected class BronieContext(DbContextOptions options) : PoolableDbContext(opti protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity( - b => + modelBuilder.Entity(b => + { + b.HasKey(e => new { - b.HasKey( - e => new - { - e.Id1, - e.Id2, - e.Discriminator - }); + e.Id1, + e.Id2, + e.Discriminator }); + }); modelBuilder.Entity(); - modelBuilder.Entity( - b => + modelBuilder.Entity(b => + { + b.HasKey(e => new { - b.HasKey( - e => new - { - e.Id1, - e.Id2, - e.Id3 - }); - b.Property(e => e.Id1).ValueGeneratedOnAdd(); - b.Property(e => e.Id3).ValueGeneratedOnAdd(); - }); - - modelBuilder.Entity( - b => - { - b.HasKey( - e => new { e.Id1, e.Id2 }); - b.Property(e => e.Id1); + e.Id1, + e.Id2, + e.Id3 }); + b.Property(e => e.Id1).ValueGeneratedOnAdd(); + b.Property(e => e.Id3).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); + b.Property(e => e.Id1); + }); } } diff --git a/test/EFCore.Specification.Tests/ConcurrencyDetectorDisabledTestBase.cs b/test/EFCore.Specification.Tests/ConcurrencyDetectorDisabledTestBase.cs index 1e32cd7479e..25d5940dd01 100644 --- a/test/EFCore.Specification.Tests/ConcurrencyDetectorDisabledTestBase.cs +++ b/test/EFCore.Specification.Tests/ConcurrencyDetectorDisabledTestBase.cs @@ -11,16 +11,14 @@ namespace Microsoft.EntityFrameworkCore; public abstract class ConcurrencyDetectorDisabledTestBase(TFixture fixture) : ConcurrencyDetectorTestBase(fixture) where TFixture : ConcurrencyDetectorTestBase.ConcurrencyDetectorFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task SaveChanges(bool async) { - await ConcurrencyDetectorTest( - async c => - { - c.Products.Add(new Product { Id = 3, Name = "Unicorn Horseshoe Protection Pack" }); - return async ? await c.SaveChangesAsync() : c.SaveChanges(); - }); + await ConcurrencyDetectorTest(async c => + { + c.Products.Add(new Product { Id = 3, Name = "Unicorn Horseshoe Protection Pack" }); + return async ? await c.SaveChangesAsync() : c.SaveChanges(); + }); using var ctx = CreateContext(); var newProduct = await ctx.Products.FindAsync(3); diff --git a/test/EFCore.Specification.Tests/ConcurrencyDetectorEnabledTestBase.cs b/test/EFCore.Specification.Tests/ConcurrencyDetectorEnabledTestBase.cs index 97f9cd561b8..28854f3a26a 100644 --- a/test/EFCore.Specification.Tests/ConcurrencyDetectorEnabledTestBase.cs +++ b/test/EFCore.Specification.Tests/ConcurrencyDetectorEnabledTestBase.cs @@ -11,16 +11,14 @@ namespace Microsoft.EntityFrameworkCore; public abstract class ConcurrencyDetectorEnabledTestBase(TFixture fixture) : ConcurrencyDetectorTestBase(fixture) where TFixture : ConcurrencyDetectorTestBase.ConcurrencyDetectorFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task SaveChanges(bool async) { - await ConcurrencyDetectorTest( - async c => - { - c.Products.Add(new Product { Id = 2, Name = "Unicorn Replacement Horn Pack" }); - return async ? await c.SaveChangesAsync() : c.SaveChanges(); - }); + await ConcurrencyDetectorTest(async c => + { + c.Products.Add(new Product { Id = 2, Name = "Unicorn Replacement Horn Pack" }); + return async ? await c.SaveChangesAsync() : c.SaveChanges(); + }); using var ctx = CreateContext(); var newProduct = await ctx.Products.SingleOrDefaultAsync(p => p.Id == 2); diff --git a/test/EFCore.Specification.Tests/ConcurrencyDetectorTestBase.cs b/test/EFCore.Specification.Tests/ConcurrencyDetectorTestBase.cs index f5f70b7fa69..d0bd8ad7d13 100644 --- a/test/EFCore.Specification.Tests/ConcurrencyDetectorTestBase.cs +++ b/test/EFCore.Specification.Tests/ConcurrencyDetectorTestBase.cs @@ -16,50 +16,39 @@ public abstract class ConcurrencyDetectorTestBase(TFixture fixture) : { protected TFixture Fixture { get; } = fixture; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Find(bool async) => ConcurrencyDetectorTest(async c => async ? await c.Products.FindAsync(1) : c.Products.Find(1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count(bool async) => ConcurrencyDetectorTest(async c => async ? await c.Products.CountAsync() : c.Products.Count()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task First(bool async) - => ConcurrencyDetectorTest( - async c => async - ? await c.Products.OrderBy(p => p.Id).FirstAsync() - : c.Products.OrderBy(p => p.Id).First()); + => ConcurrencyDetectorTest(async c => async + ? await c.Products.OrderBy(p => p.Id).FirstAsync() + : c.Products.OrderBy(p => p.Id).First()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Last(bool async) - => ConcurrencyDetectorTest( - async c => async - ? await c.Products.OrderBy(p => p.Id).LastAsync() - : c.Products.OrderBy(p => p.Id).Last()); + => ConcurrencyDetectorTest(async c => async + ? await c.Products.OrderBy(p => p.Id).LastAsync() + : c.Products.OrderBy(p => p.Id).Last()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Single(bool async) - => ConcurrencyDetectorTest( - async c => async - ? await c.Products.SingleAsync(p => p.Id == 1) - : c.Products.Single(p => p.Id == 1)); + => ConcurrencyDetectorTest(async c => async + ? await c.Products.SingleAsync(p => p.Id == 1) + : c.Products.Single(p => p.Id == 1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any(bool async) - => ConcurrencyDetectorTest( - async c => async - ? await c.Products.AnyAsync(p => p.Id < 10) - : c.Products.Any(p => p.Id < 10)); + => ConcurrencyDetectorTest(async c => async + ? await c.Products.AnyAsync(p => p.Id < 10) + : c.Products.Any(p => p.Id < 10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToList(bool async) => ConcurrencyDetectorTest(async c => async ? await c.Products.ToListAsync() : c.Products.ToList()); diff --git a/test/EFCore.Specification.Tests/ConferencePlannerTestBase.cs b/test/EFCore.Specification.Tests/ConferencePlannerTestBase.cs index 7176e11a2f7..971788d058e 100644 --- a/test/EFCore.Specification.Tests/ConferencePlannerTestBase.cs +++ b/test/EFCore.Specification.Tests/ConferencePlannerTestBase.cs @@ -24,209 +24,199 @@ protected ConferencePlannerTestBase(TFixture fixture) [ConditionalFact] public virtual async Task AttendeesController_Get() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new AttendeesController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new AttendeesController(context); - var attendee = await controller.Get("RainbowDash"); + var attendee = await controller.Get("RainbowDash"); - Assert.Equal("Rainbow", attendee.FirstName); - Assert.Equal("Dash", attendee.LastName); - Assert.Equal("RainbowDash", attendee.UserName); - Assert.Equal("sonicrainboom@sample.com", attendee.EmailAddress); + Assert.Equal("Rainbow", attendee.FirstName); + Assert.Equal("Dash", attendee.LastName); + Assert.Equal("RainbowDash", attendee.UserName); + Assert.Equal("sonicrainboom@sample.com", attendee.EmailAddress); - var sessions = attendee.Sessions; + var sessions = attendee.Sessions; - Assert.Equal(21, sessions.Count); - Assert.All(sessions, s => Assert.NotEmpty(s.Title)); - }); + Assert.Equal(21, sessions.Count); + Assert.All(sessions, s => Assert.NotEmpty(s.Title)); + }); [ConditionalFact] public virtual async Task AttendeesController_GetSessions() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new AttendeesController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new AttendeesController(context); - var sessions = await controller.GetSessions("Princess"); + var sessions = await controller.GetSessions("Princess"); - Assert.Equal(21, sessions.Count); - Assert.All(sessions, s => Assert.NotEmpty(s.Abstract)); - Assert.All(sessions, s => Assert.NotEmpty(s.Speakers)); - Assert.All(sessions, s => Assert.NotNull(s.Track)); - }); + Assert.Equal(21, sessions.Count); + Assert.All(sessions, s => Assert.NotEmpty(s.Abstract)); + Assert.All(sessions, s => Assert.NotEmpty(s.Speakers)); + Assert.All(sessions, s => Assert.NotNull(s.Track)); + }); [ConditionalFact] public virtual async Task AttendeesController_Post_with_new_attendee() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new AttendeesController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new AttendeesController(context); - var result = await controller.Post( - new Attendee - { - EmailAddress = "discord@sample.com", - FirstName = "", - LastName = "Discord", - UserName = "Discord!" - }); - - Assert.NotEqual(default, result.Id); - Assert.Equal("discord@sample.com", result.EmailAddress); - Assert.Equal("", result.FirstName); - Assert.Equal("Discord", result.LastName); - Assert.Equal("Discord!", result.UserName); - Assert.Null(result.Sessions); - }); + var result = await controller.Post( + new Attendee + { + EmailAddress = "discord@sample.com", + FirstName = "", + LastName = "Discord", + UserName = "Discord!" + }); + + Assert.NotEqual(default, result.Id); + Assert.Equal("discord@sample.com", result.EmailAddress); + Assert.Equal("", result.FirstName); + Assert.Equal("Discord", result.LastName); + Assert.Equal("Discord!", result.UserName); + Assert.Null(result.Sessions); + }); [ConditionalFact] public virtual async Task AttendeesController_Post_with_existing_attendee() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new AttendeesController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new AttendeesController(context); - var result = await controller.Post( - new Attendee - { - EmailAddress = "pinkie@sample.com", - FirstName = "Pinkie", - LastName = "Pie", - UserName = "Pinks" - }); + var result = await controller.Post( + new Attendee + { + EmailAddress = "pinkie@sample.com", + FirstName = "Pinkie", + LastName = "Pie", + UserName = "Pinks" + }); - Assert.Null(result); - }); + Assert.Null(result); + }); [ConditionalFact] public virtual async Task AttendeesController_AddSession() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new AttendeesController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new AttendeesController(context); - var pinky = context.Attendees.Single(a => a.UserName == "Pinks"); + var pinky = context.Attendees.Single(a => a.UserName == "Pinks"); - var pinkySessions = context.Sessions - .AsNoTracking() - .Where(s => s.SessionAttendees.Any(e => e.Attendee.UserName == "Pinks")) - .ToList(); + var pinkySessions = context.Sessions + .AsNoTracking() + .Where(s => s.SessionAttendees.Any(e => e.Attendee.UserName == "Pinks")) + .ToList(); - var session = context.Sessions.AsNoTracking().Single(e => e.Title == "Hidden gems in .NET Core 3"); + var session = context.Sessions.AsNoTracking().Single(e => e.Title == "Hidden gems in .NET Core 3"); - Assert.Equal(21, pinkySessions.Count); + Assert.Equal(21, pinkySessions.Count); - var result = (AttendeeResponse)await controller.AddSession("Pinks", session.Id); + var result = (AttendeeResponse)await controller.AddSession("Pinks", session.Id); - Assert.Equal(22, result.Sessions.Count); - Assert.Contains(session.Id, result.Sessions.Select(s => s.Id)); + Assert.Equal(22, result.Sessions.Count); + Assert.Contains(session.Id, result.Sessions.Select(s => s.Id)); - Assert.Equal(pinky.Id, result.Id); - Assert.Equal(pinky.UserName, result.UserName); - Assert.Equal(pinky.FirstName, result.FirstName); - Assert.Equal(pinky.LastName, result.LastName); - Assert.Equal(pinky.EmailAddress, result.EmailAddress); + Assert.Equal(pinky.Id, result.Id); + Assert.Equal(pinky.UserName, result.UserName); + Assert.Equal(pinky.FirstName, result.FirstName); + Assert.Equal(pinky.LastName, result.LastName); + Assert.Equal(pinky.EmailAddress, result.EmailAddress); - var existingSessionIds = pinkySessions.Select(s => s.Id).ToList(); - var newSessionIds = result.Sessions.Select(r => r.Id).ToHashSet(); - Assert.All(existingSessionIds, i => newSessionIds.Contains(i)); + var existingSessionIds = pinkySessions.Select(s => s.Id).ToList(); + var newSessionIds = result.Sessions.Select(r => r.Id).ToHashSet(); + Assert.All(existingSessionIds, i => newSessionIds.Contains(i)); - Assert.Equal( - result.Sessions.Select(r => r.Id).OrderBy(i => i).ToList(), - context.Sessions - .AsNoTracking() - .Where(s => s.SessionAttendees.Any(e => e.Attendee.UserName == "Pinks")) - .Select(s => s.Id) - .OrderBy(i => i) - .ToList()); - }); + Assert.Equal( + result.Sessions.Select(r => r.Id).OrderBy(i => i).ToList(), + context.Sessions + .AsNoTracking() + .Where(s => s.SessionAttendees.Any(e => e.Attendee.UserName == "Pinks")) + .Select(s => s.Id) + .OrderBy(i => i) + .ToList()); + }); [ConditionalFact] public virtual async Task AttendeesController_AddSession_bad_session() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new AttendeesController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new AttendeesController(context); - var result = (string)await controller.AddSession("Pinks", -777); + var result = (string)await controller.AddSession("Pinks", -777); - Assert.Equal("No session", result); - }); + Assert.Equal("No session", result); + }); [ConditionalFact] public virtual async Task AttendeesController_AddSession_bad_attendee() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new AttendeesController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new AttendeesController(context); - var session = context.Sessions.AsNoTracking().Single(e => e.Title == "Hidden gems in .NET Core 3"); + var session = context.Sessions.AsNoTracking().Single(e => e.Title == "Hidden gems in .NET Core 3"); - var result = (string)await controller.AddSession("The Stig", session.Id); + var result = (string)await controller.AddSession("The Stig", session.Id); - Assert.Equal("No attendee", result); - }); + Assert.Equal("No attendee", result); + }); [ConditionalFact] public virtual async Task AttendeesController_RemoveSession() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new AttendeesController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new AttendeesController(context); - var beforeRemove = context.Sessions - .AsNoTracking() - .Where(s => s.SessionAttendees.Any(e => e.Attendee.UserName == "Pinks")) - .OrderBy(e => e.Id) - .Select(e => e.Id) - .ToList(); + var beforeRemove = context.Sessions + .AsNoTracking() + .Where(s => s.SessionAttendees.Any(e => e.Attendee.UserName == "Pinks")) + .OrderBy(e => e.Id) + .Select(e => e.Id) + .ToList(); - Assert.Equal(21, beforeRemove.Count); + Assert.Equal(21, beforeRemove.Count); - var sessionId = beforeRemove.First(); - var result = await controller.RemoveSession("Pinks", sessionId); + var sessionId = beforeRemove.First(); + var result = await controller.RemoveSession("Pinks", sessionId); - Assert.Equal("Success", result); + Assert.Equal("Success", result); - var afterRemove = context.Sessions - .AsNoTracking() - .Where(s => s.SessionAttendees.Any(e => e.Attendee.UserName == "Pinks")) - .OrderBy(e => e.Id) - .Select(e => e.Id) - .ToList(); + var afterRemove = context.Sessions + .AsNoTracking() + .Where(s => s.SessionAttendees.Any(e => e.Attendee.UserName == "Pinks")) + .OrderBy(e => e.Id) + .Select(e => e.Id) + .ToList(); - Assert.Equal(20, afterRemove.Count); - Assert.DoesNotContain(sessionId, afterRemove); - Assert.All(afterRemove, s => Assert.Contains(s, beforeRemove)); - }); + Assert.Equal(20, afterRemove.Count); + Assert.DoesNotContain(sessionId, afterRemove); + Assert.All(afterRemove, s => Assert.Contains(s, beforeRemove)); + }); [ConditionalFact] public virtual async Task AttendeesController_RemoveSession_bad_session() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new AttendeesController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new AttendeesController(context); - var result = await controller.RemoveSession("Pinks", -777); + var result = await controller.RemoveSession("Pinks", -777); - Assert.Equal("No session", result); - }); + Assert.Equal("No session", result); + }); [ConditionalFact] public virtual async Task AttendeesController_RemoveSession_bad_attendee() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new AttendeesController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new AttendeesController(context); - var session = context.Sessions.AsNoTracking().Single(e => e.Title == "Hidden gems in .NET Core 3"); + var session = context.Sessions.AsNoTracking().Single(e => e.Title == "Hidden gems in .NET Core 3"); - var result = await controller.RemoveSession("The Stig", session.Id); + var result = await controller.RemoveSession("The Stig", session.Id); - Assert.Equal("No attendee", result); - }); + Assert.Equal("No attendee", result); + }); protected class AttendeesController(ApplicationDbContext db) { @@ -330,37 +320,33 @@ public async Task RemoveSession(string username, int sessionId) } } - [ConditionalTheory] - [InlineData("ran", 5, 1)] - [InlineData("Scott", 1, 0)] - [InlineData("C#", 3, 3)] + [ConditionalTheory, InlineData("ran", 5, 1), InlineData("Scott", 1, 0), InlineData("C#", 3, 3)] public virtual async Task SearchController_Search( string searchTerm, int totalCount, int sessionCount) - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new SearchController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new SearchController(context); - var results = await controller.Search( - new SearchTerm { Query = searchTerm }); + var results = await controller.Search( + new SearchTerm { Query = searchTerm }); - Assert.Equal(totalCount, results.Count); + Assert.Equal(totalCount, results.Count); - var sessions = results.Where(r => r.Type == SearchResultType.Session).Select(r => r.Session).ToList(); - var speakers = results.Where(r => r.Type == SearchResultType.Speaker).Select(r => r.Speaker).ToList(); + var sessions = results.Where(r => r.Type == SearchResultType.Session).Select(r => r.Session).ToList(); + var speakers = results.Where(r => r.Type == SearchResultType.Speaker).Select(r => r.Speaker).ToList(); - Assert.Equal(sessionCount, sessions.Count); - Assert.Equal(totalCount - sessionCount, speakers.Count); + Assert.Equal(sessionCount, sessions.Count); + Assert.Equal(totalCount - sessionCount, speakers.Count); - Assert.All(sessions, s => Assert.NotEqual(default, s.Id)); - Assert.All(sessions, s => Assert.NotEmpty(s.Speakers)); - Assert.All(sessions, s => Assert.NotNull(s.Track)); + Assert.All(sessions, s => Assert.NotEqual(default, s.Id)); + Assert.All(sessions, s => Assert.NotEmpty(s.Speakers)); + Assert.All(sessions, s => Assert.NotNull(s.Track)); - Assert.All(speakers, s => Assert.NotEqual(default, s.Id)); - Assert.All(speakers, s => Assert.NotEmpty(s.Sessions)); - }); + Assert.All(speakers, s => Assert.NotEqual(default, s.Id)); + Assert.All(speakers, s => Assert.NotEmpty(s.Sessions)); + }); protected class SearchController(ApplicationDbContext db) { @@ -373,26 +359,24 @@ public async Task> Search(SearchTerm term) .Include(s => s.Track) .Include(s => s.SessionSpeakers) .ThenInclude(ss => ss.Speaker) - .Where( - s => - s.Title.Contains(query) || s.Track.Name.Contains(query) + .Where(s => + s.Title.Contains(query) || s.Track.Name.Contains(query) ) .ToListAsync(); var speakerResults = await _db.Speakers .Include(s => s.SessionSpeakers) .ThenInclude(ss => ss.Session) - .Where( - s => - s.Name.Contains(query) || s.Bio.Contains(query) || s.WebSite.Contains(query) + .Where(s => + s.Name.Contains(query) || s.Bio.Contains(query) || s.WebSite.Contains(query) ) .ToListAsync(); - var results = sessionResults.Select( - session => new SearchResult { Type = SearchResultType.Session, Session = session.MapSessionResponse() }) + var results = sessionResults.Select(session + => new SearchResult { Type = SearchResultType.Session, Session = session.MapSessionResponse() }) .Concat( - speakerResults.Select( - speaker => new SearchResult { Type = SearchResultType.Speaker, Speaker = speaker.MapSpeakerResponse() })); + speakerResults.Select(speaker + => new SearchResult { Type = SearchResultType.Speaker, Speaker = speaker.MapSpeakerResponse() })); return results.ToList(); } @@ -400,145 +384,137 @@ public async Task> Search(SearchTerm term) [ConditionalFact] public virtual async Task SessionsController_Get() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new SessionsController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new SessionsController(context); - var results = await controller.Get(); + var results = await controller.Get(); - Assert.Equal(57, results.Count); + Assert.Equal(57, results.Count); - Assert.All(results, s => Assert.NotEqual(default, s.Id)); - Assert.All(results, s => Assert.NotEmpty(s.Speakers)); - Assert.All(results, s => Assert.NotNull(s.Track)); - }); + Assert.All(results, s => Assert.NotEqual(default, s.Id)); + Assert.All(results, s => Assert.NotEmpty(s.Speakers)); + Assert.All(results, s => Assert.NotNull(s.Track)); + }); [ConditionalFact] public virtual async Task SessionsController_Get_with_ID() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var session = context.Sessions.AsNoTracking().Single(e => e.Title.StartsWith("C# and Rust: combining ")); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var session = context.Sessions.AsNoTracking().Single(e => e.Title.StartsWith("C# and Rust: combining ")); - var controller = new SessionsController(context); + var controller = new SessionsController(context); - var result = await controller.Get(session.Id); + var result = await controller.Get(session.Id); - Assert.Equal(session.Id, result.Id); - Assert.NotEmpty(result.Speakers); - Assert.NotNull(result.Track); - }); + Assert.Equal(session.Id, result.Id); + Assert.NotEmpty(result.Speakers); + Assert.NotNull(result.Track); + }); [ConditionalFact] public virtual async Task SessionsController_Get_with_bad_ID() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new SessionsController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new SessionsController(context); - var result = await controller.Get(-777); + var result = await controller.Get(-777); - Assert.Null(result); - }); + Assert.Null(result); + }); [ConditionalFact] public virtual async Task SessionsController_Post() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var track = context.Tracks.AsNoTracking().OrderBy(e => e.Id).First(); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var track = context.Tracks.AsNoTracking().OrderBy(e => e.Id).First(); - var controller = new SessionsController(context); + var controller = new SessionsController(context); - var result = await controller.Post( - new Session - { - Abstract = "Pandas eat bamboo all dat.", - Title = "Pandas!", - StartTime = DateTimeOffset.Now, - EndTime = DateTimeOffset.Now.AddHours(1), - TrackId = track.Id - }); + var result = await controller.Post( + new Session + { + Abstract = "Pandas eat bamboo all dat.", + Title = "Pandas!", + StartTime = DateTimeOffset.Now, + EndTime = DateTimeOffset.Now.AddHours(1), + TrackId = track.Id + }); - var newSession = context.Sessions.AsNoTracking().Single(e => e.Title == "Pandas!"); + var newSession = context.Sessions.AsNoTracking().Single(e => e.Title == "Pandas!"); - Assert.Equal(newSession.Id, result.Id); - Assert.Null(result.Speakers); - Assert.NotNull(result.Track); - Assert.Equal(track.Id, result.Track.Id); - }); + Assert.Equal(newSession.Id, result.Id); + Assert.Null(result.Speakers); + Assert.NotNull(result.Track); + Assert.Equal(track.Id, result.Track.Id); + }); [ConditionalFact] public virtual async Task SessionsController_Put() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var session = context.Sessions.AsNoTracking().Single(e => e.Title.StartsWith("C# and Rust: combining ")); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var session = context.Sessions.AsNoTracking().Single(e => e.Title.StartsWith("C# and Rust: combining ")); - var controller = new SessionsController(context); + var controller = new SessionsController(context); - var result = await controller.Put( - session.Id, - new Session - { - Id = session.Id, - Abstract = session.Abstract, - Title = session.Title.Replace("C#", "F#"), - StartTime = session.StartTime, - EndTime = session.EndTime, - TrackId = session.TrackId - }); + var result = await controller.Put( + session.Id, + new Session + { + Id = session.Id, + Abstract = session.Abstract, + Title = session.Title.Replace("C#", "F#"), + StartTime = session.StartTime, + EndTime = session.EndTime, + TrackId = session.TrackId + }); - Assert.Equal("Success", result); + Assert.Equal("Success", result); - var updatedSession = context.Sessions.AsNoTracking().Single(e => e.Id == session.Id); + var updatedSession = context.Sessions.AsNoTracking().Single(e => e.Id == session.Id); - Assert.Equal(session.Id, updatedSession.Id); - Assert.StartsWith("F# and Rust: combining ", updatedSession.Title); - }); + Assert.Equal(session.Id, updatedSession.Id); + Assert.StartsWith("F# and Rust: combining ", updatedSession.Title); + }); [ConditionalFact] public virtual async Task SessionsController_Put_with_bad_ID() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new SessionsController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new SessionsController(context); - var result = await controller.Put(-777, new Session()); + var result = await controller.Put(-777, new Session()); - Assert.Equal("Not found", result); - }); + Assert.Equal("Not found", result); + }); [ConditionalFact] public virtual async Task SessionsController_Delete() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var session = context.Sessions.AsNoTracking().Single(e => e.Title.StartsWith("C# and Rust: combining ")); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var session = context.Sessions.AsNoTracking().Single(e => e.Title.StartsWith("C# and Rust: combining ")); - var controller = new SessionsController(context); + var controller = new SessionsController(context); - var result = await controller.Delete(session.Id); + var result = await controller.Delete(session.Id); - Assert.Equal(session.Id, result.Id); - Assert.Null(result.Speakers); - Assert.NotNull(result.Track); + Assert.Equal(session.Id, result.Id); + Assert.Null(result.Speakers); + Assert.NotNull(result.Track); - Assert.Null(context.Sessions.AsNoTracking().SingleOrDefault(e => e.Id == session.Id)); - }); + Assert.Null(context.Sessions.AsNoTracking().SingleOrDefault(e => e.Id == session.Id)); + }); [ConditionalFact] public virtual async Task SessionsController_Delete_with_bad_ID() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new SessionsController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new SessionsController(context); - var result = await controller.Delete(-777); + var result = await controller.Delete(-777); - Assert.Null(result); - }); + Assert.Null(result); + }); protected class SessionsController(ApplicationDbContext db) { @@ -619,45 +595,42 @@ public async Task Delete(int id) [ConditionalFact] public virtual async Task SpeakersController_GetSpeakers() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new SpeakersController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new SpeakersController(context); - var results = await controller.GetSpeakers(); + var results = await controller.GetSpeakers(); - Assert.Equal(70, results.Count); + Assert.Equal(70, results.Count); - Assert.All(results, s => Assert.NotEqual(default, s.Id)); - Assert.All(results, s => Assert.NotEmpty(s.Sessions)); - }); + Assert.All(results, s => Assert.NotEqual(default, s.Id)); + Assert.All(results, s => Assert.NotEmpty(s.Sessions)); + }); [ConditionalFact] public virtual async Task SpeakersController_GetSpeaker_with_ID() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var speaker = context.Speakers.AsNoTracking().Single(e => e.Name == "Julie Lerman"); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var speaker = context.Speakers.AsNoTracking().Single(e => e.Name == "Julie Lerman"); - var controller = new SpeakersController(context); + var controller = new SpeakersController(context); - var result = await controller.GetSpeaker(speaker.Id); + var result = await controller.GetSpeaker(speaker.Id); - Assert.Equal(speaker.Id, result.Id); - Assert.NotEmpty(result.Sessions); - }); + Assert.Equal(speaker.Id, result.Id); + Assert.NotEmpty(result.Sessions); + }); [ConditionalFact] public virtual async Task SpeakersController_GetSpeaker_with_bad_ID() - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var controller = new SpeakersController(context); + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var controller = new SpeakersController(context); - var result = await controller.GetSpeaker(-777); + var result = await controller.GetSpeaker(-777); - Assert.Null(result); - }); + Assert.Null(result); + }); protected class SpeakersController(ApplicationDbContext db) { @@ -812,8 +785,8 @@ protected override Task SeedAsync(ApplicationDbContext context) EndTime = sessionJson.GetProperty("endsAt").GetDateTime() }; - session.SessionSpeakers = sessionSpeakers.Select( - s => new SessionSpeaker { Session = session, Speaker = s }).ToList(); + session.SessionSpeakers = + sessionSpeakers.Select(s => new SessionSpeaker { Session = session, Speaker = s }).ToList(); var trackName = track.Name; var attendees = trackName.Contains("1") ? attendees1 @@ -821,8 +794,7 @@ protected override Task SeedAsync(ApplicationDbContext context) : trackName.Contains("3") ? attendees3 : attendees1.Concat(attendees2).Concat(attendees3).ToList(); - session.SessionAttendees = attendees.Select( - a => new SessionAttendee { Session = session, Attendee = a }).ToList(); + session.SessionAttendees = attendees.Select(a => new SessionAttendee { Session = session, Attendee = a }).ToList(); track.Sessions.Add(session); } diff --git a/test/EFCore.Specification.Tests/ConvertToProviderTypesTestBase.cs b/test/EFCore.Specification.Tests/ConvertToProviderTypesTestBase.cs index 59a5ec1cbc8..107d6ee8ead 100644 --- a/test/EFCore.Specification.Tests/ConvertToProviderTypesTestBase.cs +++ b/test/EFCore.Specification.Tests/ConvertToProviderTypesTestBase.cs @@ -38,147 +38,139 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con { base.OnModelCreating(modelBuilder, context); - modelBuilder.Entity( - b => - { - b.Property(e => e.PartitionId).HasConversion(); - b.Property(e => e.TestInt16).HasConversion(); - b.Property(e => e.TestInt32).HasConversion(); - b.Property(e => e.TestInt64).HasConversion(); - b.Property(e => e.TestDouble).HasConversion(); - b.Property(e => e.TestDecimal).HasConversion(); - b.Property(e => e.TestDateTime).HasConversion(); - b.Property(e => e.TestDateTimeOffset).HasConversion(); - b.Property(e => e.TestTimeSpan).HasConversion(); - b.Property(e => e.TestSingle).HasConversion(); - b.Property(e => e.TestBoolean).HasConversion(); - b.Property(e => e.TestByte).HasConversion(); - b.Property(e => e.TestUnsignedInt16).HasConversion(); - b.Property(e => e.TestUnsignedInt32).HasConversion(); - b.Property(e => e.TestUnsignedInt64).HasConversion(); - b.Property(e => e.TestCharacter).HasConversion(); - b.Property(e => e.TestSignedByte).HasConversion(); - b.Property(e => e.Enum64).HasConversion(); - b.Property(e => e.Enum32).HasConversion(); - b.Property(e => e.Enum16).HasConversion(); - b.Property(e => e.Enum8).HasConversion().HasMaxLength(17); - b.Property(e => e.EnumU64).HasConversion(); - b.Property(e => e.EnumU32).HasConversion(); - b.Property(e => e.EnumU16).HasConversion(); - b.Property(e => e.EnumS8).HasConversion().IsUnicode(false); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.PartitionId).HasConversion(); - b.Property(e => e.TestNullableInt16).HasConversion(); - b.Property(e => e.TestNullableInt32).HasConversion(); - b.Property(e => e.TestNullableInt64).HasConversion(); - b.Property(e => e.TestNullableDouble).HasConversion(); - b.Property(e => e.TestNullableDecimal).HasConversion(); - b.Property(e => e.TestNullableDateTime).HasConversion(); - b.Property(e => e.TestNullableDateTimeOffset).HasConversion(); - b.Property(e => e.TestNullableTimeSpan).HasConversion(); - b.Property(e => e.TestNullableSingle).HasConversion(); - b.Property(e => e.TestNullableBoolean).HasConversion(); - b.Property(e => e.TestNullableByte).HasConversion(); - b.Property(e => e.TestNullableUnsignedInt16).HasConversion(); - b.Property(e => e.TestNullableUnsignedInt32).HasConversion(); - b.Property(e => e.TestNullableUnsignedInt64).HasConversion(); - b.Property(e => e.TestNullableCharacter).HasConversion(); - b.Property(e => e.TestNullableSignedByte).HasConversion(); - b.Property(e => e.Enum64).HasConversion(); - b.Property(e => e.Enum32).HasConversion(); - b.Property(e => e.Enum16).HasConversion(); - b.Property(e => e.Enum8).HasConversion(); - b.Property(e => e.EnumU64).HasConversion(); - b.Property(e => e.EnumU32).HasConversion(); - b.Property(e => e.EnumU16).HasConversion(); - b.Property(e => e.EnumS8).HasConversion(); - }); - - modelBuilder.Entity( - b => - { - b.Property(nameof(BuiltInDataTypes.PartitionId)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestInt16)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestInt32)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestInt64)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestDouble)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestDecimal)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestDateTime)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestDateTimeOffset)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestTimeSpan)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestSingle)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestBoolean)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestByte)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestUnsignedInt16)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestUnsignedInt32)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestUnsignedInt64)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestCharacter)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.TestSignedByte)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.Enum64)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.Enum32)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.Enum16)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.Enum8)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.EnumU64)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.EnumU32)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.EnumU16)).HasConversion(); - b.Property(nameof(BuiltInDataTypes.EnumS8)).HasConversion(); - }); - - modelBuilder.Entity( - b => - { - b.Property(nameof(BuiltInNullableDataTypes.PartitionId)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt16)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt32)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt64)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableDouble)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableDecimal)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableDateTime)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableDateTimeOffset)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableTimeSpan)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableSingle)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableBoolean)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableByte)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt16)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt32)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt64)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableCharacter)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableSignedByte)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.Enum64)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.Enum32)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.Enum16)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.Enum8)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.EnumU64)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.EnumU32)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.EnumU16)).HasConversion(); - b.Property(nameof(BuiltInNullableDataTypes.EnumS8)).HasConversion(); - }); - - modelBuilder.Entity( - b => b.Property(e => e.Id).HasConversion()); - - modelBuilder.Entity( - b => b.Property(e => e.Id).HasConversion()); - - modelBuilder.Entity( - b => - { - b.Property(e => e.String3).HasConversion(); - b.Property(e => e.String9000).HasConversion(); - b.Property(e => e.StringUnbounded).HasConversion(); - b.Property(e => e.ByteArray5).HasConversion().HasMaxLength(8); - b.Property(e => e.ByteArray9000).HasConversion().HasMaxLength(LongStringLength * 2); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Method).HasConversion().HasMaxLength(6); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.PartitionId).HasConversion(); + b.Property(e => e.TestInt16).HasConversion(); + b.Property(e => e.TestInt32).HasConversion(); + b.Property(e => e.TestInt64).HasConversion(); + b.Property(e => e.TestDouble).HasConversion(); + b.Property(e => e.TestDecimal).HasConversion(); + b.Property(e => e.TestDateTime).HasConversion(); + b.Property(e => e.TestDateTimeOffset).HasConversion(); + b.Property(e => e.TestTimeSpan).HasConversion(); + b.Property(e => e.TestSingle).HasConversion(); + b.Property(e => e.TestBoolean).HasConversion(); + b.Property(e => e.TestByte).HasConversion(); + b.Property(e => e.TestUnsignedInt16).HasConversion(); + b.Property(e => e.TestUnsignedInt32).HasConversion(); + b.Property(e => e.TestUnsignedInt64).HasConversion(); + b.Property(e => e.TestCharacter).HasConversion(); + b.Property(e => e.TestSignedByte).HasConversion(); + b.Property(e => e.Enum64).HasConversion(); + b.Property(e => e.Enum32).HasConversion(); + b.Property(e => e.Enum16).HasConversion(); + b.Property(e => e.Enum8).HasConversion().HasMaxLength(17); + b.Property(e => e.EnumU64).HasConversion(); + b.Property(e => e.EnumU32).HasConversion(); + b.Property(e => e.EnumU16).HasConversion(); + b.Property(e => e.EnumS8).HasConversion().IsUnicode(false); + }); + + modelBuilder.Entity(b => + { + b.Property(e => e.PartitionId).HasConversion(); + b.Property(e => e.TestNullableInt16).HasConversion(); + b.Property(e => e.TestNullableInt32).HasConversion(); + b.Property(e => e.TestNullableInt64).HasConversion(); + b.Property(e => e.TestNullableDouble).HasConversion(); + b.Property(e => e.TestNullableDecimal).HasConversion(); + b.Property(e => e.TestNullableDateTime).HasConversion(); + b.Property(e => e.TestNullableDateTimeOffset).HasConversion(); + b.Property(e => e.TestNullableTimeSpan).HasConversion(); + b.Property(e => e.TestNullableSingle).HasConversion(); + b.Property(e => e.TestNullableBoolean).HasConversion(); + b.Property(e => e.TestNullableByte).HasConversion(); + b.Property(e => e.TestNullableUnsignedInt16).HasConversion(); + b.Property(e => e.TestNullableUnsignedInt32).HasConversion(); + b.Property(e => e.TestNullableUnsignedInt64).HasConversion(); + b.Property(e => e.TestNullableCharacter).HasConversion(); + b.Property(e => e.TestNullableSignedByte).HasConversion(); + b.Property(e => e.Enum64).HasConversion(); + b.Property(e => e.Enum32).HasConversion(); + b.Property(e => e.Enum16).HasConversion(); + b.Property(e => e.Enum8).HasConversion(); + b.Property(e => e.EnumU64).HasConversion(); + b.Property(e => e.EnumU32).HasConversion(); + b.Property(e => e.EnumU16).HasConversion(); + b.Property(e => e.EnumS8).HasConversion(); + }); + + modelBuilder.Entity(b => + { + b.Property(nameof(BuiltInDataTypes.PartitionId)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestInt16)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestInt32)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestInt64)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestDouble)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestDecimal)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestDateTime)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestDateTimeOffset)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestTimeSpan)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestSingle)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestBoolean)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestByte)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestUnsignedInt16)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestUnsignedInt32)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestUnsignedInt64)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestCharacter)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.TestSignedByte)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.Enum64)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.Enum32)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.Enum16)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.Enum8)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.EnumU64)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.EnumU32)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.EnumU16)).HasConversion(); + b.Property(nameof(BuiltInDataTypes.EnumS8)).HasConversion(); + }); + + modelBuilder.Entity(b => + { + b.Property(nameof(BuiltInNullableDataTypes.PartitionId)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt16)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt32)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt64)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableDouble)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableDecimal)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableDateTime)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableDateTimeOffset)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableTimeSpan)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableSingle)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableBoolean)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableByte)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt16)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt32)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt64)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableCharacter)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableSignedByte)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.Enum64)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.Enum32)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.Enum16)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.Enum8)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.EnumU64)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.EnumU32)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.EnumU16)).HasConversion(); + b.Property(nameof(BuiltInNullableDataTypes.EnumS8)).HasConversion(); + }); + + modelBuilder.Entity(b => b.Property(e => e.Id).HasConversion()); + + modelBuilder.Entity(b => b.Property(e => e.Id).HasConversion()); + + modelBuilder.Entity(b => + { + b.Property(e => e.String3).HasConversion(); + b.Property(e => e.String9000).HasConversion(); + b.Property(e => e.StringUnbounded).HasConversion(); + b.Property(e => e.ByteArray5).HasConversion().HasMaxLength(8); + b.Property(e => e.ByteArray9000).HasConversion().HasMaxLength(LongStringLength * 2); + }); + + modelBuilder.Entity(b => + { + b.Property(e => e.Method).HasConversion().HasMaxLength(6); + }); } } } diff --git a/test/EFCore.Specification.Tests/CustomConvertersTestBase.cs b/test/EFCore.Specification.Tests/CustomConvertersTestBase.cs index ae5cbc73f87..5253a3462e0 100644 --- a/test/EFCore.Specification.Tests/CustomConvertersTestBase.cs +++ b/test/EFCore.Specification.Tests/CustomConvertersTestBase.cs @@ -294,7 +294,7 @@ public virtual async Task Can_insert_and_read_back_with_string_list() { var entity = await context.Set().SingleAsync(); - Assert.Equal(new[] { "Gum", "Taffy" }, entity.Strings); + Assert.Equal(["Gum", "Taffy"], entity.Strings); } } @@ -352,9 +352,7 @@ public static explicit operator string(OrderId orderId) => orderId.StringValue; } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Can_query_custom_type_not_mapped_by_default_equality(bool async) { using (var context = CreateContext()) @@ -366,10 +364,9 @@ public virtual async Task Can_query_custom_type_not_mapped_by_default_equality(b using (var context = CreateContext()) { var query = context.Set() - .Where( - c => c.StyleKey == "Swag" - && c.IsTest == false - && c.Discriminator == new Dictionary()); + .Where(c => c.StyleKey == "Swag" + && c.IsTest == false + && c.Discriminator == new Dictionary()); var result = async ? await query.SingleAsync() : query.Single(); Assert.NotNull(result); @@ -392,13 +389,12 @@ public virtual async Task Field_on_derived_type_retrieved_via_cast_applies_value using var context = CreateContext(); var query = await context.Set() .Where(b => b.BlogId == 2) - .Select( - x => new - { - x.BlogId, - x.Url, - RssUrl = x is RssBlog ? ((RssBlog)x).RssUrl : null - }).ToListAsync(); + .Select(x => new + { + x.BlogId, + x.Url, + RssUrl = x is RssBlog ? ((RssBlog)x).RssUrl : null + }).ToListAsync(); var result = Assert.Single(query); Assert.Equal("http://rssblog.com/rss", result.RssUrl); @@ -549,8 +545,8 @@ public virtual async Task Where_bool_gets_converted_to_equality_when_value_conve public virtual void Value_conversion_with_property_named_value() { using var context = CreateContext(); - Assert.Throws( - () => context.Set().SingleOrDefault(e => e.Wrapper.Value == "foo")); + Assert.Throws(() + => context.Set().SingleOrDefault(e => e.Wrapper.Value == "foo")); } [ConditionalFact] @@ -640,8 +636,7 @@ public virtual void Collection_property_as_scalar_Any() using var context = CreateContext(); Assert.Contains( @"See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.", - Assert.Throws( - () => context.Set().Where(e => e.Tags.Any()).ToList()) + Assert.Throws(() => context.Set().Where(e => e.Tags.Any()).ToList()) .Message.Replace("\r", "").Replace("\n", "")); } @@ -652,8 +647,7 @@ public virtual void Collection_property_as_scalar_Count_member() Assert.Equal( CoreStrings.TranslationFailed( @"DbSet() .Where(c => c.Tags.Count == 2)"), - Assert.Throws( - () => context.Set().Where(e => e.Tags.Count == 2).ToList()) + Assert.Throws(() => context.Set().Where(e => e.Tags.Count == 2).ToList()) .Message.Replace("\r", "").Replace("\n", "")); } @@ -670,8 +664,7 @@ public virtual void Collection_enum_as_string_Contains() var sameRole = Roles.Seller; Assert.Contains( @"See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.", - Assert.Throws( - () => context.Set().Where(e => e.Roles.Contains(sameRole)).ToList()) + Assert.Throws(() => context.Set().Where(e => e.Roles.Contains(sameRole)).ToList()) .Message.Replace("\r", "").Replace("\n", "")); } @@ -696,8 +689,8 @@ public virtual void Optional_owned_with_converter_reading_non_nullable_column() using var context = CreateContext(); Assert.Equal( "Nullable object must have a value.", - Assert.Throws( - () => context.Set().Select(e => new { e.OwnedWithConverter.Value }).ToList()).Message); + Assert.Throws(() => context.Set().Select(e => new { e.OwnedWithConverter.Value }).ToList()) + .Message); } protected class Parent @@ -745,14 +738,12 @@ public virtual void Composition_over_collection_of_complex_mapped_as_scalar() Assert.Equal( CoreStrings.TranslationFailed( @"l => new { H = l.Height, W = l.Width }"), - Assert.Throws( - () => context.Set().AsNoTracking().Select( - d => new - { - d.Id, - d.Name, - Layouts = d.Layouts.Select(l => new { H = l.Height, W = l.Width }).ToList() - }).ToList()) + Assert.Throws(() => context.Set().AsNoTracking().Select(d => new + { + d.Id, + d.Name, + Layouts = d.Layouts.Select(l => new { H = l.Height, W = l.Width }).ToList() + }).ToList()) .Message.Replace("\r", "").Replace("\n", "")); } @@ -817,9 +808,8 @@ public enum SomeEnum public virtual void Infer_type_mapping_from_in_subquery_to_item() { using var context = CreateContext(); - var results = context.Set().Where( - b => - context.Set().Select(bb => bb.TestBoolean).Contains(true) && b.Id == 13).ToList(); + var results = context.Set().Where(b => + context.Set().Select(bb => bb.TestBoolean).Contains(true) && b.Id == 13).ToList(); Assert.Equal(1, results.Count); } @@ -836,531 +826,507 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con { base.OnModelCreating(modelBuilder, context); - modelBuilder.Entity( - b => - { - b.Property(p => p.SSN) - .HasConversion( - ssn => ssn.HasValue - ? ssn.Value.Number - : new int?(), - i => i.HasValue - ? new SocialSecurityNumber { Number = i.Value } - : new SocialSecurityNumber?()); - - b.Property(p => p.Id).ValueGeneratedNever(); - b.HasIndex(p => p.SSN) - .IsUnique(); - }); + modelBuilder.Entity(b => + { + b.Property(p => p.SSN) + .HasConversion( + ssn => ssn.HasValue + ? ssn.Value.Number + : new int?(), + i => i.HasValue + ? new SocialSecurityNumber { Number = i.Value } + : new SocialSecurityNumber?()); + + b.Property(p => p.Id).ValueGeneratedNever(); + b.HasIndex(p => p.SSN) + .IsUnique(); + }); - modelBuilder.Entity( - b => - { - b.HasMany(e => e.Dependents).WithOne(e => e.Principal).HasForeignKey(e => e.PrincipalId); - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.Id).HasConversion(v => v ?? 0, v => v); - }); + modelBuilder.Entity(b => + { + b.HasMany(e => e.Dependents).WithOne(e => e.Principal).HasForeignKey(e => e.PrincipalId); + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.Id).HasConversion(v => v ?? 0, v => v); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.PrincipalId).HasConversion(v => v, v => v); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.PrincipalId).HasConversion(v => v, v => v); + }); - modelBuilder.Entity( - b => - { - b.Property(x => x.Email).HasConversion(email => (string)email, value => Email.Create(value)); - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(x => x.Email).HasConversion(email => (string)email, value => Email.Create(value)); + b.Property(e => e.Id).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.Property(x => x.Fuel).HasConversion(f => f.Volume, v => new Fuel(v)); - b.Property(e => e.LoadId).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(x => x.Fuel).HasConversion(f => f.Volume, v => new Fuel(v)); + b.Property(e => e.LoadId).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.PartitionId).HasConversion(v => (long)v, v => (int)v); - b.Property(e => e.TestInt16).HasConversion(v => (long)v, v => (short)v); - b.Property(e => e.TestInt32).HasConversion(v => (long)v, v => (int)v); - b.Property(e => e.TestInt64).HasConversion(v => v, v => v); - b.Property(e => e.TestDecimal).HasConversion(NumberToBytesConverter.DefaultInfo.Create()); - b.Property(e => e.TestDateTime).HasConversion(v => v.ToBinary(), v => DateTime.FromBinary(v)); - b.Property(e => e.TestDateOnly).HasConversion(v => v.ToShortDateString(), v => DateOnly.Parse(v)); - b.Property(e => e.TestTimeSpan).HasConversion(v => v.TotalMilliseconds, v => TimeSpan.FromMilliseconds(v)); - b.Property(e => e.TestTimeOnly).HasConversion(v => v.Ticks, v => new TimeOnly(v)); - b.Property(e => e.TestSingle).HasConversion(new CastingConverter()); - b.Property(e => e.TestBoolean).HasConversion(new BoolToTwoValuesConverter("Nope", "Yeps")).HasMaxLength(4); - b.Property(e => e.TestByte).HasConversion(v => (ushort)v, v => (byte)v); - b.Property(e => e.TestUnsignedInt16).HasConversion(v => (ulong)v, v => (ushort)v); - b.Property(e => e.TestUnsignedInt32).HasConversion(v => (ulong)v, v => (uint)v); - b.Property(e => e.TestUnsignedInt64).HasConversion(v => (long)v, v => (ulong)v); - b.Property(e => e.TestCharacter).HasConversion(v => (int)v, v => (char)v); - b.Property(e => e.TestSignedByte).HasConversion(v => (decimal)v, v => (sbyte)v); - b.Property(e => e.Enum64).HasConversion(v => (long)v, v => (Enum64)v); - b.Property(e => e.Enum32).HasConversion(v => (long)v, v => (Enum32)v); - b.Property(e => e.Enum16).HasConversion(v => (long)v, v => (Enum16)v); - b.Property(e => e.EnumU64).HasConversion(v => (ulong)v, v => (EnumU64)v); - b.Property(e => e.EnumU32).HasConversion(v => (ulong)v, v => (EnumU32)v); - b.Property(e => e.EnumU16).HasConversion(v => (ulong)v, v => (EnumU16)v); - - b.Property(e => e.EnumS8) - .HasConversion( - v => v.ToString(), - v => v == nameof(EnumS8.SomeValue) ? EnumS8.SomeValue : default) - .HasMaxLength(24); - - b.Property(e => e.Enum8).HasConversion( - v => v.ToString(), - v => v == nameof(Enum8.SomeValue) ? Enum8.SomeValue : default) - .IsUnicode(false); - - b.Property(e => e.TestDateTimeOffset).HasConversion( + modelBuilder.Entity(b => + { + b.Property(e => e.PartitionId).HasConversion(v => (long)v, v => (int)v); + b.Property(e => e.TestInt16).HasConversion(v => (long)v, v => (short)v); + b.Property(e => e.TestInt32).HasConversion(v => (long)v, v => (int)v); + b.Property(e => e.TestInt64).HasConversion(v => v, v => v); + b.Property(e => e.TestDecimal).HasConversion(NumberToBytesConverter.DefaultInfo.Create()); + b.Property(e => e.TestDateTime).HasConversion(v => v.ToBinary(), v => DateTime.FromBinary(v)); + b.Property(e => e.TestDateOnly).HasConversion(v => v.ToShortDateString(), v => DateOnly.Parse(v)); + b.Property(e => e.TestTimeSpan).HasConversion(v => v.TotalMilliseconds, v => TimeSpan.FromMilliseconds(v)); + b.Property(e => e.TestTimeOnly).HasConversion(v => v.Ticks, v => new TimeOnly(v)); + b.Property(e => e.TestSingle).HasConversion(new CastingConverter()); + b.Property(e => e.TestBoolean).HasConversion(new BoolToTwoValuesConverter("Nope", "Yeps")).HasMaxLength(4); + b.Property(e => e.TestByte).HasConversion(v => (ushort)v, v => (byte)v); + b.Property(e => e.TestUnsignedInt16).HasConversion(v => (ulong)v, v => (ushort)v); + b.Property(e => e.TestUnsignedInt32).HasConversion(v => (ulong)v, v => (uint)v); + b.Property(e => e.TestUnsignedInt64).HasConversion(v => (long)v, v => (ulong)v); + b.Property(e => e.TestCharacter).HasConversion(v => (int)v, v => (char)v); + b.Property(e => e.TestSignedByte).HasConversion(v => (decimal)v, v => (sbyte)v); + b.Property(e => e.Enum64).HasConversion(v => (long)v, v => (Enum64)v); + b.Property(e => e.Enum32).HasConversion(v => (long)v, v => (Enum32)v); + b.Property(e => e.Enum16).HasConversion(v => (long)v, v => (Enum16)v); + b.Property(e => e.EnumU64).HasConversion(v => (ulong)v, v => (EnumU64)v); + b.Property(e => e.EnumU32).HasConversion(v => (ulong)v, v => (EnumU32)v); + b.Property(e => e.EnumU16).HasConversion(v => (ulong)v, v => (EnumU16)v); + + b.Property(e => e.EnumS8) + .HasConversion( + v => v.ToString(), + v => v == nameof(EnumS8.SomeValue) ? EnumS8.SomeValue : default) + .HasMaxLength(24); + + b.Property(e => e.Enum8).HasConversion( + v => v.ToString(), + v => v == nameof(Enum8.SomeValue) ? Enum8.SomeValue : default) + .IsUnicode(false); + + b.Property(e => e.TestDateTimeOffset).HasConversion( + v => v.ToUnixTimeMilliseconds(), + v => DateTimeOffset.FromUnixTimeMilliseconds(v).ToOffset(TimeSpan.FromHours(-8.0))); + + b.Property(e => e.TestDouble).HasConversion( + new ValueConverter( + v => (decimal)v, + v => (double)v, + new ConverterMappingHints(precision: 26, scale: 16))); + }); + + modelBuilder.Entity(b => + { + b.Property(e => e.PartitionId).HasConversion(v => (long)v, v => (int)v); + b.Property(e => e.TestNullableInt16).HasConversion(v => (long?)v, v => (short?)v); + b.Property(e => e.TestNullableInt32).HasConversion(v => (long?)v, v => (int?)v); + b.Property(e => e.TestNullableInt64).HasConversion(v => v, v => v); + b.Property(e => e.TestNullableDecimal).HasConversion(NumberToBytesConverter.DefaultInfo.Create()); + b.Property(e => e.TestNullableSingle).HasConversion(new CastingConverter()); + b.Property(e => e.TestNullableBoolean).HasConversion(new BoolToTwoValuesConverter("Nope", "Yep")); + b.Property(e => e.TestNullableByte).HasConversion(v => (ushort?)v, v => (byte?)v); + b.Property(e => e.TestNullableUnsignedInt16).HasConversion(v => (ulong?)v, v => (ushort?)v); + b.Property(e => e.TestNullableUnsignedInt32).HasConversion(v => (ulong?)v, v => (uint?)v); + b.Property(e => e.TestNullableUnsignedInt64).HasConversion(v => (long?)v, v => (ulong?)v); + b.Property(e => e.TestNullableCharacter).HasConversion(v => (int?)v, v => (char?)v); + b.Property(e => e.TestNullableSignedByte).HasConversion(v => (decimal?)v, v => (sbyte?)v); + b.Property(e => e.Enum64).HasConversion(v => (long?)v, v => (Enum64?)v); + b.Property(e => e.Enum32).HasConversion(v => (long?)v, v => (Enum32?)v); + b.Property(e => e.Enum16).HasConversion(v => (long?)v, v => (Enum16?)v); + b.Property(e => e.EnumU64).HasConversion(v => (ulong?)v, v => (EnumU64?)v); + b.Property(e => e.EnumU32).HasConversion(v => (ulong?)v, v => (EnumU32?)v); + b.Property(e => e.EnumU16).HasConversion(v => (ulong?)v, v => (EnumU16?)v); + + b.Property(e => e.TestNullableDateTime).HasConversion( + v => v.Value.ToBinary(), + v => DateTime.FromBinary(v)); + + b.Property(e => e.TestNullableDateOnly).HasConversion( + v => v.Value.ToShortDateString(), + v => DateOnly.Parse(v)); + + b.Property(e => e.TestNullableTimeSpan).HasConversion( + v => v.Value.TotalMilliseconds, + v => TimeSpan.FromMilliseconds(v)); + + b.Property(e => e.TestNullableTimeOnly).HasConversion( + v => v.Value.Ticks, + v => new TimeOnly(v)); + + b.Property(e => e.EnumS8).HasConversion( + v => v.ToString(), + v => v == nameof(EnumS8.SomeValue) ? EnumS8.SomeValue : null); + + b.Property(e => e.Enum8).HasConversion( + v => v.ToString(), + v => v == nameof(Enum8.SomeValue) ? Enum8.SomeValue : null); + + b.Property(e => e.TestNullableDateTimeOffset).HasConversion( + v => v.Value.ToUnixTimeMilliseconds(), + v => DateTimeOffset.FromUnixTimeMilliseconds(v).ToOffset(TimeSpan.FromHours(-8.0))); + + b.Property(e => e.TestNullableDouble).HasConversion( + new ValueConverter( + v => (decimal?)v, v => (double?)v, + new ConverterMappingHints(precision: 26, scale: 16))); + }); + + modelBuilder.Entity(b => + { + b.Property(nameof(BuiltInDataTypes.PartitionId)) + .HasConversion(new ValueConverter(v => v, v => (int)v)); + b.Property(nameof(BuiltInDataTypes.TestInt16)) + .HasConversion(new ValueConverter(v => v, v => (short)v)); + b.Property(nameof(BuiltInDataTypes.TestInt32)) + .HasConversion(new ValueConverter(v => v, v => (int)v)); + b.Property(nameof(BuiltInDataTypes.TestInt64)).HasConversion(new ValueConverter(v => v, v => v)); + b.Property(nameof(BuiltInDataTypes.TestDecimal)) + .HasConversion(NumberToBytesConverter.DefaultInfo.Create()); + b.Property(nameof(BuiltInDataTypes.TestDateOnly)).HasConversion( + new ValueConverter(v => v.ToShortDateString(), v => DateOnly.Parse(v))); + b.Property(nameof(BuiltInDataTypes.TestDateTime)).HasConversion( + new ValueConverter(v => v.ToBinary(), v => DateTime.FromBinary(v))); + b.Property(nameof(BuiltInDataTypes.TestTimeSpan)).HasConversion( + new ValueConverter(v => v.TotalMilliseconds, v => TimeSpan.FromMilliseconds(v))); + b.Property(nameof(BuiltInDataTypes.TestTimeOnly)).HasConversion( + new ValueConverter(v => v.Ticks, v => new TimeOnly(v))); + b.Property(nameof(BuiltInDataTypes.TestSingle)).HasConversion(new CastingConverter()); + b.Property(nameof(BuiltInDataTypes.TestBoolean)).HasConversion(new BoolToTwoValuesConverter("Nope", "Yep")); + b.Property(nameof(BuiltInDataTypes.TestByte)) + .HasConversion(new ValueConverter(v => v, v => (byte)v)); + b.Property(nameof(BuiltInDataTypes.TestUnsignedInt16)) + .HasConversion(new ValueConverter(v => v, v => (ushort)v)); + b.Property(nameof(BuiltInDataTypes.TestUnsignedInt32)) + .HasConversion(new ValueConverter(v => v, v => (uint)v)); + b.Property(nameof(BuiltInDataTypes.TestUnsignedInt64)) + .HasConversion(new ValueConverter(v => (long)v, v => (ulong)v)); + b.Property(nameof(BuiltInDataTypes.TestCharacter)) + .HasConversion(new ValueConverter(v => v, v => (char)v)); + b.Property(nameof(BuiltInDataTypes.TestSignedByte)) + .HasConversion(new ValueConverter(v => v, v => (sbyte)v)); + b.Property(nameof(BuiltInDataTypes.Enum64)) + .HasConversion(new ValueConverter(v => (long)v, v => (Enum64)v)); + b.Property(nameof(BuiltInDataTypes.Enum32)) + .HasConversion(new ValueConverter(v => (long)v, v => (Enum32)v)); + b.Property(nameof(BuiltInDataTypes.Enum16)) + .HasConversion(new ValueConverter(v => (long)v, v => (Enum16)v)); + b.Property(nameof(BuiltInDataTypes.EnumU64)) + .HasConversion(new ValueConverter(v => (ulong)v, v => (EnumU64)v)); + b.Property(nameof(BuiltInDataTypes.EnumU32)) + .HasConversion(new ValueConverter(v => (ulong)v, v => (EnumU32)v)); + b.Property(nameof(BuiltInDataTypes.EnumU16)) + .HasConversion(new ValueConverter(v => (ulong)v, v => (EnumU16)v)); + + b.Property(nameof(BuiltInDataTypes.EnumS8)).HasConversion( + new ValueConverter( + v => v.ToString(), + v => v == nameof(EnumS8.SomeValue) ? EnumS8.SomeValue : default)); + + b.Property(nameof(BuiltInDataTypes.Enum8)).HasConversion( + new ValueConverter( + v => v.ToString(), + v => v == nameof(Enum8.SomeValue) ? Enum8.SomeValue : default)); + + b.Property(nameof(BuiltInDataTypes.TestDateTimeOffset)).HasConversion( + new ValueConverter( v => v.ToUnixTimeMilliseconds(), - v => DateTimeOffset.FromUnixTimeMilliseconds(v).ToOffset(TimeSpan.FromHours(-8.0))); + v => DateTimeOffset.FromUnixTimeMilliseconds(v).ToOffset(TimeSpan.FromHours(-8.0)))); - b.Property(e => e.TestDouble).HasConversion( - new ValueConverter( - v => (decimal)v, - v => (double)v, - new ConverterMappingHints(precision: 26, scale: 16))); - }); + b.Property(nameof(BuiltInDataTypes.TestDouble)).HasConversion( + new ValueConverter( + v => (decimal)v, + v => (double)v, + new ConverterMappingHints(precision: 26, scale: 16))); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.PartitionId).HasConversion(v => (long)v, v => (int)v); - b.Property(e => e.TestNullableInt16).HasConversion(v => (long?)v, v => (short?)v); - b.Property(e => e.TestNullableInt32).HasConversion(v => (long?)v, v => (int?)v); - b.Property(e => e.TestNullableInt64).HasConversion(v => v, v => v); - b.Property(e => e.TestNullableDecimal).HasConversion(NumberToBytesConverter.DefaultInfo.Create()); - b.Property(e => e.TestNullableSingle).HasConversion(new CastingConverter()); - b.Property(e => e.TestNullableBoolean).HasConversion(new BoolToTwoValuesConverter("Nope", "Yep")); - b.Property(e => e.TestNullableByte).HasConversion(v => (ushort?)v, v => (byte?)v); - b.Property(e => e.TestNullableUnsignedInt16).HasConversion(v => (ulong?)v, v => (ushort?)v); - b.Property(e => e.TestNullableUnsignedInt32).HasConversion(v => (ulong?)v, v => (uint?)v); - b.Property(e => e.TestNullableUnsignedInt64).HasConversion(v => (long?)v, v => (ulong?)v); - b.Property(e => e.TestNullableCharacter).HasConversion(v => (int?)v, v => (char?)v); - b.Property(e => e.TestNullableSignedByte).HasConversion(v => (decimal?)v, v => (sbyte?)v); - b.Property(e => e.Enum64).HasConversion(v => (long?)v, v => (Enum64?)v); - b.Property(e => e.Enum32).HasConversion(v => (long?)v, v => (Enum32?)v); - b.Property(e => e.Enum16).HasConversion(v => (long?)v, v => (Enum16?)v); - b.Property(e => e.EnumU64).HasConversion(v => (ulong?)v, v => (EnumU64?)v); - b.Property(e => e.EnumU32).HasConversion(v => (ulong?)v, v => (EnumU32?)v); - b.Property(e => e.EnumU16).HasConversion(v => (ulong?)v, v => (EnumU16?)v); - - b.Property(e => e.TestNullableDateTime).HasConversion( + modelBuilder.Entity(b => + { + b.Property(nameof(BuiltInNullableDataTypes.PartitionId)) + .HasConversion(new ValueConverter(v => v, v => (int)v)); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt16)) + .HasConversion(new ValueConverter(v => v, v => (short?)v)); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt32)) + .HasConversion(new ValueConverter(v => v, v => (int?)v)); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt64)) + .HasConversion(new ValueConverter(v => v, v => v)); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableDecimal)) + .HasConversion(NumberToBytesConverter.DefaultInfo.Create()); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableSingle)) + .HasConversion(new CastingConverter()); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableBoolean)) + .HasConversion(new BoolToTwoValuesConverter("Nope", "Yep")); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableByte)) + .HasConversion(new ValueConverter(v => v, v => (byte?)v)); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt16)) + .HasConversion(new ValueConverter(v => v, v => (ushort?)v)); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt32)) + .HasConversion(new ValueConverter(v => v, v => (uint?)v)); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt64)) + .HasConversion(new ValueConverter(v => (long?)v, v => (ulong?)v)); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableCharacter)) + .HasConversion(new ValueConverter(v => v, v => (char?)v)); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableSignedByte)).HasConversion( + new ValueConverter(v => v, v => (sbyte?)v)); + b.Property(nameof(BuiltInNullableDataTypes.Enum64)) + .HasConversion(new ValueConverter(v => (long?)v, v => (Enum64?)v)); + b.Property(nameof(BuiltInNullableDataTypes.Enum32)) + .HasConversion(new ValueConverter(v => (long?)v, v => (Enum32?)v)); + b.Property(nameof(BuiltInNullableDataTypes.Enum16)) + .HasConversion(new ValueConverter(v => (long?)v, v => (Enum16?)v)); + b.Property(nameof(BuiltInNullableDataTypes.EnumU64)) + .HasConversion(new ValueConverter(v => (ulong?)v, v => (EnumU64?)v)); + b.Property(nameof(BuiltInNullableDataTypes.EnumU32)) + .HasConversion(new ValueConverter(v => (ulong?)v, v => (EnumU32?)v)); + b.Property(nameof(BuiltInNullableDataTypes.EnumU16)) + .HasConversion(new ValueConverter(v => (ulong?)v, v => (EnumU16?)v)); + + b.Property(nameof(BuiltInNullableDataTypes.TestNullableDateTime)).HasConversion( + new ValueConverter( v => v.Value.ToBinary(), - v => DateTime.FromBinary(v)); + v => DateTime.FromBinary(v))); - b.Property(e => e.TestNullableDateOnly).HasConversion( + b.Property(nameof(BuiltInNullableDataTypes.TestNullableDateOnly)).HasConversion( + new ValueConverter( v => v.Value.ToShortDateString(), - v => DateOnly.Parse(v)); + v => DateOnly.Parse(v))); - b.Property(e => e.TestNullableTimeSpan).HasConversion( + b.Property(nameof(BuiltInNullableDataTypes.TestNullableTimeSpan)).HasConversion( + new ValueConverter( v => v.Value.TotalMilliseconds, - v => TimeSpan.FromMilliseconds(v)); + v => TimeSpan.FromMilliseconds(v))); - b.Property(e => e.TestNullableTimeOnly).HasConversion( + b.Property(nameof(BuiltInNullableDataTypes.TestNullableTimeOnly)).HasConversion( + new ValueConverter( v => v.Value.Ticks, - v => new TimeOnly(v)); + v => new TimeOnly(v))); - b.Property(e => e.EnumS8).HasConversion( + b.Property(nameof(BuiltInNullableDataTypes.EnumS8)).HasConversion( + new ValueConverter( v => v.ToString(), - v => v == nameof(EnumS8.SomeValue) ? EnumS8.SomeValue : null); + v => v == nameof(EnumS8.SomeValue) ? EnumS8.SomeValue : null)); - b.Property(e => e.Enum8).HasConversion( + b.Property(nameof(BuiltInNullableDataTypes.Enum8)).HasConversion( + new ValueConverter( v => v.ToString(), - v => v == nameof(Enum8.SomeValue) ? Enum8.SomeValue : null); + v => v == nameof(Enum8.SomeValue) ? Enum8.SomeValue : null)); - b.Property(e => e.TestNullableDateTimeOffset).HasConversion( + b.Property(nameof(BuiltInNullableDataTypes.TestNullableDateTimeOffset)).HasConversion( + new ValueConverter( v => v.Value.ToUnixTimeMilliseconds(), - v => DateTimeOffset.FromUnixTimeMilliseconds(v).ToOffset(TimeSpan.FromHours(-8.0))); - - b.Property(e => e.TestNullableDouble).HasConversion( - new ValueConverter( - v => (decimal?)v, v => (double?)v, - new ConverterMappingHints(precision: 26, scale: 16))); - }); + v => DateTimeOffset.FromUnixTimeMilliseconds(v).ToOffset(TimeSpan.FromHours(-8.0)))); - modelBuilder.Entity( - b => - { - b.Property(nameof(BuiltInDataTypes.PartitionId)) - .HasConversion(new ValueConverter(v => v, v => (int)v)); - b.Property(nameof(BuiltInDataTypes.TestInt16)) - .HasConversion(new ValueConverter(v => v, v => (short)v)); - b.Property(nameof(BuiltInDataTypes.TestInt32)) - .HasConversion(new ValueConverter(v => v, v => (int)v)); - b.Property(nameof(BuiltInDataTypes.TestInt64)).HasConversion(new ValueConverter(v => v, v => v)); - b.Property(nameof(BuiltInDataTypes.TestDecimal)) - .HasConversion(NumberToBytesConverter.DefaultInfo.Create()); - b.Property(nameof(BuiltInDataTypes.TestDateOnly)).HasConversion( - new ValueConverter(v => v.ToShortDateString(), v => DateOnly.Parse(v))); - b.Property(nameof(BuiltInDataTypes.TestDateTime)).HasConversion( - new ValueConverter(v => v.ToBinary(), v => DateTime.FromBinary(v))); - b.Property(nameof(BuiltInDataTypes.TestTimeSpan)).HasConversion( - new ValueConverter(v => v.TotalMilliseconds, v => TimeSpan.FromMilliseconds(v))); - b.Property(nameof(BuiltInDataTypes.TestTimeOnly)).HasConversion( - new ValueConverter(v => v.Ticks, v => new TimeOnly(v))); - b.Property(nameof(BuiltInDataTypes.TestSingle)).HasConversion(new CastingConverter()); - b.Property(nameof(BuiltInDataTypes.TestBoolean)).HasConversion(new BoolToTwoValuesConverter("Nope", "Yep")); - b.Property(nameof(BuiltInDataTypes.TestByte)) - .HasConversion(new ValueConverter(v => v, v => (byte)v)); - b.Property(nameof(BuiltInDataTypes.TestUnsignedInt16)) - .HasConversion(new ValueConverter(v => v, v => (ushort)v)); - b.Property(nameof(BuiltInDataTypes.TestUnsignedInt32)) - .HasConversion(new ValueConverter(v => v, v => (uint)v)); - b.Property(nameof(BuiltInDataTypes.TestUnsignedInt64)) - .HasConversion(new ValueConverter(v => (long)v, v => (ulong)v)); - b.Property(nameof(BuiltInDataTypes.TestCharacter)) - .HasConversion(new ValueConverter(v => v, v => (char)v)); - b.Property(nameof(BuiltInDataTypes.TestSignedByte)) - .HasConversion(new ValueConverter(v => v, v => (sbyte)v)); - b.Property(nameof(BuiltInDataTypes.Enum64)) - .HasConversion(new ValueConverter(v => (long)v, v => (Enum64)v)); - b.Property(nameof(BuiltInDataTypes.Enum32)) - .HasConversion(new ValueConverter(v => (long)v, v => (Enum32)v)); - b.Property(nameof(BuiltInDataTypes.Enum16)) - .HasConversion(new ValueConverter(v => (long)v, v => (Enum16)v)); - b.Property(nameof(BuiltInDataTypes.EnumU64)) - .HasConversion(new ValueConverter(v => (ulong)v, v => (EnumU64)v)); - b.Property(nameof(BuiltInDataTypes.EnumU32)) - .HasConversion(new ValueConverter(v => (ulong)v, v => (EnumU32)v)); - b.Property(nameof(BuiltInDataTypes.EnumU16)) - .HasConversion(new ValueConverter(v => (ulong)v, v => (EnumU16)v)); - - b.Property(nameof(BuiltInDataTypes.EnumS8)).HasConversion( - new ValueConverter( - v => v.ToString(), - v => v == nameof(EnumS8.SomeValue) ? EnumS8.SomeValue : default)); - - b.Property(nameof(BuiltInDataTypes.Enum8)).HasConversion( - new ValueConverter( - v => v.ToString(), - v => v == nameof(Enum8.SomeValue) ? Enum8.SomeValue : default)); - - b.Property(nameof(BuiltInDataTypes.TestDateTimeOffset)).HasConversion( - new ValueConverter( - v => v.ToUnixTimeMilliseconds(), - v => DateTimeOffset.FromUnixTimeMilliseconds(v).ToOffset(TimeSpan.FromHours(-8.0)))); - - b.Property(nameof(BuiltInDataTypes.TestDouble)).HasConversion( - new ValueConverter( - v => (decimal)v, - v => (double)v, - new ConverterMappingHints(precision: 26, scale: 16))); - }); + b.Property(nameof(BuiltInNullableDataTypes.TestNullableDouble)).HasConversion( + new ValueConverter( + v => (decimal?)v, v => (double?)v, + new ConverterMappingHints(precision: 26, scale: 16))); + }); - modelBuilder.Entity( - b => - { - b.Property(nameof(BuiltInNullableDataTypes.PartitionId)) - .HasConversion(new ValueConverter(v => v, v => (int)v)); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt16)) - .HasConversion(new ValueConverter(v => v, v => (short?)v)); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt32)) - .HasConversion(new ValueConverter(v => v, v => (int?)v)); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableInt64)) - .HasConversion(new ValueConverter(v => v, v => v)); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableDecimal)) - .HasConversion(NumberToBytesConverter.DefaultInfo.Create()); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableSingle)) - .HasConversion(new CastingConverter()); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableBoolean)) - .HasConversion(new BoolToTwoValuesConverter("Nope", "Yep")); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableByte)) - .HasConversion(new ValueConverter(v => v, v => (byte?)v)); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt16)) - .HasConversion(new ValueConverter(v => v, v => (ushort?)v)); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt32)) - .HasConversion(new ValueConverter(v => v, v => (uint?)v)); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt64)) - .HasConversion(new ValueConverter(v => (long?)v, v => (ulong?)v)); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableCharacter)) - .HasConversion(new ValueConverter(v => v, v => (char?)v)); - b.Property(nameof(BuiltInNullableDataTypes.TestNullableSignedByte)).HasConversion( - new ValueConverter(v => v, v => (sbyte?)v)); - b.Property(nameof(BuiltInNullableDataTypes.Enum64)) - .HasConversion(new ValueConverter(v => (long?)v, v => (Enum64?)v)); - b.Property(nameof(BuiltInNullableDataTypes.Enum32)) - .HasConversion(new ValueConverter(v => (long?)v, v => (Enum32?)v)); - b.Property(nameof(BuiltInNullableDataTypes.Enum16)) - .HasConversion(new ValueConverter(v => (long?)v, v => (Enum16?)v)); - b.Property(nameof(BuiltInNullableDataTypes.EnumU64)) - .HasConversion(new ValueConverter(v => (ulong?)v, v => (EnumU64?)v)); - b.Property(nameof(BuiltInNullableDataTypes.EnumU32)) - .HasConversion(new ValueConverter(v => (ulong?)v, v => (EnumU32?)v)); - b.Property(nameof(BuiltInNullableDataTypes.EnumU16)) - .HasConversion(new ValueConverter(v => (ulong?)v, v => (EnumU16?)v)); - - b.Property(nameof(BuiltInNullableDataTypes.TestNullableDateTime)).HasConversion( - new ValueConverter( - v => v.Value.ToBinary(), - v => DateTime.FromBinary(v))); - - b.Property(nameof(BuiltInNullableDataTypes.TestNullableDateOnly)).HasConversion( - new ValueConverter( - v => v.Value.ToShortDateString(), - v => DateOnly.Parse(v))); - - b.Property(nameof(BuiltInNullableDataTypes.TestNullableTimeSpan)).HasConversion( - new ValueConverter( - v => v.Value.TotalMilliseconds, - v => TimeSpan.FromMilliseconds(v))); - - b.Property(nameof(BuiltInNullableDataTypes.TestNullableTimeOnly)).HasConversion( - new ValueConverter( - v => v.Value.Ticks, - v => new TimeOnly(v))); - - b.Property(nameof(BuiltInNullableDataTypes.EnumS8)).HasConversion( - new ValueConverter( - v => v.ToString(), - v => v == nameof(EnumS8.SomeValue) ? EnumS8.SomeValue : null)); - - b.Property(nameof(BuiltInNullableDataTypes.Enum8)).HasConversion( - new ValueConverter( - v => v.ToString(), - v => v == nameof(Enum8.SomeValue) ? Enum8.SomeValue : null)); - - b.Property(nameof(BuiltInNullableDataTypes.TestNullableDateTimeOffset)).HasConversion( - new ValueConverter( - v => v.Value.ToUnixTimeMilliseconds(), - v => DateTimeOffset.FromUnixTimeMilliseconds(v).ToOffset(TimeSpan.FromHours(-8.0)))); - - b.Property(nameof(BuiltInNullableDataTypes.TestNullableDouble)).HasConversion( - new ValueConverter( - v => (decimal?)v, v => (double?)v, - new ConverterMappingHints(precision: 26, scale: 16))); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion( + v => new byte[] { 4, 2, 0 }.Concat(v).ToArray(), + v => v.Skip(3).ToArray()); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion( - v => new byte[] { 4, 2, 0 }.Concat(v).ToArray(), - v => v.Skip(3).ToArray()); - }); + modelBuilder.Entity(b => + { + var property = b.Property(e => e.Id) + .HasConversion(v => "KeyValue=" + v, v => v.Substring(9)).Metadata; + }); - modelBuilder.Entity( - b => - { - var property = b.Property(e => e.Id) - .HasConversion(v => "KeyValue=" + v, v => v.Substring(9)).Metadata; - }); + modelBuilder.Entity(b => + { + b.Property(e => e.StringKeyDataTypeId) + .HasConversion( + v => "KeyValue=" + v, + v => v.Substring(9)); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.StringKeyDataTypeId) - .HasConversion( - v => "KeyValue=" + v, - v => v.Substring(9)); - }); + modelBuilder.Entity(b => + { + var bytesComparer = new ValueComparer( + (v1, v2) => v1.SequenceEqual(v2), + v => v.GetHashCode()); + + b.Property(e => e.String3) + .HasConversion( + new ValueConverter( + v => "KeyValue=" + v, v => v.Substring(9))) + .HasMaxLength(12); + + b.Property(e => e.String9000).HasConversion( + StringToBytesConverter.DefaultInfo.Create()); + + b.Property(e => e.StringUnbounded).HasConversion( + StringToBytesConverter.DefaultInfo.Create()); + + b.Property(e => e.ByteArray5) + .HasConversion( + new ValueConverter( + v => v.Reverse().Concat(new byte[] { 4, 20 }).ToArray(), + v => v.Reverse().Skip(2).ToArray()), + bytesComparer) + .HasMaxLength(7); + + b.Property(e => e.ByteArray9000) + .HasConversion( + BytesToStringConverter.DefaultInfo.Create(), + bytesComparer) + .HasMaxLength(LongStringLength * 2); + }); - modelBuilder.Entity( - b => - { - var bytesComparer = new ValueComparer( + modelBuilder.Entity(b => + { + b.Property(e => e.Strings).HasConversion( + v => string.Join(",", v), + v => v.Split(new[] { ',' }).ToList(), + new ValueComparer>( (v1, v2) => v1.SequenceEqual(v2), - v => v.GetHashCode()); - - b.Property(e => e.String3) - .HasConversion( - new ValueConverter( - v => "KeyValue=" + v, v => v.Substring(9))) - .HasMaxLength(12); - - b.Property(e => e.String9000).HasConversion( - StringToBytesConverter.DefaultInfo.Create()); - - b.Property(e => e.StringUnbounded).HasConversion( - StringToBytesConverter.DefaultInfo.Create()); - - b.Property(e => e.ByteArray5) - .HasConversion( - new ValueConverter( - v => Enumerable.Reverse(v).Concat(new byte[] { 4, 20 }).ToArray(), - v => Enumerable.Reverse(v).Skip(2).ToArray()), - bytesComparer) - .HasMaxLength(7); - - b.Property(e => e.ByteArray9000) - .HasConversion( - BytesToStringConverter.DefaultInfo.Create(), - bytesComparer) - .HasMaxLength(LongStringLength * 2); - }); + v => v.GetHashCode())); - modelBuilder.Entity( - b => - { - b.Property(e => e.Strings).HasConversion( - v => string.Join(",", v), - v => v.Split(new[] { ',' }).ToList(), - new ValueComparer>( - (v1, v2) => v1.SequenceEqual(v2), - v => v.GetHashCode())); - - b.Property(e => e.Id).ValueGeneratedNever(); - }); + b.Property(e => e.Id).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.HasKey(o => o.Id); - b.Property(o => o.Id).HasConversion(new OrderIdEntityFrameworkValueConverter()); - }); + modelBuilder.Entity(b => + { + b.HasKey(o => o.Id); + b.Property(o => o.Id).HasConversion(new OrderIdEntityFrameworkValueConverter()); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.CounterId).ValueGeneratedNever(); - b.HasKey(c => c.CounterId); - b.Property(c => c.Discriminator).HasConversion( - d => StringToDictionarySerializer.Serialize(d), - json => StringToDictionarySerializer.Deserialize(json), - new ValueComparer>( - (v1, v2) => v1.SequenceEqual(v2), - v => v.GetHashCode(), - v => new Dictionary(v))); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.CounterId).ValueGeneratedNever(); + b.HasKey(c => c.CounterId); + b.Property(c => c.Discriminator).HasConversion( + d => StringToDictionarySerializer.Serialize(d), + json => StringToDictionarySerializer.Deserialize(json), + new ValueComparer>( + (v1, v2) => v1.SequenceEqual(v2), + v => v.GetHashCode(), + v => new Dictionary(v))); + }); var urlConverter = new UrlSchemeRemover(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Url).HasConversion(urlConverter); - b.Property(e => e.IsVisible).HasConversion(new BoolToStringConverter("N", "Y")); - b.IndexerProperty(typeof(bool), "IndexerVisible").HasConversion(new BoolToStringConverter("Nay", "Aye")); - - b.HasData( - new - { - BlogId = 1, - Url = "http://blog.com", - IsVisible = true, - IndexerVisible = false, - }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Url).HasConversion(urlConverter); + b.Property(e => e.IsVisible).HasConversion(new BoolToStringConverter("N", "Y")); + b.IndexerProperty(typeof(bool), "IndexerVisible").HasConversion(new BoolToStringConverter("Nay", "Aye")); + + b.HasData( + new + { + BlogId = 1, + Url = "http://blog.com", + IsVisible = true, + IndexerVisible = false, + }); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.RssUrl).HasConversion(urlConverter); - b.HasData( - new - { - BlogId = 2, - Url = "http://rssblog.com", - RssUrl = "http://rssblog.com/rss", - IsVisible = false, - IndexerVisible = true, - }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.RssUrl).HasConversion(urlConverter); + b.HasData( + new + { + BlogId = 2, + Url = "http://rssblog.com", + RssUrl = "http://rssblog.com/rss", + IsVisible = false, + IndexerVisible = true, + }); + }); modelBuilder.Entity() .HasData( new Post { PostId = 1, BlogId = 1 }, new Post { PostId = 2, BlogId = null }); - modelBuilder.Entity( - e => - { - e.Property(e => e.Wrapper).HasConversion - ( - w => w.Value, - v => new ValueWrapper { Value = v } - ); - e.HasData(new EntityWithValueWrapper { Id = 1, Wrapper = new ValueWrapper { Value = "foo" } }); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Tags).HasConversion( - c => string.Join(",", c), - s => s.Split(',', StringSplitOptions.None).ToList(), - new ValueComparer>(favorStructuralComparisons: true)); - - b.HasData( - new CollectionScalar - { - Id = 1, - Tags = - [ - "A", - "B", - "C" - ] - }); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Roles).HasConversion( - new RolesToStringConveter(), - new ValueComparer>(favorStructuralComparisons: true)); + modelBuilder.Entity(e => + { + e.Property(e => e.Wrapper).HasConversion + ( + w => w.Value, + v => new ValueWrapper { Value = v } + ); + e.HasData(new EntityWithValueWrapper { Id = 1, Wrapper = new ValueWrapper { Value = "foo" } }); + }); - b.HasData(new CollectionEnum { Id = 1, Roles = new List { Roles.Seller } }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Tags).HasConversion( + c => string.Join(",", c), + s => s.Split(',', StringSplitOptions.None).ToList(), + new ValueComparer>(favorStructuralComparisons: true)); + + b.HasData( + new CollectionScalar + { + Id = 1, + Tags = + [ + "A", + "B", + "C" + ] + }); + }); - modelBuilder.Entity( - b => - { - b.OwnsOne( - e => e.OwnedWithConverter, - ob => - { - ob.Property(i => i.Value).HasConversion(); - ob.HasData(new { ParentId = 1, Value = 42 }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Roles).HasConversion( + new RolesToStringConveter(), + new ValueComparer>(favorStructuralComparisons: true)); - b.HasData( - new Parent { Id = 1 }, - new Parent { Id = 2 }); - }); + b.HasData(new CollectionEnum { Id = 1, Roles = new List { Roles.Seller } }); + }); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id); - b.Property(e => e.Id).HasConversion( - e => e.Id, - e => new BookId(e)); + modelBuilder.Entity(b => + { + b.OwnsOne( + e => e.OwnedWithConverter, + ob => + { + ob.Property(i => i.Value).HasConversion(); + ob.HasData(new { ParentId = 1, Value = 42 }); + }); + + b.HasData( + new Parent { Id = 1 }, + new Parent { Id = 2 }); + }); - b.HasData(new Book(new BookId(1)) { Value = "Book1" }); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id); + b.Property(e => e.Id).HasConversion( + e => e.Id, + e => new BookId(e)); - modelBuilder.Entity( - b => - { - b.Property(e => e.MessageGroups).HasConversion( - v => string.Join(',', v), - v => v.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(x => Enum.Parse(x)).ToList(), - new ValueComparer>(favorStructuralComparisons: true)); + b.HasData(new Book(new BookId(1)) { Value = "Book1" }); + }); - b.HasData( - new User23059 - { - Id = 1, - IsSoftDeleted = true, - MessageGroups = [MessageGroup.SomeGroup] - }, - new User23059 - { - Id = 2, - IsSoftDeleted = false, - MessageGroups = [MessageGroup.SomeGroup] - }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.MessageGroups).HasConversion( + v => string.Join(',', v), + v => v.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(x => Enum.Parse(x)).ToList(), + new ValueComparer>(favorStructuralComparisons: true)); + + b.HasData( + new User23059 + { + Id = 1, + IsSoftDeleted = true, + MessageGroups = [MessageGroup.SomeGroup] + }, + new User23059 + { + Id = 2, + IsSoftDeleted = false, + MessageGroups = [MessageGroup.SomeGroup] + }); + }); modelBuilder.Entity() .Property(e => e.Layouts).HasConversion( diff --git a/test/EFCore.Specification.Tests/DataAnnotationTestBase.cs b/test/EFCore.Specification.Tests/DataAnnotationTestBase.cs index acbdcf13877..002be93858c 100644 --- a/test/EFCore.Specification.Tests/DataAnnotationTestBase.cs +++ b/test/EFCore.Specification.Tests/DataAnnotationTestBase.cs @@ -142,8 +142,7 @@ public virtual void Duplicate_column_order_is_ignored() protected class Entity_10558 { - [Key] - [Column(Order = 1)] + [Key, Column(Order = 1)] public int Key1 { get; set; } [Column(Order = 1)] @@ -175,8 +174,7 @@ protected class PrivateMemberAnnotationClass public static Expression> PersonFirstNameObjectExpr = p => p.PersonFirstName; - [Key] - [Column("dsdsd", Order = 1, TypeName = "nvarchar(128)")] + [Key, Column("dsdsd", Order = 1, TypeName = "nvarchar(128)")] // ReSharper disable once UnusedAutoPropertyAccessor.Local private string PersonFirstName { get; set; } } @@ -198,8 +196,7 @@ public virtual IModel Field_annotations_are_enabled() protected class FieldAnnotationClass { #pragma warning disable 169 - [Key] - [Column("dsdsd", Order = 1, TypeName = "nvarchar(128)")] + [Key, Column("dsdsd", Order = 1, TypeName = "nvarchar(128)")] private readonly string _personFirstName; #pragma warning restore 169 } @@ -489,12 +486,10 @@ protected class MaxLengthAnnotationClass { public int Id { get; set; } - [StringLength(500)] - [MaxLength] + [StringLength(500), MaxLength] public string PersonFirstName { get; set; } - [MaxLength] - [StringLength(500)] + [MaxLength, StringLength(500)] public string PersonLastName { get; set; } } @@ -515,12 +510,10 @@ protected class MaxLengthWithLengthAnnotationClass { public int Id { get; set; } - [StringLength(500)] - [MaxLength(30)] + [StringLength(500), MaxLength(30)] public string PersonFirstName { get; set; } - [MaxLength(30)] - [StringLength(500)] + [MaxLength(30), StringLength(500)] public string PersonLastName { get; set; } } @@ -590,8 +583,7 @@ public virtual IModel Key_and_column_work_together() protected class ColumnKeyAnnotationClass1 { - [Key] - [Column("dsdsd", Order = 1, TypeName = "nvarchar(128)")] + [Key, Column("dsdsd", Order = 1, TypeName = "nvarchar(128)")] public string PersonFirstName { get; set; } } @@ -612,8 +604,7 @@ public virtual IModel Key_and_MaxLength_64_produce_nvarchar_64() protected class ColumnKeyAnnotationClass2 { - [Key] - [MaxLength(64)] + [Key, MaxLength(64)] public string PersonFirstName { get; set; } } @@ -727,8 +718,7 @@ public virtual ModelBuilder Key_property_is_not_used_for_FK_when_set_by_annotati public class Parent { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int IdRow { get; set; } public string Name { get; set; } @@ -738,8 +728,7 @@ public class Parent public class Child { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int IdRow { get; set; } public string Name { get; set; } @@ -748,8 +737,7 @@ public class Child public class Toy { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int IdRow { get; set; } public string Name { get; set; } @@ -760,8 +748,7 @@ public virtual ModelBuilder Key_specified_on_multiple_properties_can_be_overridd { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity().HasKey( - c => new { c.IdRow, c.Name }); + modelBuilder.Entity().HasKey(c => new { c.IdRow, c.Name }); Validate(modelBuilder); @@ -824,12 +811,11 @@ public virtual void Fluent_API_relationship_throws_for_Keyless_attribute() Assert.Equal( CoreStrings.PrincipalKeylessType( nameof(KeyFluentApiAndKeylessAttribute), nameof(KeyFluentApiAndKeylessAttribute), nameof(CompositeKeyAttribute)), - Assert.Throws( - () => - modelBuilder.Entity() - .HasOne() - .WithOne() - .HasForeignKey("fk")).Message); + Assert.Throws(() => + modelBuilder.Entity() + .HasOne() + .WithOne() + .HasForeignKey("fk")).Message); } private class CompositeKeyAttribute @@ -884,13 +870,12 @@ public virtual IModel DatabaseGeneratedOption_Identity_does_not_throw_on_noninte { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity().HasAlternateKey( - e => new - { - e.String, - e.DateTime, - e.Guid - }); + modelBuilder.Entity().HasAlternateKey(e => new + { + e.String, + e.DateTime, + e.Guid + }); var entity = modelBuilder.Model.FindEntityType(typeof(GeneratedEntityNonInteger)); @@ -940,12 +925,10 @@ protected class TimestampAndMaxlength { public int Id { get; set; } - [MaxLength] - [Timestamp] + [MaxLength, Timestamp] public byte[] MaxTimestamp { get; set; } - [MaxLength(100)] - [Timestamp] + [MaxLength(100), Timestamp] public byte[] NonMaxTimestamp { get; set; } } @@ -993,8 +976,7 @@ protected class Login2 public int Login2Id { get; set; } public string UserName { get; set; } - [Required] - [ForeignKey("Login2Id")] + [Required, ForeignKey("Login2Id")] public virtual Profile2 Profile { get; set; } } @@ -1038,8 +1020,7 @@ protected class Profile3 public string Name { get; set; } public string Email { get; set; } - [Required] - [ForeignKey("Profile3Id")] + [Required, ForeignKey("Profile3Id")] public virtual Login3 User { get; set; } } @@ -1087,8 +1068,7 @@ protected class Login4 public int Login4Id { get; set; } public string UserName { get; set; } - [Required] - [ForeignKey("Login4Id")] + [Required, ForeignKey("Login4Id")] public virtual Profile4 Profile { get; set; } } @@ -1099,8 +1079,7 @@ protected class Profile4 public string Name { get; set; } public string Email { get; set; } - [Required] - [ForeignKey("Profile4Id")] + [Required, ForeignKey("Profile4Id")] public virtual Login4 User { get; set; } } @@ -1174,8 +1153,7 @@ protected class Login6 public int Login6Id { get; set; } public string UserName { get; set; } - [Required] - [ForeignKey("Login6Id")] + [Required, ForeignKey("Login6Id")] public virtual Profile6 Profile { get; set; } } @@ -1248,8 +1226,7 @@ protected class Profile8 public string Name { get; set; } public string Email { get; set; } - [Required] - [ForeignKey("Profile8Id")] + [Required, ForeignKey("Profile8Id")] public virtual Login8 User { get; set; } } @@ -1483,8 +1460,7 @@ protected class MenuPage public Guid? FkGroup { get; set; } - [ForeignKey(nameof(FkGroup))] - [InverseProperty(nameof(MenuGroup.Pages))] + [ForeignKey(nameof(FkGroup)), InverseProperty(nameof(MenuGroup.Pages))] public virtual MenuGroup FkGroupNavigation { get; set; } } @@ -1566,8 +1542,7 @@ protected class Profile15 { public int Id { get; set; } - [ForeignKey(nameof(Profile1))] - [InverseProperty(nameof(Profile3))] + [ForeignKey(nameof(Profile1)), InverseProperty(nameof(Profile3))] public int Profile1Id { get; set; } public virtual Profile15 Profile1 { get; set; } @@ -1720,77 +1695,73 @@ protected class TNAttrDerived : TNAttrBase [ConditionalFact] public virtual Task ConcurrencyCheckAttribute_throws_if_value_in_database_changed() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var clientRow = context.Set().First(r => r.UniqueNo == 1); - clientRow.RowVersion = new Guid("00000000-0000-0000-0002-000000000001"); - clientRow.RequiredColumn = "ChangedData"; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var clientRow = context.Set().First(r => r.UniqueNo == 1); + clientRow.RowVersion = new Guid("00000000-0000-0000-0002-000000000001"); + clientRow.RequiredColumn = "ChangedData"; - using var innerContext = CreateContext(); - UseTransaction(innerContext.Database, context.Database.CurrentTransaction); - var storeRow = innerContext.Set().First(r => r.UniqueNo == 1); - storeRow.RowVersion = new Guid("00000000-0000-0000-0003-000000000001"); - storeRow.RequiredColumn = "ModifiedData"; + using var innerContext = CreateContext(); + UseTransaction(innerContext.Database, context.Database.CurrentTransaction); + var storeRow = innerContext.Set().First(r => r.UniqueNo == 1); + storeRow.RowVersion = new Guid("00000000-0000-0000-0003-000000000001"); + storeRow.RequiredColumn = "ModifiedData"; - await innerContext.SaveChangesAsync(); + await innerContext.SaveChangesAsync(); - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - }); + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + }); [ConditionalFact] public virtual Task DatabaseGeneratedAttribute_autogenerates_values_when_set_to_identity() - => ExecuteWithStrategyInTransactionAsync( - context => - { - context.Set().Add( - new One - { - RequiredColumn = "Third", - RowVersion = new Guid("00000000-0000-0000-0000-000000000003"), - Details = new Details { Name = "Third Name" }, - AdditionalDetails = new Details { Name = "Third Additional Name" } - }); - - return context.SaveChangesAsync(); - }); + => ExecuteWithStrategyInTransactionAsync(context => + { + context.Set().Add( + new One + { + RequiredColumn = "Third", + RowVersion = new Guid("00000000-0000-0000-0000-000000000003"), + Details = new Details { Name = "Third Name" }, + AdditionalDetails = new Details { Name = "Third Additional Name" } + }); + + return context.SaveChangesAsync(); + }); [ConditionalFact] public virtual async Task MaxLengthAttribute_throws_while_inserting_value_longer_than_max_length() { - await ExecuteWithStrategyInTransactionAsync( - context => - { - context.Set().Add( - new One - { - RequiredColumn = "ValidString", - RowVersion = new Guid("00000000-0000-0000-0000-000000000001"), - MaxLengthProperty = "Short", - Details = new Details { Name = "Third Name" }, - AdditionalDetails = new Details { Name = "Third Additional Name" } - }); - - return context.SaveChangesAsync(); - }); - - await ExecuteWithStrategyInTransactionAsync( - async context => - { - context.Set().Add( - new One - { - RequiredColumn = "ValidString", - RowVersion = new Guid("00000000-0000-0000-0000-000000000002"), - MaxLengthProperty = "VeryVeryVeryVeryVeryVeryLongString", - Details = new Details { Name = "Third Name" }, - AdditionalDetails = new Details { Name = "Third Additional Name" } - }); - - Assert.Equal( - "An error occurred while saving the entity changes. See the inner exception for details.", - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); + await ExecuteWithStrategyInTransactionAsync(context => + { + context.Set().Add( + new One + { + RequiredColumn = "ValidString", + RowVersion = new Guid("00000000-0000-0000-0000-000000000001"), + MaxLengthProperty = "Short", + Details = new Details { Name = "Third Name" }, + AdditionalDetails = new Details { Name = "Third Additional Name" } + }); + + return context.SaveChangesAsync(); + }); + + await ExecuteWithStrategyInTransactionAsync(async context => + { + context.Set().Add( + new One + { + RequiredColumn = "ValidString", + RowVersion = new Guid("00000000-0000-0000-0000-000000000002"), + MaxLengthProperty = "VeryVeryVeryVeryVeryVeryLongString", + Details = new Details { Name = "Third Name" }, + AdditionalDetails = new Details { Name = "Third Additional Name" } + }); + + Assert.Equal( + "An error occurred while saving the entity changes. See the inner exception for details.", + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); } [ConditionalFact] @@ -2344,8 +2315,8 @@ public virtual void Assert.Equal(typeof(Author), secondFk.DeclaringEntityType.ClrType); Assert.Equal("AuthorDetailsIdByAttribute", secondFk.Properties.First().Name); - Assert.Equal(new[] { "Id", "AuthorId" }, authorDetails.GetProperties().Select(p => p.Name)); - Assert.Equal(new[] { "Id", "AuthorDetailsIdByAttribute" }, author.GetProperties().Select(p => p.Name)); + Assert.Equal(["Id", "AuthorId"], authorDetails.GetProperties().Select(p => p.Name)); + Assert.Equal(["Id", "AuthorDetailsIdByAttribute"], author.GetProperties().Select(p => p.Name)); var logEntry = Fixture.ListLoggerFactory.Log.Single(); Assert.Equal(LogLevel.Warning, logEntry.Level); @@ -2459,8 +2430,7 @@ protected class C { public int Id { get; set; } - [ForeignKey("DId")] - [InverseProperty("C")] + [ForeignKey("DId"), InverseProperty("C")] public D D { get; set; } } @@ -2490,15 +2460,14 @@ public virtual void Attribute_set_shadow_FK_name_is_preserved_with_HasPrincipalK { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - m => - { - m.Property("_email"); + modelBuilder.Entity(m => + { + m.Property("_email"); - m.HasMany("_profiles") - .WithOne("User") - .HasPrincipalKey("_email"); - }); + m.HasMany("_profiles") + .WithOne("User") + .HasPrincipalKey("_email"); + }); modelBuilder.Entity().Property("Email"); @@ -2530,115 +2499,107 @@ protected class Profile13694 [ConditionalFact] public virtual async Task RequiredAttribute_for_navigation_throws_while_inserting_null_value() { - await ExecuteWithStrategyInTransactionAsync( - context => - { - context.Set().Add( - new BookDetails { AnotherBookId = 1 }); + await ExecuteWithStrategyInTransactionAsync(context => + { + context.Set().Add( + new BookDetails { AnotherBookId = 1 }); - return context.SaveChangesAsync(); - }); + return context.SaveChangesAsync(); + }); - await ExecuteWithStrategyInTransactionAsync( - async context => - { - context.Set().Add(new BookDetails()); + await ExecuteWithStrategyInTransactionAsync(async context => + { + context.Set().Add(new BookDetails()); - Assert.Equal( - "An error occurred while saving the entity changes. See the inner exception for details.", - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + "An error occurred while saving the entity changes. See the inner exception for details.", + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); } [ConditionalFact] public virtual async Task RequiredAttribute_for_property_throws_while_inserting_null_value() { - await ExecuteWithStrategyInTransactionAsync( - context => - { - context.Set().Add( - new One - { - RequiredColumn = "ValidString", - RowVersion = new Guid("00000000-0000-0000-0000-000000000001"), - Details = new Details { Name = "One" }, - AdditionalDetails = new Details { Name = "Two" } - }); - - return context.SaveChangesAsync(); - }); - - await ExecuteWithStrategyInTransactionAsync( - async context => - { - context.Set().Add( - new One - { - RequiredColumn = null, - RowVersion = new Guid("00000000-0000-0000-0000-000000000002"), - Details = new Details { Name = "One" }, - AdditionalDetails = new Details { Name = "Two" } - }); - - Assert.Equal( - "An error occurred while saving the entity changes. See the inner exception for details.", - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); + await ExecuteWithStrategyInTransactionAsync(context => + { + context.Set().Add( + new One + { + RequiredColumn = "ValidString", + RowVersion = new Guid("00000000-0000-0000-0000-000000000001"), + Details = new Details { Name = "One" }, + AdditionalDetails = new Details { Name = "Two" } + }); + + return context.SaveChangesAsync(); + }); + + await ExecuteWithStrategyInTransactionAsync(async context => + { + context.Set().Add( + new One + { + RequiredColumn = null, + RowVersion = new Guid("00000000-0000-0000-0000-000000000002"), + Details = new Details { Name = "One" }, + AdditionalDetails = new Details { Name = "Two" } + }); + + Assert.Equal( + "An error occurred while saving the entity changes. See the inner exception for details.", + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); } [ConditionalFact] public virtual async Task StringLengthAttribute_throws_while_inserting_value_longer_than_max_length() { - await ExecuteWithStrategyInTransactionAsync( - context => - { - context.Set().Add( - new Two { Data = "ValidString" }); + await ExecuteWithStrategyInTransactionAsync(context => + { + context.Set().Add( + new Two { Data = "ValidString" }); - return context.SaveChangesAsync(); - }); + return context.SaveChangesAsync(); + }); - await ExecuteWithStrategyInTransactionAsync( - async context => - { - context.Set().Add( - new Two { Data = "ValidButLongString" }); + await ExecuteWithStrategyInTransactionAsync(async context => + { + context.Set().Add( + new Two { Data = "ValidButLongString" }); - Assert.Equal( - "An error occurred while saving the entity changes. See the inner exception for details.", - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + "An error occurred while saving the entity changes. See the inner exception for details.", + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); } [ConditionalFact] public virtual Task TimestampAttribute_throws_if_value_in_database_changed() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var clientRow = context.Set().First(r => r.Id == 1); - clientRow.Data = "ChangedData"; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var clientRow = context.Set().First(r => r.Id == 1); + clientRow.Data = "ChangedData"; - using var innerContext = CreateContext(); - UseTransaction(innerContext.Database, context.Database.CurrentTransaction); - var storeRow = innerContext.Set().First(r => r.Id == 1); - storeRow.Data = "ModifiedData"; + using var innerContext = CreateContext(); + UseTransaction(innerContext.Database, context.Database.CurrentTransaction); + var storeRow = innerContext.Set().First(r => r.Id == 1); + storeRow.Data = "ModifiedData"; - innerContext.SaveChanges(); + innerContext.SaveChanges(); - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - }); + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + }); [ConditionalFact] public virtual void UnicodeAttribute_sets_unicode_for_properties_and_fields() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.PersonMiddleName); - b.Property(e => e.PersonAddress); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.PersonMiddleName); + b.Property(e => e.PersonAddress); + }); var model = Validate(modelBuilder); @@ -2671,13 +2632,12 @@ public virtual void PrecisionAttribute_sets_precision_for_properties_and_fields( { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.DecimalField); - b.Property(e => e.DateTimeField); - b.Property(e => e.DateTimeOffsetField); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.DecimalField); + b.Property(e => e.DateTimeField); + b.Property(e => e.DateTimeOffsetField); + }); var model = Validate(modelBuilder); @@ -2814,12 +2774,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con } public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - c => c - .Log(CoreEventId.ConflictingForeignKeyAttributesOnNavigationAndPropertyWarning) - .Log(CoreEventId.ForeignKeyAttributesOnBothNavigationsWarning) - .Log(CoreEventId.ForeignKeyAttributesOnBothPropertiesWarning) - .Log(CoreEventId.ConflictingKeylessAndKeyAttributesWarning)); + => base.AddOptions(builder).ConfigureWarnings(c => c + .Log(CoreEventId.ConflictingForeignKeyAttributesOnNavigationAndPropertyWarning) + .Log(CoreEventId.ForeignKeyAttributesOnBothNavigationsWarning) + .Log(CoreEventId.ForeignKeyAttributesOnBothPropertiesWarning) + .Log(CoreEventId.ConflictingKeylessAndKeyAttributesWarning)); protected override bool ShouldLogCategory(string logCategory) => logCategory == DbLoggerCategory.Model.Name @@ -2872,9 +2831,7 @@ protected abstract class OneBase [Table("Sample")] protected class One : OneBase { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - [Column("Unique_No")] + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity), Column("Unique_No")] public override int UniqueNo { get; set; } [ConcurrencyCheck] @@ -2883,8 +2840,7 @@ protected class One : OneBase [NotMapped] public override string IgnoredProperty { get; set; } - [Required] - [Column("Name")] + [Required, Column("Name")] public override string RequiredColumn { get; set; } [MaxLength(10)] @@ -2942,8 +2898,7 @@ protected class CPSorder public int CPSchargePartnerId { get; set; } - [ForeignKey(nameof(CPSchargePartnerId))] - [InverseProperty(nameof(Partner.CPSorders))] + [ForeignKey(nameof(CPSchargePartnerId)), InverseProperty(nameof(Partner.CPSorders))] public virtual Partner CPSchargePartner { get; set; } } diff --git a/test/EFCore.Specification.Tests/DataBindingTestBase.cs b/test/EFCore.Specification.Tests/DataBindingTestBase.cs index f8732999347..8ed3f0e8352 100644 --- a/test/EFCore.Specification.Tests/DataBindingTestBase.cs +++ b/test/EFCore.Specification.Tests/DataBindingTestBase.cs @@ -70,9 +70,7 @@ protected void SetupContext(F1Context context) }); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void DbSet_Local_contains_Unchanged_Modified_and_Added_entities_but_not_Deleted_entities( bool toObservableCollection) { @@ -91,9 +89,7 @@ public virtual void DbSet_Local_contains_Unchanged_Modified_and_Added_entities_b Assert.Equal(TotalCount, local.Count); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Adding_entity_to_context_is_reflected_in_local_view( bool toObservableCollection) { @@ -117,9 +113,7 @@ public virtual void Adding_entity_to_context_is_reflected_in_local_view( Assert.True(local.Contains(larry)); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Attaching_entity_to_context_is_reflected_in_local_view( bool toObservableCollection) { @@ -143,9 +137,7 @@ public virtual void Attaching_entity_to_context_is_reflected_in_local_view( Assert.True(local.Contains(larry)); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entities_materialized_into_context_are_reflected_in_local_view( bool toObservableCollection) { @@ -162,9 +154,7 @@ public virtual void Entities_materialized_into_context_are_reflected_in_local_vi Assert.Equal(UnchangedCount, local.Count); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entities_detached_from_context_are_removed_from_local_view( bool toObservableCollection) { @@ -187,9 +177,7 @@ public virtual void Entities_detached_from_context_are_removed_from_local_view( Assert.Equal(TotalCount - UnchangedCount, local.Count); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entities_deleted_from_context_are_removed_from_local_view( bool toObservableCollection) { @@ -212,9 +200,7 @@ public virtual void Entities_deleted_from_context_are_removed_from_local_view( Assert.Equal(TotalCount - UnchangedCount, local.Count); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entities_with_state_changed_to_deleted_are_removed_from_local_view( bool toObservableCollection) { @@ -237,9 +223,8 @@ public virtual void Entities_with_state_changed_to_deleted_are_removed_from_loca Assert.Equal(TotalCount - UnchangedCount, local.Count); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] // Issue #35243 + [ConditionalTheory, InlineData(false), InlineData(true)] + // Issue #35243 public virtual void Remove_detached_entity_from_LocalView(bool toObservableCollection) { using var context = CreateF1Context(); @@ -309,9 +294,7 @@ public virtual void Remove_detached_entity_from_LocalView(bool toObservableColle Assert.DoesNotContain(driver3, localView); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entities_with_state_changed_to_detached_are_removed_from_local_view( bool toObservableCollection) { @@ -352,9 +335,7 @@ public virtual void Entities_with_state_changed_to_detached_are_removed_from_loc } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entities_with_state_changed_from_deleted_to_added_are_added_to_local_view( bool toObservableCollection) { @@ -377,9 +358,7 @@ public virtual void Entities_with_state_changed_from_deleted_to_added_are_added_ Assert.Equal(TotalCount + DeletedCount, local.Count); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entities_with_state_changed_from_deleted_to_unchanged_are_added_to_local_view( bool toObservableCollection) { @@ -402,9 +381,7 @@ public virtual void Entities_with_state_changed_from_deleted_to_unchanged_are_ad Assert.Equal(TotalCount + DeletedCount, local.Count); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entities_added_to_local_view_are_added_to_state_manager( bool toObservableCollection) { @@ -434,9 +411,7 @@ public virtual void Entities_added_to_local_view_are_added_to_state_manager( Assert.Contains(larry, localView); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entities_and_owned_children_added_to_local_view_are_added_to_state_manager( bool toObservableCollection) { @@ -475,9 +450,7 @@ public virtual void Entities_and_owned_children_added_to_local_view_are_added_to Assert.Contains(teamCosmos, localView); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entities_removed_from_the_local_view_are_marked_deleted_in_the_state_manager( bool toObservableCollection) { @@ -522,9 +495,7 @@ public virtual void Adding_entity_to_local_view_that_is_already_in_the_state_man Assert.Contains(alonso, local); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Adding_entity_to_local_view_that_is_Deleted_in_the_state_manager_makes_entity_Added( bool toObservableCollection) { @@ -557,9 +528,7 @@ public virtual void Adding_entity_to_local_view_that_is_Deleted_in_the_state_man } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Adding_entity_to_state_manager_of_different_type_than_local_keyless_type_has_no_effect_on_local_view( bool toObservableCollection) { @@ -579,9 +548,7 @@ public virtual void Adding_entity_to_state_manager_of_different_type_than_local_ Assert.Equal(TotalCount, local.Count); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Adding_entity_to_state_manager_of_subtype_still_shows_up_in_local_view( bool toObservableCollection) { @@ -641,9 +608,7 @@ public virtual void Load_executes_query_on_keyless_entity_type() Assert.Equal(UnchangedCount, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public void LocalView_is_initialized_with_entities_from_the_context( bool toObservableCollection) { @@ -972,10 +937,7 @@ public virtual void Entity_added_to_navigation_property_binding_list_is_added_to Assert.Same(larry, context.Drivers.Find(-1)); } - [ConditionalTheory] - [InlineData(CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Never)] public virtual void Entity_removed_from_navigation_property_binding_list_is_removed_from_nav_property_but_not_marked_Deleted( CascadeTiming deleteOrphansTiming) { diff --git a/test/EFCore.Specification.Tests/F1FixtureBase.cs b/test/EFCore.Specification.Tests/F1FixtureBase.cs index cf5f697c7ed..b5bbb962aad 100644 --- a/test/EFCore.Specification.Tests/F1FixtureBase.cs +++ b/test/EFCore.Specification.Tests/F1FixtureBase.cs @@ -17,30 +17,27 @@ protected override bool UsePooling public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) => base.AddOptions(builder) .UseModel(CreateModelExternal()) - .UseSeeding( - (c, _) => + .UseSeeding((c, _) => + { + if (!ShouldSeed((F1Context)c)) { - if (!ShouldSeed((F1Context)c)) - { - return; - } - - F1Context.AddSeedData((F1Context)c); - c.SaveChanges(); - }) - .UseAsyncSeeding( - async (c, _, t) => + return; + } + + F1Context.AddSeedData((F1Context)c); + c.SaveChanges(); + }) + .UseAsyncSeeding(async (c, _, t) => + { + if (!await ShouldSeedAsync((F1Context)c)) { - if (!await ShouldSeedAsync((F1Context)c)) - { - return; - } + return; + } - F1Context.AddSeedData((F1Context)c); - await c.SaveChangesAsync(t); - }) - .ConfigureWarnings( - w => w.Ignore(CoreEventId.SaveChangesStarting, CoreEventId.SaveChangesCompleted)); + F1Context.AddSeedData((F1Context)c); + await c.SaveChangesAsync(t); + }) + .ConfigureWarnings(w => w.Ignore(CoreEventId.SaveChangesStarting, CoreEventId.SaveChangesCompleted)); protected virtual bool ShouldSeed(F1Context context) => context.EngineSuppliers.Count() == 0; @@ -72,139 +69,129 @@ public ModelBuilder CreateModelBuilder() protected virtual void BuildModelExternal(ModelBuilder modelBuilder) { - modelBuilder.Entity( - b => - { - b.HasKey(c => c.TeamId); - ConfigureConstructorBinding(b.Metadata, nameof(Chassis.TeamId), nameof(Chassis.Name)); - }); + modelBuilder.Entity(b => + { + b.HasKey(c => c.TeamId); + ConfigureConstructorBinding(b.Metadata, nameof(Chassis.TeamId), nameof(Chassis.Name)); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.EngineSupplierId).IsConcurrencyToken(); - b.Property(e => e.Name).IsConcurrencyToken(); - b.OwnsOne( - e => e.StorageLocation, lb => - { - lb.Property(l => l.Latitude).IsConcurrencyToken(); - lb.Property(l => l.Longitude).IsConcurrencyToken(); - }); - ConfigureConstructorBinding(b.Metadata, nameof(Engine.Id), nameof(Engine.Name)); - }); - - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Name); - ConfigureConstructorBinding(b.Metadata, nameof(EngineSupplier.Name)); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.EngineSupplierId).IsConcurrencyToken(); + b.Property(e => e.Name).IsConcurrencyToken(); + b.OwnsOne( + e => e.StorageLocation, lb => + { + lb.Property(l => l.Latitude).IsConcurrencyToken(); + lb.Property(l => l.Longitude).IsConcurrencyToken(); + }); + ConfigureConstructorBinding(b.Metadata, nameof(Engine.Id), nameof(Engine.Name)); + }); - modelBuilder.Entity( - b => - { - ConfigureConstructorBinding(b.Metadata, nameof(Gearbox.Id), nameof(Gearbox.Name)); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Name); + ConfigureConstructorBinding(b.Metadata, nameof(EngineSupplier.Name)); + }); - modelBuilder.Entity( - b => - { - b.Property(Sponsor.ClientTokenPropertyName) - .IsConcurrencyToken(); - }); + modelBuilder.Entity(b => + { + ConfigureConstructorBinding(b.Metadata, nameof(Gearbox.Id), nameof(Gearbox.Name)); + }); - modelBuilder.Entity( - b => - { - b.HasOne(e => e.Gearbox).WithOne().HasForeignKey(e => e.GearboxId); - b.HasOne(e => e.Chassis).WithOne(e => e.Team).HasForeignKey(e => e.TeamId); - - b.HasMany(t => t.Sponsors) - .WithMany(s => s.Teams) - .UsingEntity( - ts => ts - .HasOne(t => t.Sponsor) - .WithMany(), - ts => ts - .HasOne(t => t.Team) - .WithMany()) - .HasKey(ts => new { ts.SponsorId, ts.TeamId }); - - ConfigureConstructorBinding( - b.Metadata, - nameof(Team.Id), - nameof(Team.Name), - nameof(Team.Constructor), - nameof(Team.Tire), - nameof(Team.Principal), - nameof(Team.ConstructorsChampionships), - nameof(Team.DriversChampionships), - nameof(Team.Races), - nameof(Team.Victories), - nameof(Team.Poles), - nameof(Team.FastestLaps), - nameof(Team.GearboxId) - ); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - ConfigureConstructorBinding( - b.Metadata, - nameof(Driver.Id), - nameof(Driver.Name), - nameof(Driver.CarNumber), - nameof(Driver.Championships), - nameof(Driver.Races), - nameof(Driver.Wins), - nameof(Driver.Podiums), - nameof(Driver.Poles), - nameof(Driver.FastestLaps), - nameof(Driver.TeamId) - ); - }); - - modelBuilder.Entity( - b => - { - ConfigureConstructorBinding( - b.Metadata, - nameof(Driver.Id), - nameof(Driver.Name), - nameof(Driver.CarNumber), - nameof(Driver.Championships), - nameof(Driver.Races), - nameof(Driver.Wins), - nameof(Driver.Podiums), - nameof(Driver.Poles), - nameof(Driver.FastestLaps), - nameof(Driver.TeamId) - ); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(Sponsor.ClientTokenPropertyName) + .IsConcurrencyToken(); + }); - modelBuilder.Entity( - b => - { - // TODO: Configure as ComplexProperty when optional complex types are supported - // Issue #31376 - b.OwnsOne( - s => s.Details, eb => - { - eb.Property(d => d.Space); - eb.Property("Version").IsRowVersion(); - eb.Property(Sponsor.ClientTokenPropertyName).IsConcurrencyToken(); - }); - ConfigureConstructorBinding(b.Metadata); - }); + modelBuilder.Entity(b => + { + b.HasOne(e => e.Gearbox).WithOne().HasForeignKey(e => e.GearboxId); + b.HasOne(e => e.Chassis).WithOne(e => e.Team).HasForeignKey(e => e.TeamId); + + b.HasMany(t => t.Sponsors) + .WithMany(s => s.Teams) + .UsingEntity( + ts => ts + .HasOne(t => t.Sponsor) + .WithMany(), + ts => ts + .HasOne(t => t.Team) + .WithMany()) + .HasKey(ts => new { ts.SponsorId, ts.TeamId }); + + ConfigureConstructorBinding( + b.Metadata, + nameof(Team.Id), + nameof(Team.Name), + nameof(Team.Constructor), + nameof(Team.Tire), + nameof(Team.Principal), + nameof(Team.ConstructorsChampionships), + nameof(Team.DriversChampionships), + nameof(Team.Races), + nameof(Team.Victories), + nameof(Team.Poles), + nameof(Team.FastestLaps), + nameof(Team.GearboxId) + ); + }); + + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + ConfigureConstructorBinding( + b.Metadata, + nameof(Driver.Id), + nameof(Driver.Name), + nameof(Driver.CarNumber), + nameof(Driver.Championships), + nameof(Driver.Races), + nameof(Driver.Wins), + nameof(Driver.Podiums), + nameof(Driver.Poles), + nameof(Driver.FastestLaps), + nameof(Driver.TeamId) + ); + }); + + modelBuilder.Entity(b => + { + ConfigureConstructorBinding( + b.Metadata, + nameof(Driver.Id), + nameof(Driver.Name), + nameof(Driver.CarNumber), + nameof(Driver.Championships), + nameof(Driver.Races), + nameof(Driver.Wins), + nameof(Driver.Podiums), + nameof(Driver.Poles), + nameof(Driver.FastestLaps), + nameof(Driver.TeamId) + ); + }); + + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + }); + + modelBuilder.Entity(b => + { + // TODO: Configure as ComplexProperty when optional complex types are supported + // Issue #31376 + b.OwnsOne( + s => s.Details, eb => + { + eb.Property(d => d.Space); + eb.Property("Version").IsRowVersion(); + eb.Property(Sponsor.ClientTokenPropertyName).IsConcurrencyToken(); + }); + ConfigureConstructorBinding(b.Metadata); + }); modelBuilder.Entity().Property("Version").IsRowVersion(); modelBuilder.Entity().Property("Version").IsRowVersion(); @@ -213,12 +200,11 @@ protected virtual void BuildModelExternal(ModelBuilder modelBuilder) .ValueGeneratedOnAddOrUpdate() .IsConcurrencyToken(); - modelBuilder.Entity( - eb => - { - eb.Property("Version").IsRowVersion(); - eb.Property(Sponsor.ClientTokenPropertyName); - }); + modelBuilder.Entity(eb => + { + eb.Property("Version").IsRowVersion(); + eb.Property(Sponsor.ClientTokenPropertyName); + }); modelBuilder.Entity(); modelBuilder.Entity(); diff --git a/test/EFCore.Specification.Tests/FieldMappingTestBase.cs b/test/EFCore.Specification.Tests/FieldMappingTestBase.cs index a2c29217e34..5c3ff3ce899 100644 --- a/test/EFCore.Specification.Tests/FieldMappingTestBase.cs +++ b/test/EFCore.Specification.Tests/FieldMappingTestBase.cs @@ -82,27 +82,21 @@ public virtual void Field_mapping_with_conversion_does_not_throw() Assert.Equal(78, newSession.Id); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_auto_props(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_auto_props(bool tracking) { using var context = CreateContext(); AssertGraph(context.Set().Include(e => e.Posts).AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_auto_props(bool tracking) { using var context = CreateContext(); @@ -117,21 +111,15 @@ public virtual void Load_collection_auto_props() public virtual void Load_reference_auto_props() => Load_reference("Blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_auto_props(bool tracking) => Query_with_conditional_constant("BlogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_auto_props(bool tracking) => Query_with_conditional_param("Title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_auto_props(bool tracking) => Projection("Id", "Title", tracking); @@ -139,18 +127,14 @@ public virtual void Projection_auto_props(bool tracking) public virtual Task Update_auto_props() => UpdateAsync("Posts"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_hiding_props(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_hiding_props(bool tracking) { using var context = CreateContext(); @@ -194,9 +178,7 @@ public virtual void Can_define_a_backing_field_for_a_navigation_and_query_and_up } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_hiding_props(bool tracking) { using var context = CreateContext(); @@ -211,21 +193,15 @@ public virtual void Load_collection_hiding_props() public virtual void Load_reference_hiding_props() => Load_reference("Blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_hiding_props(bool tracking) => Query_with_conditional_constant("BlogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_hiding_props(bool tracking) => Query_with_conditional_param("Title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_hiding_props(bool tracking) => Projection("Id", "Title", tracking); @@ -233,27 +209,21 @@ public virtual void Projection_hiding_props(bool tracking) public virtual Task Update_hiding_props() => UpdateAsync("Posts"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_full_props(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_full_props(bool tracking) { using var context = CreateContext(); AssertGraph(context.Set().Include(e => e.Posts).AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_full_props(bool tracking) { using var context = CreateContext(); @@ -268,21 +238,15 @@ public virtual void Load_collection_full_props() public virtual void Load_reference_full_props() => Load_reference("Blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_full_props(bool tracking) => Query_with_conditional_constant("BlogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_full_props(bool tracking) => Query_with_conditional_param("Title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_full_props(bool tracking) => Projection("Id", "Title", tracking); @@ -290,27 +254,21 @@ public virtual void Projection_full_props(bool tracking) public virtual Task Update_full_props() => UpdateAsync("Posts"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_full_props_with_named_fields(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_full_props_with_named_fields(bool tracking) { using var context = CreateContext(); AssertGraph(context.Set().Include(e => e.Posts).AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_full_props_with_named_fields(bool tracking) { using var context = CreateContext(); @@ -325,21 +283,15 @@ public virtual void Load_collection_full_props_with_named_fields() public virtual void Load_reference_full_props_with_named_fields() => Load_reference("Blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_full_props_with_named_fields(bool tracking) => Query_with_conditional_constant("BlogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_full_props_with_named_fields(bool tracking) => Query_with_conditional_param("Title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_full_props_with_named_fields(bool tracking) => Projection("Id", "Title", tracking); @@ -347,27 +299,21 @@ public virtual void Projection_full_props_with_named_fields(bool tracking) public virtual Task Update_full_props_with_named_fields() => UpdateAsync("Posts"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_read_only_props(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_read_only_props(bool tracking) { using var context = CreateContext(); AssertGraph(context.Set().Include(e => e.Posts).AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_read_only_props(bool tracking) { using var context = CreateContext(); @@ -382,21 +328,15 @@ public virtual void Load_collection_read_only_props() public virtual void Load_reference_read_only_props() => Load_reference("Blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_read_only_props(bool tracking) => Query_with_conditional_constant("BlogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_read_only_props(bool tracking) => Query_with_conditional_param("Title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_read_only_props(bool tracking) => Projection("Id", "Title", tracking); @@ -404,27 +344,21 @@ public virtual void Projection_read_only_props(bool tracking) public virtual Task Update_read_only_props() => UpdateAsync("Posts"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_props_with_IReadOnlyCollection(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_props_with_IReadOnlyCollection(bool tracking) { using var context = CreateContext(); AssertGraph(context.Set().Include(e => e.Posts).AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_props_with_IReadOnlyCollection(bool tracking) { using var context = CreateContext(); @@ -439,21 +373,15 @@ public virtual void Load_collection_props_with_IReadOnlyCollection() public virtual void Load_reference_props_with_IReadOnlyCollection() => Load_reference("Blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_props_with_IReadOnlyCollection(bool tracking) => Query_with_conditional_constant("BlogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_props_with_IReadOnlyCollection(bool tracking) => Query_with_conditional_param("Title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_props_with_IReadOnlyCollection(bool tracking) => Projection("Id", "Title", tracking); @@ -461,27 +389,21 @@ public virtual void Projection_props_with_IReadOnlyCollection(bool tracking) public virtual Task Update_props_with_IReadOnlyCollection() => UpdateAsync("Posts"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_read_only_props_with_named_fields(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_read_only_props_with_named_fields(bool tracking) { using var context = CreateContext(); AssertGraph(context.Set().Include(e => e.Posts).AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_read_only_props_with_named_fields(bool tracking) { using var context = CreateContext(); @@ -496,21 +418,15 @@ public virtual void Load_collection_read_only_props_with_named_fields() public virtual void Load_reference_read_only_props_with_named_fields() => Load_reference("Blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_read_only_props_with_named_fields(bool tracking) => Query_with_conditional_constant("BlogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_read_only_props_with_named_fields(bool tracking) => Query_with_conditional_param("Title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_read_only_props_with_named_fields(bool tracking) => Projection("Id", "Title", tracking); @@ -518,27 +434,21 @@ public virtual void Projection_read_only_props_with_named_fields(bool tracking) public virtual Task Update_read_only_props_with_named_fields() => UpdateAsync("Posts"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_write_only_props(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_write_only_props(bool tracking) { using var context = CreateContext(); AssertGraph(context.Set().Include("Posts").AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_write_only_props(bool tracking) { using var context = CreateContext(); @@ -553,21 +463,15 @@ public virtual void Load_collection_write_only_props() public virtual void Load_reference_write_only_props() => Load_reference("Blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_write_only_props(bool tracking) => Query_with_conditional_constant("BlogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_write_only_props(bool tracking) => Query_with_conditional_param("Title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_write_only_props(bool tracking) => Projection("Id", "Title", tracking); @@ -575,27 +479,21 @@ public virtual void Projection_write_only_props(bool tracking) public virtual Task Update_write_only_props() => UpdateAsync("Posts"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_write_only_props_with_named_fields(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_write_only_props_with_named_fields(bool tracking) { using var context = CreateContext(); AssertGraph(context.Set().Include("Posts").AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_write_only_props_with_named_fields(bool tracking) { using var context = CreateContext(); @@ -610,21 +508,15 @@ public virtual void Load_collection_write_only_props_with_named_fields() public virtual void Load_reference_write_only_props_with_named_fields() => Load_reference("Blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_write_only_props_with_named_fields(bool tracking) => Query_with_conditional_constant("BlogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_write_only_props_with_named_fields(bool tracking) => Query_with_conditional_param("Title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_write_only_props_with_named_fields(bool tracking) => Projection("Id", "Title", tracking); @@ -632,27 +524,21 @@ public virtual void Projection_write_only_props_with_named_fields(bool tracking) public virtual Task Update_write_only_props_with_named_fields() => UpdateAsync("Posts"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_fields_only(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_fields_only(bool tracking) { using var context = CreateContext(); AssertGraph(context.Set().Include(e => e.Posts).AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_fields_only(bool tracking) { using var context = CreateContext(); @@ -667,21 +553,15 @@ public virtual void Load_collection_fields_only() public virtual void Load_reference_fields_only() => Load_reference("Blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_fields_only(bool tracking) => Query_with_conditional_constant("_blogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_fields_only(bool tracking) => Query_with_conditional_param("_title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_fields_only(bool tracking) => Projection("_id", "_title", tracking); @@ -689,27 +569,21 @@ public virtual void Projection_fields_only(bool tracking) public virtual Task Update_fields_only() => UpdateAsync("Posts"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Simple_query_fields_only_for_navs_too(bool tracking) { using var context = CreateContext(); AssertBlogs(context.Set().AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_collection_fields_only_for_navs_too(bool tracking) { using var context = CreateContext(); AssertGraph(context.Set().Include("_posts").AsTracking(tracking).ToList()); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Include_reference_fields_only_only_for_navs_too(bool tracking) { using var context = CreateContext(); @@ -724,21 +598,15 @@ public virtual void Load_collection_fields_only_only_for_navs_too() public virtual void Load_reference_fields_only_only_for_navs_too() => Load_reference("_blog"); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_constant_fields_only_only_for_navs_too(bool tracking) => Query_with_conditional_constant("_blogId", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Query_with_conditional_param_fields_only_only_for_navs_too(bool tracking) => Query_with_conditional_param("_title", tracking); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Projection_fields_only_only_for_navs_too(bool tracking) => Projection("_id", "_title", tracking); @@ -809,8 +677,8 @@ protected virtual void Projection(string property1, string property2, boo where TPost : class, IPostAccessor, new() { using var context = CreateContext(); - var posts = context.Set().Select( - p => new { Prop1 = EF.Property(p, property1), Prop2 = EF.Property(p, property2) }).AsTracking(tracking) + var posts = context.Set() + .Select(p => new { Prop1 = EF.Property(p, property1), Prop2 = EF.Property(p, property2) }).AsTracking(tracking) .ToList(); Assert.Equal(4, posts.Count); @@ -1977,21 +1845,19 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasField("_myid"); - b.Property(e => e.Title).HasField("_mytitle"); - b.Property(e => e.BlogId).HasField("_myblogId"); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasField("_myid"); + b.Property(e => e.Title).HasField("_mytitle"); + b.Property(e => e.BlogId).HasField("_myblogId"); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasField("_myid"); - b.Property(e => e.Title).HasField("_mytitle"); - b.HasMany(e => e.Posts).WithOne(e => e.Blog).HasForeignKey(e => e.BlogId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasField("_myid"); + b.Property(e => e.Title).HasField("_mytitle"); + b.HasMany(e => e.Posts).WithOne(e => e.Blog).HasForeignKey(e => e.BlogId); + }); modelBuilder.Entity().Metadata.FindNavigation("Blog").SetField("_myblog"); modelBuilder.Entity().Metadata.FindNavigation("Posts").SetField("_myposts"); @@ -2012,130 +1878,116 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con if (modelBuilder.Model.GetPropertyAccessMode() != PropertyAccessMode.Property) { - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id); - b.Property(e => e.Title); - b.Property(e => e.BlogId); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id); + b.Property(e => e.Title); + b.Property(e => e.BlogId); + }); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id); - b.Property(e => e.Title); - b.HasMany(e => e.Posts).WithOne(e => e.Blog).HasForeignKey(e => e.BlogId); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id); + b.Property(e => e.Title); + b.HasMany(e => e.Posts).WithOne(e => e.Blog).HasForeignKey(e => e.BlogId); + }); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id); - b.Property(e => e.Title); - b.Property(e => e.BlogId); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id); + b.Property(e => e.Title); + b.Property(e => e.BlogId); + }); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id); - b.Property(e => e.Title); - b.HasMany(e => e.Posts).WithOne(e => e.Blog).HasForeignKey(e => e.BlogId); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id); + b.Property(e => e.Title); + b.HasMany(e => e.Posts).WithOne(e => e.Blog).HasForeignKey(e => e.BlogId); + }); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id); - b.Property(e => e.Id).HasField("_myid"); - b.Property(e => e.Title).HasField("_mytitle"); - b.Property(e => e.BlogId).HasField("_myblogId"); - }); - - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id); - b.Property(e => e.Id).HasField("_myid"); - b.Property(e => e.Title).HasField("_mytitle"); - b.HasMany(e => e.Posts).WithOne(e => e.Blog).HasForeignKey(e => e.BlogId); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id); + b.Property(e => e.Id).HasField("_myid"); + b.Property(e => e.Title).HasField("_mytitle"); + b.Property(e => e.BlogId).HasField("_myblogId"); + }); + + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id); + b.Property(e => e.Id).HasField("_myid"); + b.Property(e => e.Title).HasField("_mytitle"); + b.HasMany(e => e.Posts).WithOne(e => e.Blog).HasForeignKey(e => e.BlogId); + }); modelBuilder.Entity().Metadata.FindNavigation("Blog").SetField("_myblog"); modelBuilder.Entity().Metadata.FindNavigation("Posts").SetField("_myposts"); - modelBuilder.Entity( - b => - { - b.Property("Title"); - b.Property("BlogId"); - }); + modelBuilder.Entity(b => + { + b.Property("Title"); + b.Property("BlogId"); + }); - modelBuilder.Entity( - b => - { - b.HasKey("Id"); - b.Property("Title"); - b.HasMany(typeof(PostWriteOnly).DisplayName(), "Posts").WithOne("Blog").HasForeignKey("BlogId"); - }); + modelBuilder.Entity(b => + { + b.HasKey("Id"); + b.Property("Title"); + b.HasMany(typeof(PostWriteOnly).DisplayName(), "Posts").WithOne("Blog").HasForeignKey("BlogId"); + }); - modelBuilder.Entity( - b => - { - b.HasKey("Id"); - b.Property("Id").HasField("_myid"); - b.Property("Title").HasField("_mytitle"); - b.Property("BlogId").HasField("_myblogId"); - }); - - modelBuilder.Entity( - b => - { - b.HasKey("Id"); - b.Property("Id").HasField("_myid"); - b.Property("Title").HasField("_mytitle"); - b.HasMany(typeof(PostWriteOnlyExplicit).DisplayName(), "Posts").WithOne("Blog").HasForeignKey("BlogId"); - }); + modelBuilder.Entity(b => + { + b.HasKey("Id"); + b.Property("Id").HasField("_myid"); + b.Property("Title").HasField("_mytitle"); + b.Property("BlogId").HasField("_myblogId"); + }); + + modelBuilder.Entity(b => + { + b.HasKey("Id"); + b.Property("Id").HasField("_myid"); + b.Property("Title").HasField("_mytitle"); + b.HasMany(typeof(PostWriteOnlyExplicit).DisplayName(), "Posts").WithOne("Blog").HasForeignKey("BlogId"); + }); modelBuilder.Entity().Metadata.FindNavigation("Blog").SetField("_myblog"); modelBuilder.Entity().Metadata.FindNavigation("Posts").SetField("_myposts"); - modelBuilder.Entity( - b => - { - b.Property("_id"); - b.HasKey("_id"); - b.Property("_title"); - b.Property("_blogId"); - }); - - modelBuilder.Entity( - b => - { - b.Property("_id"); - b.HasKey("_id"); - b.Property("_title"); - b.HasMany(e => e.Posts).WithOne(e => e.Blog).HasForeignKey("_blogId"); - }); - - modelBuilder.Entity( - b => - { - b.Property("_id"); - b.HasKey("_id"); - b.Property("_title"); - b.Property("_blogId"); - }); - - modelBuilder.Entity( - b => - { - b.Property("_id"); - b.HasKey("_id"); - b.Property("_title"); - b.HasMany(typeof(PostNavFields), "_posts").WithOne("_blog").HasForeignKey("_blogId"); - }); + modelBuilder.Entity(b => + { + b.Property("_id"); + b.HasKey("_id"); + b.Property("_title"); + b.Property("_blogId"); + }); + + modelBuilder.Entity(b => + { + b.Property("_id"); + b.HasKey("_id"); + b.Property("_title"); + b.HasMany(e => e.Posts).WithOne(e => e.Blog).HasForeignKey("_blogId"); + }); + + modelBuilder.Entity(b => + { + b.Property("_id"); + b.HasKey("_id"); + b.Property("_title"); + b.Property("_blogId"); + }); + + modelBuilder.Entity(b => + { + b.Property("_id"); + b.HasKey("_id"); + b.Property("_title"); + b.HasMany(typeof(PostNavFields), "_posts").WithOne("_blog").HasForeignKey("_blogId"); + }); } } diff --git a/test/EFCore.Specification.Tests/FieldsOnlyLoadTestBase.cs b/test/EFCore.Specification.Tests/FieldsOnlyLoadTestBase.cs index c008da92abc..afb11fc7229 100644 --- a/test/EFCore.Specification.Tests/FieldsOnlyLoadTestBase.cs +++ b/test/EFCore.Specification.Tests/FieldsOnlyLoadTestBase.cs @@ -13,10 +13,7 @@ public abstract class FieldsOnlyLoadTestBase(TFixture fixture) : IClas { protected TFixture Fixture { get; } = fixture; - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Added)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Modified), InlineData(EntityState.Added)] public virtual void Attached_references_to_principal_are_marked_as_loaded(EntityState state) { using var context = CreateContext(); @@ -54,10 +51,7 @@ public virtual void Attached_references_to_principal_are_marked_as_loaded(Entity Assert.True(context.Entry(parent).Reference(e => e.SingleCompositeKey).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Added)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Modified), InlineData(EntityState.Added)] public virtual void Attached_references_to_dependents_are_marked_as_loaded(EntityState state) { using var context = CreateContext(); @@ -95,10 +89,7 @@ public virtual void Attached_references_to_dependents_are_marked_as_loaded(Entit Assert.True(context.Entry(parent.SingleCompositeKey).Reference(e => e.Parent).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Added)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Modified), InlineData(EntityState.Added)] public virtual void Attached_collections_are_not_marked_as_loaded(EntityState state) { using var context = CreateContext(); @@ -137,25 +128,24 @@ public virtual void Attached_collections_are_not_marked_as_loaded(EntityState st Assert.False(context.Entry(parent).Collection(e => e.ChildrenCompositeKey).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] public virtual async Task Load_collection(EntityState state, QueryTrackingBehavior queryTrackingBehavior, bool async) { using var context = CreateContext(); @@ -192,13 +182,9 @@ public virtual async Task Load_collection(EntityState state, QueryTrackingBehavi Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal(EntityState state, bool async) { using var context = CreateContext(); @@ -241,13 +227,9 @@ public virtual async Task Load_many_to_one_reference_to_principal(EntityState st } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal(EntityState state, bool async) { using var context = CreateContext(); @@ -290,13 +272,9 @@ public virtual async Task Load_one_to_one_reference_to_principal(EntityState sta } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_when_NoTracking_behavior(EntityState state, bool async) { using var context = CreateContext(); @@ -341,13 +319,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_when_NoTracking } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent(EntityState state, bool async) { using var context = CreateContext(); @@ -382,13 +356,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent(EntityState sta Assert.Same(parent, single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal(EntityState state, bool async) { using var context = CreateContext(); @@ -431,13 +401,9 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal(Entity } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent(EntityState state, bool async) { using var context = CreateContext(); @@ -472,13 +438,9 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent(Entity Assert.Same(parent, single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -508,13 +470,9 @@ public virtual async Task Load_collection_using_Query(EntityState state, bool as Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -552,13 +510,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query(En Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -596,13 +550,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query(Ent Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -631,13 +581,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query(Ent Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -675,13 +621,9 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_using_ Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -710,13 +652,9 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_using_ Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_null_FK(EntityState state, bool async) { using var context = CreateContext(); @@ -748,13 +686,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_null_FK(Entity Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_null_FK(EntityState state, bool async) { using var context = CreateContext(); @@ -787,13 +721,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_null_FK(EntityS Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_null_FK(EntityState state, bool async) { using var context = CreateContext(); @@ -822,13 +752,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_nu Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_null_FK(EntityState state, bool async) { using var context = CreateContext(); @@ -857,13 +783,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_nul Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -895,13 +817,9 @@ public virtual async Task Load_collection_not_found(EntityState state, bool asyn Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -933,13 +851,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_not_found(Enti Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -972,13 +886,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_not_found(Entit Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1011,13 +921,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_not_found(Entit Assert.Null(parent.Single); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1046,13 +952,9 @@ public virtual async Task Load_collection_using_Query_not_found(EntityState stat Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1081,13 +983,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_no Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1116,13 +1014,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_not Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1151,19 +1045,15 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_not Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_already_loaded(EntityState state, bool async, CascadeTiming deleteOrphansTiming) { using var context = CreateContext(); @@ -1207,13 +1097,9 @@ public virtual async Task Load_collection_already_loaded(EntityState state, bool Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1248,19 +1134,15 @@ public virtual async Task Load_many_to_one_reference_to_principal_already_loaded Assert.Same(child, parent.Children.Single()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_one_to_one_reference_to_principal_already_loaded( EntityState state, bool async, @@ -1300,19 +1182,15 @@ public virtual async Task Load_one_to_one_reference_to_principal_already_loaded( Assert.Same(single, parent.Single); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_one_to_one_reference_to_dependent_already_loaded( EntityState state, bool async, @@ -1361,13 +1239,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_already_loaded( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1402,13 +1276,9 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_alread Assert.Same(single, parent.SinglePkToPk); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1443,19 +1313,15 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_alread Assert.Same(parent, single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_using_Query_already_loaded( EntityState state, bool async, @@ -1490,13 +1356,9 @@ public virtual async Task Load_collection_using_Query_already_loaded( Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1525,13 +1387,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_al Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1560,19 +1418,15 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_alr Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_already_loaded( EntityState state, bool async, @@ -1606,13 +1460,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_alr Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_using_Query_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1641,13 +1491,9 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_using_ Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_using_Query_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1676,13 +1522,9 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_using_ Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -1715,13 +1557,9 @@ public virtual async Task Load_collection_untyped(EntityState state, bool async) Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -1764,13 +1602,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_untyped(Entity } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -1813,13 +1647,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_untyped(EntityS } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -1854,13 +1684,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_untyped(EntityS Assert.Same(parent, single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -1891,13 +1717,9 @@ public virtual async Task Load_collection_using_Query_untyped(EntityState state, Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -1936,13 +1758,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_un Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -1981,13 +1799,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_unt Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2017,13 +1831,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_unt Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2055,13 +1865,9 @@ public virtual async Task Load_collection_not_found_untyped(EntityState state, b Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2093,13 +1899,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_not_found_unty Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2132,13 +1934,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_not_found_untyp Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2171,13 +1969,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_not_found_untyp Assert.Null(parent.Single); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2207,13 +2001,9 @@ public virtual async Task Load_collection_using_Query_not_found_untyped(EntitySt Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2243,13 +2033,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_no Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2279,13 +2065,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_not Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2315,19 +2097,15 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_not Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_already_loaded_untyped(EntityState state, bool async, CascadeTiming deleteOrphansTiming) { using var context = CreateContext(); @@ -2371,13 +2149,9 @@ public virtual async Task Load_collection_already_loaded_untyped(EntityState sta Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_already_loaded_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2412,13 +2186,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_already_loaded Assert.Same(child, parent.Children.Single()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_already_loaded_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2453,19 +2223,15 @@ public virtual async Task Load_one_to_one_reference_to_principal_already_loaded_ Assert.Same(single, parent.Single); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_one_to_one_reference_to_dependent_already_loaded_untyped( EntityState state, bool async, @@ -2514,19 +2280,15 @@ public virtual async Task Load_one_to_one_reference_to_dependent_already_loaded_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_using_Query_already_loaded_untyped( EntityState state, bool async, @@ -2562,13 +2324,9 @@ public virtual async Task Load_collection_using_Query_already_loaded_untyped( Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_already_loaded_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2598,13 +2356,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_al Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_already_loaded_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2634,19 +2388,15 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_alr Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_already_loaded_untyped( EntityState state, bool async, @@ -2683,13 +2433,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_alr Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -2722,13 +2468,9 @@ public virtual async Task Load_collection_alternate_key(EntityState state, bool Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -2771,13 +2513,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_alternate_key( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -2820,13 +2558,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_alternate_key(E } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -2861,13 +2595,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_alternate_key(E Assert.Same(parent, single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -2897,13 +2627,9 @@ public virtual async Task Load_collection_using_Query_alternate_key(EntityState Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -2941,13 +2667,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_al Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -2985,13 +2707,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_alt Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3020,13 +2738,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_alt Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_null_FK_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3058,13 +2772,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_null_FK_altern Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_null_FK_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3097,13 +2807,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_null_FK_alterna Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_null_FK_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3132,13 +2838,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_nu Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_null_FK_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3167,13 +2869,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_nul Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3206,13 +2904,9 @@ public virtual async Task Load_collection_shadow_fk(EntityState state, bool asyn Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3255,13 +2949,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_shadow_fk(Enti } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3304,13 +2994,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_shadow_fk(Entit } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3345,13 +3031,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_shadow_fk(Entit Assert.Same(parent, single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3381,13 +3063,9 @@ public virtual async Task Load_collection_using_Query_shadow_fk(EntityState stat Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3425,13 +3103,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_sh Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3469,13 +3143,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_sha Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3504,13 +3174,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_sha Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_null_FK_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3542,13 +3208,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_null_FK_shadow Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_null_FK_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3581,13 +3243,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_null_FK_shadow_ Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_null_FK_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3616,13 +3274,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_nu Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_null_FK_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3651,13 +3305,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_nul Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3690,13 +3340,9 @@ public virtual async Task Load_collection_composite_key(EntityState state, bool Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3739,13 +3385,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_composite_key( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3788,13 +3430,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_composite_key(E } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3829,13 +3467,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_composite_key(E Assert.Same(parent, single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3865,13 +3499,9 @@ public virtual async Task Load_collection_using_Query_composite_key(EntityState Assert.Equal(3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3909,13 +3539,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_co Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3953,13 +3579,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_com Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3988,13 +3610,9 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_com Assert.Equal(2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_null_FK_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4026,13 +3644,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_null_FK_compos Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_null_FK_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4065,13 +3679,9 @@ public virtual async Task Load_one_to_one_reference_to_principal_null_FK_composi Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_null_FK_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4100,13 +3710,9 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_nu Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_null_FK_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4200,15 +3806,11 @@ public virtual void Can_change_IsLoaded_flag_for_reference_only_if_null() Assert.True(referenceEntry.IsLoaded); Assert.Equal( - CoreStrings.ReferenceMustBeLoaded("Parent", typeof(Child).Name), + CoreStrings.ReferenceMustBeLoaded("Parent", nameof(Child)), Assert.Throws(() => referenceEntry.IsLoaded = false).Message); } - [ConditionalTheory] - [InlineData(true, false)] - [InlineData(false, false)] - [InlineData(true, true)] - [InlineData(false, true)] + [ConditionalTheory, InlineData(true, false), InlineData(false, false), InlineData(true, true), InlineData(false, true)] public virtual async Task Load_collection_for_detached_throws(bool async, bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4231,11 +3833,7 @@ public virtual async Task Load_collection_for_detached_throws(bool async, bool n } } - [ConditionalTheory] - [InlineData(true, false)] - [InlineData(false, false)] - [InlineData(true, true)] - [InlineData(false, true)] + [ConditionalTheory, InlineData(true, false), InlineData(false, false), InlineData(true, true), InlineData(false, true)] public virtual async Task Load_collection_using_string_for_detached_throws(bool async, bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4258,11 +3856,7 @@ public virtual async Task Load_collection_using_string_for_detached_throws(bool } } - [ConditionalTheory] - [InlineData(true, false)] - [InlineData(false, false)] - [InlineData(true, true)] - [InlineData(false, true)] + [ConditionalTheory, InlineData(true, false), InlineData(false, false), InlineData(true, true), InlineData(false, true)] public virtual async Task Load_collection_with_navigation_for_detached_throws(bool async, bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4285,11 +3879,7 @@ public virtual async Task Load_collection_with_navigation_for_detached_throws(bo } } - [ConditionalTheory] - [InlineData(true, false)] - [InlineData(false, false)] - [InlineData(true, true)] - [InlineData(false, true)] + [ConditionalTheory, InlineData(true, false), InlineData(false, false), InlineData(true, true), InlineData(false, true)] public virtual async Task Load_reference_to_principal_for_detached_throws(bool async, bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4312,11 +3902,7 @@ public virtual async Task Load_reference_to_principal_for_detached_throws(bool a } } - [ConditionalTheory] - [InlineData(true, false)] - [InlineData(false, false)] - [InlineData(true, true)] - [InlineData(false, true)] + [ConditionalTheory, InlineData(true, false), InlineData(false, false), InlineData(true, true), InlineData(false, true)] public virtual async Task Load_reference_with_navigation_to_principal_for_detached_throws(bool async, bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4339,11 +3925,7 @@ public virtual async Task Load_reference_with_navigation_to_principal_for_detach } } - [ConditionalTheory] - [InlineData(true, false)] - [InlineData(false, false)] - [InlineData(true, true)] - [InlineData(false, true)] + [ConditionalTheory, InlineData(true, false), InlineData(false, false), InlineData(true, true), InlineData(false, true)] public virtual async Task Load_reference_using_string_to_principal_for_detached_throws(bool async, bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4366,11 +3948,7 @@ public virtual async Task Load_reference_using_string_to_principal_for_detached_ } } - [ConditionalTheory] - [InlineData(true, false)] - [InlineData(false, false)] - [InlineData(true, true)] - [InlineData(false, true)] + [ConditionalTheory, InlineData(true, false), InlineData(false, false), InlineData(true, true), InlineData(false, true)] public virtual async Task Load_reference_to_dependent_for_detached_throws(bool async, bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4393,11 +3971,7 @@ public virtual async Task Load_reference_to_dependent_for_detached_throws(bool a } } - [ConditionalTheory] - [InlineData(true, false)] - [InlineData(false, false)] - [InlineData(true, true)] - [InlineData(false, true)] + [ConditionalTheory, InlineData(true, false), InlineData(false, false), InlineData(true, true), InlineData(false, true)] public virtual async Task Load_reference_to_dependent_with_navigation_for_detached_throws(bool async, bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4420,11 +3994,7 @@ public virtual async Task Load_reference_to_dependent_with_navigation_for_detach } } - [ConditionalTheory] - [InlineData(true, false)] - [InlineData(false, false)] - [InlineData(true, true)] - [InlineData(false, true)] + [ConditionalTheory, InlineData(true, false), InlineData(false, false), InlineData(true, true), InlineData(false, true)] public virtual async Task Load_reference_to_dependent_using_string_for_detached_throws(bool async, bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4447,9 +4017,7 @@ public virtual async Task Load_reference_to_dependent_using_string_for_detached_ } } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual void Query_collection_for_detached_throws(bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4465,9 +4033,7 @@ public virtual void Query_collection_for_detached_throws(bool noTracking) var query = collectionEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual void Query_collection_using_string_for_detached_throws(bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4483,9 +4049,7 @@ public virtual void Query_collection_using_string_for_detached_throws(bool noTra var query = collectionEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual void Query_collection_with_navigation_for_detached_throws(bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4501,9 +4065,7 @@ public virtual void Query_collection_with_navigation_for_detached_throws(bool no var query = collectionEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual void Query_reference_to_principal_for_detached_throws(bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4519,9 +4081,7 @@ public virtual void Query_reference_to_principal_for_detached_throws(bool noTrac var query = referenceEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual void Query_reference_with_navigation_to_principal_for_detached_throws(bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4537,9 +4097,7 @@ public virtual void Query_reference_with_navigation_to_principal_for_detached_th var query = referenceEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual void Query_reference_using_string_to_principal_for_detached_throws(bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4555,9 +4113,7 @@ public virtual void Query_reference_using_string_to_principal_for_detached_throw var query = referenceEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual void Query_reference_to_dependent_for_detached_throws(bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4573,9 +4129,7 @@ public virtual void Query_reference_to_dependent_for_detached_throws(bool noTrac var query = referenceEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual void Query_reference_to_dependent_with_navigation_for_detached_throws(bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4591,9 +4145,7 @@ public virtual void Query_reference_to_dependent_with_navigation_for_detached_th var query = referenceEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual void Query_reference_to_dependent_using_string_for_detached_throws(bool noTracking) { using var context = CreateContext(noTracking: noTracking); @@ -4733,113 +4285,99 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity() .Property("ParentId"); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.AlternateId).ValueGeneratedOnAdd(); - - b.HasMany(nameof(Parent.Children)) - .WithOne(nameof(Child.Parent)) - .HasForeignKey(e => e.ParentId); - - b.HasOne(nameof(Parent.SinglePkToPk)) - .WithOne(nameof(SinglePkToPk.Parent)) - .HasForeignKey(e => e.Id) - .IsRequired(); - - b.HasOne(nameof(Parent.Single)) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - - b.HasMany(nameof(Parent.ChildrenAk)) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId); - - b.HasOne(nameof(Parent.SingleAk)) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId); - - b.HasMany(e => e.ChildrenShadowFk) - .WithOne(nameof(ChildShadowFk.Parent)) - .HasPrincipalKey(e => e.Id) - .HasForeignKey("ParentId"); - - b.HasOne(nameof(Parent.SingleShadowFk)) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.Id) - .HasForeignKey("ParentId"); - - b.HasMany(e => e.ChildrenCompositeKey) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.AlternateId, e.Id }) - .HasForeignKey( - e => new { e.ParentAlternateId, e.ParentId }); - - b.HasOne(nameof(Parent.SingleCompositeKey)) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.AlternateId, e.Id }) - .HasForeignKey( - e => new { e.ParentAlternateId, e.ParentId }); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.AlternateId).ValueGeneratedOnAdd(); + + b.HasMany(nameof(Parent.Children)) + .WithOne(nameof(Child.Parent)) + .HasForeignKey(e => e.ParentId); + + b.HasOne(nameof(Parent.SinglePkToPk)) + .WithOne(nameof(SinglePkToPk.Parent)) + .HasForeignKey(e => e.Id) + .IsRequired(); + + b.HasOne(nameof(Parent.Single)) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + + b.HasMany(nameof(Parent.ChildrenAk)) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId); + + b.HasOne(nameof(Parent.SingleAk)) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId); + + b.HasMany(e => e.ChildrenShadowFk) + .WithOne(nameof(ChildShadowFk.Parent)) + .HasPrincipalKey(e => e.Id) + .HasForeignKey("ParentId"); + + b.HasOne(nameof(Parent.SingleShadowFk)) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.Id) + .HasForeignKey("ParentId"); + + b.HasMany(e => e.ChildrenCompositeKey) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.AlternateId, e.Id }) + .HasForeignKey(e => new { e.ParentAlternateId, e.ParentId }); + + b.HasOne(nameof(Parent.SingleCompositeKey)) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.AlternateId, e.Id }) + .HasForeignKey(e => new { e.ParentAlternateId, e.ParentId }); + }); + + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + }); } protected override Task SeedAsync(PoolableDbContext context) diff --git a/test/EFCore.Specification.Tests/FindTestBase.cs b/test/EFCore.Specification.Tests/FindTestBase.cs index d12e516facd..a4ce51de2e6 100644 --- a/test/EFCore.Specification.Tests/FindTestBase.cs +++ b/test/EFCore.Specification.Tests/FindTestBase.cs @@ -308,10 +308,8 @@ public virtual void Throws_for_bad_entity_type_with_different_namespace() Assert.Throws(() => Finder.Find(context, 77)).Message); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_int_key_tracked_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -324,10 +322,8 @@ public virtual async Task Find_int_key_tracked_async(CancellationType cancellati Assert.Same(entity, await valueTask); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_int_key_from_store_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -345,20 +341,16 @@ public virtual async Task Find_int_key_from_store_async(CancellationType cancell Assert.Contains("72", entity.OwnedReference.NestedOwnedCollection.Select(e => e.Prop)); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Returns_null_for_int_key_not_in_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, [99])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_nullable_int_key_tracked_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -368,30 +360,24 @@ public virtual async Task Find_nullable_int_key_tracked_async(CancellationType c Assert.Same(entity, await Finder.FindAsync(cancellationType, context, [88])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_nullable_int_key_from_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Equal("Smokey", (await Finder.FindAsync(cancellationType, context, [77])).Foo); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Returns_null_for_nullable_int_key_not_in_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, [99])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_string_key_tracked_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -401,30 +387,24 @@ public virtual async Task Find_string_key_tracked_async(CancellationType cancell Assert.Same(entity, await Finder.FindAsync(cancellationType, context, ["Rabbit"])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_string_key_from_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Equal("Alice", (await Finder.FindAsync(cancellationType, context, ["Cat"])).Foo); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Returns_null_for_string_key_not_in_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, ["Fox"])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_composite_key_tracked_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -434,30 +414,24 @@ public virtual async Task Find_composite_key_tracked_async(CancellationType canc Assert.Same(entity, await Finder.FindAsync(cancellationType, context, [88, "Rabbit"])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_composite_key_from_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Equal("Olive", (await Finder.FindAsync(cancellationType, context, [77, "Dog"])).Foo); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Returns_null_for_composite_key_not_in_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, [77, "Fox"])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_base_type_tracked_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -467,30 +441,24 @@ public virtual async Task Find_base_type_tracked_async(CancellationType cancella Assert.Same(entity, await Finder.FindAsync(cancellationType, context, [88])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_base_type_from_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Equal("Baxter", (await Finder.FindAsync(cancellationType, context, [77])).Foo); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Returns_null_for_base_type_not_in_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, [99])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_derived_type_tracked_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -500,10 +468,8 @@ public virtual async Task Find_derived_type_tracked_async(CancellationType cance Assert.Same(entity, await Finder.FindAsync(cancellationType, context, [88])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_derived_type_from_store_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -512,20 +478,16 @@ public virtual async Task Find_derived_type_from_store_async(CancellationType ca Assert.Equal("Cheesecake", derivedType.Boo); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Returns_null_for_derived_type_not_in_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, [99])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_base_type_using_derived_set_tracked_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -535,20 +497,16 @@ public virtual async Task Find_base_type_using_derived_set_tracked_async(Cancell Assert.Null(await Finder.FindAsync(cancellationType, context, [88])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_base_type_using_derived_set_from_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, [77])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_derived_type_using_base_set_tracked_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -558,10 +516,8 @@ public virtual async Task Find_derived_type_using_base_set_tracked_async(Cancell Assert.Same(entity, await Finder.FindAsync(cancellationType, context, [88])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_derived_using_base_set_type_from_store_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -570,10 +526,8 @@ public virtual async Task Find_derived_using_base_set_type_from_store_async(Canc Assert.Equal("Cheesecake", ((DerivedType)derivedType).Boo); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_shadow_key_tracked_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -584,73 +538,59 @@ public virtual async Task Find_shadow_key_tracked_async(CancellationType cancell Assert.Same(entry.Entity, await Finder.FindAsync(cancellationType, context, [88])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Find_shadow_key_from_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Equal("Clippy", (await Finder.FindAsync(cancellationType, context, [77])).Foo); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Returns_null_for_shadow_key_not_in_store_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, [99])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Returns_null_for_null_key_values_array_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, null)); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Returns_null_for_null_key_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, [null])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Returns_null_for_null_in_composite_key_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Null(await Finder.FindAsync(cancellationType, context, [77, null])); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Throws_for_multiple_values_passed_for_simple_key_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Equal( CoreStrings.FindNotCompositeKey("IntKey", cancellationType == CancellationType.Wrong ? 3 : 2), - (await Assert.ThrowsAsync( - () => Finder.FindAsync(cancellationType, context, [77, 88]).AsTask())).Message); + (await Assert.ThrowsAsync(() => Finder.FindAsync(cancellationType, context, [77, 88]).AsTask())) + .Message); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Throws_for_wrong_number_of_values_for_composite_key_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -658,53 +598,45 @@ public virtual async Task Throws_for_wrong_number_of_values_for_composite_key_as cancellationType == CancellationType.Wrong ? CoreStrings.FindValueTypeMismatch(1, "CompositeKey", "CancellationToken", "string") : CoreStrings.FindValueCountMismatch("CompositeKey", 2, 1), - (await Assert.ThrowsAsync( - () => Finder.FindAsync(cancellationType, context, [77]).AsTask())).Message); + (await Assert.ThrowsAsync(() + => Finder.FindAsync(cancellationType, context, [77]).AsTask())).Message); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Throws_for_bad_type_for_simple_key_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Equal( CoreStrings.FindValueTypeMismatch(0, "IntKey", "string", "int"), - (await Assert.ThrowsAsync( - () => Finder.FindAsync(cancellationType, context, ["77"]).AsTask())).Message); + (await Assert.ThrowsAsync(() => Finder.FindAsync(cancellationType, context, ["77"]).AsTask())) + .Message); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Throws_for_bad_type_for_composite_key_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Equal( CoreStrings.FindValueTypeMismatch(1, "CompositeKey", "int", "string"), - (await Assert.ThrowsAsync( - () => Finder.FindAsync(cancellationType, context, [77, 78]).AsTask())).Message); + (await Assert.ThrowsAsync(() + => Finder.FindAsync(cancellationType, context, [77, 78]).AsTask())).Message); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Throws_for_bad_entity_type_async(CancellationType cancellationType) { using var context = CreateContext(); Assert.Equal( CoreStrings.InvalidSetType(nameof(Random)), - (await Assert.ThrowsAsync( - () => Finder.FindAsync(cancellationType, context, [77]).AsTask())).Message); + (await Assert.ThrowsAsync(() + => Finder.FindAsync(cancellationType, context, [77]).AsTask())).Message); } - [ConditionalTheory] - [InlineData((int)CancellationType.Right)] - [InlineData((int)CancellationType.Wrong)] - [InlineData((int)CancellationType.None)] + [ConditionalTheory, InlineData((int)CancellationType.Right), InlineData((int)CancellationType.Wrong), + InlineData((int)CancellationType.None)] public virtual async Task Throws_for_bad_entity_type_with_different_namespace_async(CancellationType cancellationType) { using var context = CreateContext(); @@ -712,8 +644,8 @@ public virtual async Task Throws_for_bad_entity_type_with_different_namespace_as Assert.Equal( CoreStrings.InvalidSetSameTypeWithDifferentNamespace( typeof(DifferentNamespace.ShadowKey).DisplayName(), typeof(ShadowKey).DisplayName()), - (await Assert.ThrowsAsync( - () => Finder.FindAsync(cancellationType, context, [77]).AsTask())) + (await Assert.ThrowsAsync(() + => Finder.FindAsync(cancellationType, context, [77]).AsTask())) .Message); } @@ -803,8 +735,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity().HasKey( - e => new { e.Id1, e.Id2 }); + modelBuilder.Entity().HasKey(e => new { e.Id1, e.Id2 }); modelBuilder.Entity(); modelBuilder.Entity(); modelBuilder.Entity().Property(typeof(int), "Id").ValueGeneratedNever(); @@ -821,9 +752,9 @@ protected override Task SeedAsync(PoolableDbContext context) { Prop = 7, NestedOwned = new Owned2 { Prop = "7" }, - NestedOwnedCollection = new List { new() { Prop = "71" }, new() { Prop = "72" } } + NestedOwnedCollection = [new() { Prop = "71" }, new() { Prop = "72" }] }, - OwnedCollection = new List { new Owned1 { Prop = 71 }, new Owned1 { Prop = 72 } } + OwnedCollection = [new() { Prop = 71 }, new() { Prop = 72 }] }, new NullableIntKey { Id = 77, Foo = "Smokey" }, new StringKey { Id = "Cat", Foo = "Alice" }, @@ -877,7 +808,7 @@ public override ValueTask FindAsync( { CancellationType.Right => context.Set().FindAsync(keyValues, cancellationToken: cancellationToken), CancellationType.Wrong => context.Set() - .FindAsync(keyValues?.Concat(new object[] { cancellationToken }).ToArray()), + .FindAsync(keyValues?.Concat([cancellationToken]).ToArray()), CancellationType.None => context.Set().FindAsync(keyValues), _ => throw new ArgumentOutOfRangeException(nameof(cancellationType), cancellationType, null) }; @@ -898,7 +829,7 @@ public override async ValueTask FindAsync( CancellationType.Right => (TEntity)await context.FindAsync( typeof(TEntity), keyValues, cancellationToken: cancellationToken), CancellationType.Wrong => (TEntity)await context.FindAsync( - typeof(TEntity), keyValues?.Concat(new object[] { cancellationToken }).ToArray()), + typeof(TEntity), keyValues?.Concat([cancellationToken]).ToArray()), CancellationType.None => (TEntity)await context.FindAsync(typeof(TEntity), keyValues), _ => throw new ArgumentOutOfRangeException(nameof(cancellationType), cancellationType, null) }; @@ -918,7 +849,7 @@ public override ValueTask FindAsync( { CancellationType.Right => context.FindAsync(keyValues, cancellationToken: cancellationToken), CancellationType.Wrong => context.FindAsync( - keyValues?.Concat(new object[] { cancellationToken }).ToArray()), + keyValues?.Concat([cancellationToken]).ToArray()), CancellationType.None => context.FindAsync(keyValues), _ => throw new ArgumentOutOfRangeException(nameof(cancellationType), cancellationType, null) }; diff --git a/test/EFCore.Specification.Tests/FixtureBase.cs b/test/EFCore.Specification.Tests/FixtureBase.cs index c52d599f422..f6e09d0a12b 100644 --- a/test/EFCore.Specification.Tests/FixtureBase.cs +++ b/test/EFCore.Specification.Tests/FixtureBase.cs @@ -11,10 +11,9 @@ protected virtual IServiceCollection AddServices(IServiceCollection serviceColle public virtual DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) => builder .EnableSensitiveDataLogging() - .ConfigureWarnings( - b => b.Default(WarningBehavior.Throw) - .Log(CoreEventId.SensitiveDataLoggingEnabledWarning) - .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning)); + .ConfigureWarnings(b => b.Default(WarningBehavior.Throw) + .Log(CoreEventId.SensitiveDataLoggingEnabledWarning) + .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning)); protected virtual void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) { diff --git a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBase.cs b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBase.cs index 83ed6b1d7f0..43ff5e0d5e3 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBase.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBase.cs @@ -37,109 +37,108 @@ public virtual bool AutoDetectChanges protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId).ValueGeneratedOnAdd(); - - b.HasMany(e => e.RequiredChildren) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - - b.HasMany(e => e.OptionalChildren) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne(e => e.RequiredSingle) - .WithOne(e => e.Root) - .HasForeignKey(e => e.Id); - - b.HasOne(e => e.OptionalSingle) - .WithOne(e => e.Root) - .HasForeignKey(e => e.RootId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne(e => e.OptionalSingleDerived) - .WithOne(e => e.DerivedRoot) - .HasForeignKey(e => e.DerivedRootId) - .OnDelete(DeleteBehavior.ClientSetNull); - - b.HasOne(e => e.OptionalSingleMoreDerived) - .WithOne(e => e.MoreDerivedRoot) - .HasForeignKey(e => e.MoreDerivedRootId) - .OnDelete(DeleteBehavior.ClientSetNull); - - b.HasOne(e => e.RequiredNonPkSingle) - .WithOne(e => e.Root) - .HasForeignKey(e => e.RootId); - - b.HasOne(e => e.RequiredNonPkSingleDerived) - .WithOne(e => e.DerivedRoot) - .HasForeignKey(e => e.DerivedRootId) - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne(e => e.RequiredNonPkSingleMoreDerived) - .WithOne(e => e.MoreDerivedRoot) - .HasForeignKey(e => e.MoreDerivedRootId) - .OnDelete(DeleteBehavior.Restrict); - - b.HasMany(e => e.RequiredChildrenAk) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId); - - b.HasMany(e => e.OptionalChildrenAk) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne(e => e.RequiredSingleAk) - .WithOne(e => e.Root) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.RootId); - - b.HasOne(e => e.OptionalSingleAk) - .WithOne(e => e.Root) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.RootId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne(e => e.OptionalSingleAkDerived) - .WithOne(e => e.DerivedRoot) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.DerivedRootId) - .OnDelete(DeleteBehavior.ClientSetNull); - - b.HasOne(e => e.OptionalSingleAkMoreDerived) - .WithOne(e => e.MoreDerivedRoot) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.MoreDerivedRootId) - .OnDelete(DeleteBehavior.ClientSetNull); - - b.HasOne(e => e.RequiredNonPkSingleAk) - .WithOne(e => e.Root) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.RootId); - - b.HasOne(e => e.RequiredNonPkSingleAkDerived) - .WithOne(e => e.DerivedRoot) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.DerivedRootId) - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne(e => e.RequiredNonPkSingleAkMoreDerived) - .WithOne(e => e.MoreDerivedRoot) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.MoreDerivedRootId) - .OnDelete(DeleteBehavior.Restrict); - - b.HasMany(e => e.RequiredCompositeChildren) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentAlternateId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId).ValueGeneratedOnAdd(); + + b.HasMany(e => e.RequiredChildren) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + + b.HasMany(e => e.OptionalChildren) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne(e => e.RequiredSingle) + .WithOne(e => e.Root) + .HasForeignKey(e => e.Id); + + b.HasOne(e => e.OptionalSingle) + .WithOne(e => e.Root) + .HasForeignKey(e => e.RootId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne(e => e.OptionalSingleDerived) + .WithOne(e => e.DerivedRoot) + .HasForeignKey(e => e.DerivedRootId) + .OnDelete(DeleteBehavior.ClientSetNull); + + b.HasOne(e => e.OptionalSingleMoreDerived) + .WithOne(e => e.MoreDerivedRoot) + .HasForeignKey(e => e.MoreDerivedRootId) + .OnDelete(DeleteBehavior.ClientSetNull); + + b.HasOne(e => e.RequiredNonPkSingle) + .WithOne(e => e.Root) + .HasForeignKey(e => e.RootId); + + b.HasOne(e => e.RequiredNonPkSingleDerived) + .WithOne(e => e.DerivedRoot) + .HasForeignKey(e => e.DerivedRootId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(e => e.RequiredNonPkSingleMoreDerived) + .WithOne(e => e.MoreDerivedRoot) + .HasForeignKey(e => e.MoreDerivedRootId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasMany(e => e.RequiredChildrenAk) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId); + + b.HasMany(e => e.OptionalChildrenAk) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne(e => e.RequiredSingleAk) + .WithOne(e => e.Root) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.RootId); + + b.HasOne(e => e.OptionalSingleAk) + .WithOne(e => e.Root) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.RootId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne(e => e.OptionalSingleAkDerived) + .WithOne(e => e.DerivedRoot) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.DerivedRootId) + .OnDelete(DeleteBehavior.ClientSetNull); + + b.HasOne(e => e.OptionalSingleAkMoreDerived) + .WithOne(e => e.MoreDerivedRoot) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.MoreDerivedRootId) + .OnDelete(DeleteBehavior.ClientSetNull); + + b.HasOne(e => e.RequiredNonPkSingleAk) + .WithOne(e => e.Root) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.RootId); + + b.HasOne(e => e.RequiredNonPkSingleAkDerived) + .WithOne(e => e.DerivedRoot) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.DerivedRootId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(e => e.RequiredNonPkSingleAkMoreDerived) + .WithOne(e => e.MoreDerivedRoot) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.MoreDerivedRootId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasMany(e => e.RequiredCompositeChildren) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentAlternateId); + }); modelBuilder.Entity() .HasMany(e => e.Children) @@ -151,19 +150,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.HasMany(e => e.Children) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasMany(e => e.CompositeChildren) - .WithOne(e => e.Parent2) - .HasForeignKey( - e => new { e.Parent2Id }); - }); + modelBuilder.Entity(b => + { + b.HasMany(e => e.Children) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasMany(e => e.CompositeChildren) + .WithOne(e => e.Parent2) + .HasForeignKey(e => new { e.Parent2Id }); + }); modelBuilder.Entity(); modelBuilder.Entity(); @@ -181,25 +178,24 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .HasForeignKey(e => e.BackId) .OnDelete(DeleteBehavior.SetNull); - modelBuilder.Entity( - b => - { - b.HasDiscriminator(e => e.Disc) - .HasValue(new MyDiscriminator(1)) - .HasValue(new MyDiscriminator(2)) - .HasValue(new MyDiscriminator(3)); - - b.Property(e => e.Disc) - .HasConversion( - v => v.Value, - v => new MyDiscriminator(v), - new ValueComparer( - (l, r) => l.Value == r.Value, - v => v.Value.GetHashCode(), - v => new MyDiscriminator(v.Value))) - .Metadata - .SetAfterSaveBehavior(PropertySaveBehavior.Save); - }); + modelBuilder.Entity(b => + { + b.HasDiscriminator(e => e.Disc) + .HasValue(new MyDiscriminator(1)) + .HasValue(new MyDiscriminator(2)) + .HasValue(new MyDiscriminator(3)); + + b.Property(e => e.Disc) + .HasConversion( + v => v.Value, + v => new MyDiscriminator(v), + new ValueComparer( + (l, r) => l.Value == r.Value, + v => v.Value.GetHashCode(), + v => new MyDiscriminator(v.Value))) + .Metadata + .SetAfterSaveBehavior(PropertySaveBehavior.Save); + }); modelBuilder.Entity() .HasOne(e => e.Single) @@ -209,104 +205,91 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId) - .ValueGeneratedOnAdd(); - - b.HasMany(e => e.Children) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId); - - b.HasMany(e => e.CompositeChildren) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.Id, e.AlternateId }) - .HasForeignKey( - e => new { e.ParentId, e.ParentAlternateId }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId) + .ValueGeneratedOnAdd(); + + b.HasMany(e => e.Children) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId); + + b.HasMany(e => e.CompositeChildren) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.Id, e.AlternateId }) + .HasForeignKey(e => new { e.ParentId, e.ParentAlternateId }); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId) - .ValueGeneratedOnAdd(); - - b.HasMany(e => e.Children) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasMany(e => e.CompositeChildren) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.Id, e.AlternateId }) - .HasForeignKey( - e => new { e.ParentId, e.ParentAlternateId }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId) + .ValueGeneratedOnAdd(); + + b.HasMany(e => e.Children) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasMany(e => e.CompositeChildren) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.Id, e.AlternateId }) + .HasForeignKey(e => new { e.ParentId, e.ParentAlternateId }); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId) - .ValueGeneratedOnAdd(); - - b.HasOne(e => e.Single) - .WithOne(e => e.Back) - .HasForeignKey(e => e.BackId) - .HasPrincipalKey(e => e.AlternateId); - - b.HasOne(e => e.SingleComposite) - .WithOne(e => e.Back) - .HasForeignKey( - e => new { e.BackId, e.BackAlternateId }) - .HasPrincipalKey( - e => new { e.Id, e.AlternateId }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId) + .ValueGeneratedOnAdd(); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId) - .ValueGeneratedOnAdd(); - - b.HasOne(e => e.Single) - .WithOne(e => e.Back) - .HasForeignKey(e => e.BackId) - .HasPrincipalKey(e => e.AlternateId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne(e => e.SingleComposite) - .WithOne(e => e.Back) - .HasForeignKey( - e => new { e.BackId, e.ParentAlternateId }) - .HasPrincipalKey( - e => new { e.Id, e.AlternateId }); - }); + b.HasOne(e => e.Single) + .WithOne(e => e.Back) + .HasForeignKey(e => e.BackId) + .HasPrincipalKey(e => e.AlternateId); + + b.HasOne(e => e.SingleComposite) + .WithOne(e => e.Back) + .HasForeignKey(e => new { e.BackId, e.BackAlternateId }) + .HasPrincipalKey(e => new { e.Id, e.AlternateId }); + }); + + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId) + .ValueGeneratedOnAdd(); + + b.HasOne(e => e.Single) + .WithOne(e => e.Back) + .HasForeignKey(e => e.BackId) + .HasPrincipalKey(e => e.AlternateId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne(e => e.SingleComposite) + .WithOne(e => e.Back) + .HasForeignKey(e => new { e.BackId, e.ParentAlternateId }) + .HasPrincipalKey(e => new { e.Id, e.AlternateId }); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId) - .ValueGeneratedOnAdd(); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId) + .ValueGeneratedOnAdd(); - b.HasOne(e => e.Single) - .WithOne(e => e.Back) - .HasForeignKey(e => e.BackId) - .HasPrincipalKey(e => e.AlternateId); - }); + b.HasOne(e => e.Single) + .WithOne(e => e.Back) + .HasForeignKey(e => e.BackId) + .HasPrincipalKey(e => e.AlternateId); + }); modelBuilder.Entity() .Property(e => e.AlternateId) @@ -337,35 +320,29 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .Property(e => e.AlternateId) .ValueGeneratedOnAdd(); - modelBuilder.Entity( - eb => - { - eb.Property(e => e.Id).ValueGeneratedNever(); + modelBuilder.Entity(eb => + { + eb.Property(e => e.Id).ValueGeneratedNever(); - eb.HasKey( - e => new { e.Id, e.ParentAlternateId }); + eb.HasKey(e => new { e.Id, e.ParentAlternateId }); - eb.HasMany(e => e.CompositeChildren) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.Id, e.ParentAlternateId }) - .HasForeignKey( - e => new { e.ParentId, e.ParentAlternateId }); - }); + eb.HasMany(e => e.CompositeChildren) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.Id, e.ParentAlternateId }) + .HasForeignKey(e => new { e.ParentId, e.ParentAlternateId }); + }); - modelBuilder.Entity( - eb => - { - eb.Property(e => e.Id).ValueGeneratedNever(); + modelBuilder.Entity(eb => + { + eb.Property(e => e.Id).ValueGeneratedNever(); - eb.HasKey( - e => new { e.Id, e.ParentAlternateId }); + eb.HasKey(e => new { e.Id, e.ParentAlternateId }); - eb.HasOne(e => e.Root) - .WithMany() - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentAlternateId); - }); + eb.HasOne(e => e.Root) + .WithMany() + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentAlternateId); + }); modelBuilder.Entity(); modelBuilder.Entity(); @@ -393,64 +370,60 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .HasIndex(e => e.BarCode) .IsUnique(); - modelBuilder.Entity( - builder => - { - builder.HasMany(x => x.Dependants).WithOne(x => x.Root) - .HasForeignKey(x => new { x.RootId }) - .HasPrincipalKey(x => x.Id) - .OnDelete(DeleteBehavior.Cascade); - - builder.HasMany(x => x.Parents).WithOne(x => x.Root) - .HasForeignKey(x => new { x.RootId }) - .HasPrincipalKey(x => x.Id) - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity( - builder => - { - builder.HasOne(x => x.Dependant).WithOne(x => x!.Parent).IsRequired(false) - .HasForeignKey(x => new { x.RootId, x.DependantId }) - .HasPrincipalKey(x => new { x.RootId, x.Id }) - .OnDelete(DeleteBehavior.ClientSetNull); - }); + modelBuilder.Entity(builder => + { + builder.HasMany(x => x.Dependants).WithOne(x => x.Root) + .HasForeignKey(x => new { x.RootId }) + .HasPrincipalKey(x => x.Id) + .OnDelete(DeleteBehavior.Cascade); + + builder.HasMany(x => x.Parents).WithOne(x => x.Root) + .HasForeignKey(x => new { x.RootId }) + .HasPrincipalKey(x => x.Id) + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity(builder => + { + builder.HasOne(x => x.Dependant).WithOne(x => x!.Parent).IsRequired(false) + .HasForeignKey(x => new { x.RootId, x.DependantId }) + .HasPrincipalKey(x => new { x.RootId, x.Id }) + .OnDelete(DeleteBehavior.ClientSetNull); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Navigation(e => e.Owned).IsRequired(); - b.Navigation(e => e.OwnedWithKey).IsRequired(); + modelBuilder.Entity(b => + { + b.Navigation(e => e.Owned).IsRequired(); + b.Navigation(e => e.OwnedWithKey).IsRequired(); - b.OwnsMany( - e => e.OwnedCollectionPrivateKey, - b => b.HasKey("OwnerWithKeyedCollectionId", "PrivateKey")); - }); + b.OwnsMany( + e => e.OwnedCollectionPrivateKey, + b => b.HasKey("OwnerWithKeyedCollectionId", "PrivateKey")); + }); modelBuilder .Entity() .OwnsMany(e => e.Owned, owned => owned.HasKey("Id")); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - - b.OwnsOne( - e => e.Owned, - b => b.Property("OwnerNoKeyGenerationId").ValueGeneratedNever()); - b.OwnsMany( - e => e.OwnedCollection, - b => - { - b.Property("OwnedNoKeyGenerationId").ValueGeneratedNever(); - b.Property("OwnerNoKeyGenerationId").ValueGeneratedNever(); - }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + + b.OwnsOne( + e => e.Owned, + b => b.Property("OwnerNoKeyGenerationId").ValueGeneratedNever()); + b.OwnsMany( + e => e.OwnedCollection, + b => + { + b.Property("OwnedNoKeyGenerationId").ValueGeneratedNever(); + b.Property("OwnerNoKeyGenerationId").ValueGeneratedNever(); + }); + }); modelBuilder.Entity().HasData( new Provider { Id = "prov1" }, @@ -459,25 +432,23 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().HasData( new Partner { Id = "partner1" }); - modelBuilder.Entity( - b => - { - b.HasOne(p => p.Partner).WithMany().IsRequired().HasForeignKey("PartnerId"); - b.HasOne().WithMany().IsRequired().HasForeignKey("ProviderId"); + modelBuilder.Entity(b => + { + b.HasOne(p => p.Partner).WithMany().IsRequired().HasForeignKey("PartnerId"); + b.HasOne().WithMany().IsRequired().HasForeignKey("ProviderId"); - b.HasDiscriminator("ProviderId") - .HasValue("prov1") - .HasValue("prov2"); + b.HasDiscriminator("ProviderId") + .HasValue("prov1") + .HasValue("prov2"); - b.HasKey("PartnerId", "ProviderId"); - }); + b.HasKey("PartnerId", "ProviderId"); + }); - modelBuilder.Entity( - b => - { - b.Property("EntityZId"); - b.HasOne(e => e.EntityZ).WithMany().HasForeignKey("EntityZId").IsRequired(); - }); + modelBuilder.Entity(b => + { + b.Property("EntityZId"); + b.HasOne(e => e.EntityZ).WithMany().HasForeignKey("EntityZId").IsRequired(); + }); modelBuilder.Entity(); @@ -491,43 +462,41 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .HasForeignKey(s => s.CategoryId) .OnDelete(DeleteBehavior.ClientSetNull); - modelBuilder.Entity( - builder => - { - builder.Property("CategoryId").IsRequired(); + modelBuilder.Entity(builder => + { + builder.Property("CategoryId").IsRequired(); - builder.HasKey(nameof(SomethingOfCategoryA.SomethingId), "CategoryId"); + builder.HasKey(nameof(SomethingOfCategoryA.SomethingId), "CategoryId"); - builder.HasOne(d => d.Something) - .WithOne(p => p.SomethingOfCategoryA) - .HasPrincipalKey(p => new { p.Id, p.CategoryId }) - .HasForeignKey(nameof(SomethingOfCategoryA.SomethingId), "CategoryId") - .OnDelete(DeleteBehavior.ClientSetNull); + builder.HasOne(d => d.Something) + .WithOne(p => p.SomethingOfCategoryA) + .HasPrincipalKey(p => new { p.Id, p.CategoryId }) + .HasForeignKey(nameof(SomethingOfCategoryA.SomethingId), "CategoryId") + .OnDelete(DeleteBehavior.ClientSetNull); - builder.HasOne() - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.ClientSetNull); - }); + builder.HasOne() + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.ClientSetNull); + }); - modelBuilder.Entity( - builder => - { - builder.Property(e => e.CategoryId).IsRequired(); + modelBuilder.Entity(builder => + { + builder.Property(e => e.CategoryId).IsRequired(); - builder.HasKey(e => new { e.SomethingId, e.CategoryId }); + builder.HasKey(e => new { e.SomethingId, e.CategoryId }); - builder.HasOne(d => d.Something) - .WithOne(p => p.SomethingOfCategoryB) - .HasPrincipalKey(p => new { p.Id, p.CategoryId }) - .HasForeignKey(socb => new { socb.SomethingId, socb.CategoryId }) - .OnDelete(DeleteBehavior.ClientSetNull); + builder.HasOne(d => d.Something) + .WithOne(p => p.SomethingOfCategoryB) + .HasPrincipalKey(p => new { p.Id, p.CategoryId }) + .HasForeignKey(socb => new { socb.SomethingId, socb.CategoryId }) + .OnDelete(DeleteBehavior.ClientSetNull); - builder.HasOne(e => e.SomethingCategory) - .WithMany() - .HasForeignKey(e => e.CategoryId) - .OnDelete(DeleteBehavior.ClientSetNull); - }); + builder.HasOne(e => e.SomethingCategory) + .WithMany() + .HasForeignKey(e => e.CategoryId) + .OnDelete(DeleteBehavior.ClientSetNull); + }); modelBuilder.Entity().HasMany(e => e.TurnipSwedes).WithOne(e => e.Swede).OnDelete(DeleteBehavior.Restrict); modelBuilder.Entity().HasData(new Parsnip { Id = 1 }); @@ -547,12 +516,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.HasOne(x => x.Parent).WithMany(x => x.Children).OnDelete(DeleteBehavior.Restrict); - b.HasAlternateKey(x => new { x.Id, x.ParentId }); - }); + modelBuilder.Entity(b => + { + b.HasOne(x => x.Parent).WithMany(x => x.Children).OnDelete(DeleteBehavior.Restrict); + b.HasAlternateKey(x => new { x.Id, x.ParentId }); + }); modelBuilder.Entity().HasData( new @@ -576,14 +544,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .WithMany() .UsingEntity(); - modelBuilder.Entity( - b => - { - b.OwnsOne(e => e.OptionalSingle).OwnsOne(e => e.Single); - b.OwnsOne(e => e.RequiredSingle).OwnsOne(e => e.Single); - b.OwnsMany(e => e.OptionalChildren).OwnsMany(e => e.Children); - b.OwnsMany(e => e.RequiredChildren).OwnsMany(e => e.Children); - }); + modelBuilder.Entity(b => + { + b.OwnsOne(e => e.OptionalSingle).OwnsOne(e => e.Single); + b.OwnsOne(e => e.RequiredSingle).OwnsOne(e => e.Single); + b.OwnsMany(e => e.OptionalChildren).OwnsMany(e => e.Children); + b.OwnsMany(e => e.RequiredChildren).OwnsMany(e => e.Children); + }); modelBuilder.Entity() .HasOne(x => x.Child) @@ -592,78 +559,67 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.HasOne(x => x.Child).WithOne().HasForeignKey(x => x.ParentId); - b.Property(e => e.Id).HasValueGenerator(); - }); + modelBuilder.Entity(b => + { + b.HasOne(x => x.Child).WithOne().HasForeignKey(x => x.ParentId); + b.Property(e => e.Id).HasValueGenerator(); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasValueGenerator(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasValueGenerator(); + }); - modelBuilder.Entity( - b => - { - b.HasOne(x => x.Brother).WithOne().HasForeignKey(x => x.BrotherId); - b.Property(e => e.Id).HasValueGenerator(); - }); + modelBuilder.Entity(b => + { + b.HasOne(x => x.Brother).WithOne().HasForeignKey(x => x.BrotherId); + b.Property(e => e.Id).HasValueGenerator(); + }); - modelBuilder.Entity>( - b => + modelBuilder.Entity>(b => + { + b.HasKey(e => new { - b.HasKey( - e => new - { - e.TargetId, - e.SourceId, - e.PrimaryGroup - }); - b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd(); + e.TargetId, + e.SourceId, + e.PrimaryGroup }); + b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd(); + }); - modelBuilder.Entity>( - b => + modelBuilder.Entity>(b => + { + b.HasKey(e => new { - b.HasKey( - e => new - { - e.TargetId, - e.SourceId, - e.PrimaryGroup - }); - b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd(); + e.TargetId, + e.SourceId, + e.PrimaryGroup }); + b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd(); + }); - modelBuilder.Entity>( - b => + modelBuilder.Entity>(b => + { + b.HasKey(e => new { - b.HasKey( - e => new - { - e.TargetId, - e.SourceId, - e.PrimaryGroup - }); - b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd(); + e.TargetId, + e.SourceId, + e.PrimaryGroup }); + b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd(); + }); - modelBuilder.Entity>( - b => - { - b.HasKey(e => e.PrimaryGroup); - b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd(); - }); + modelBuilder.Entity>(b => + { + b.HasKey(e => e.PrimaryGroup); + b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd(); + }); - modelBuilder.Entity>( - b => - { - b.HasKey(e => e.PrimaryGroup); - b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd(); - }); + modelBuilder.Entity>(b => + { + b.HasKey(e => e.PrimaryGroup); + b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd(); + }); } private class StableGuidGenerator : ValueGenerator @@ -1129,10 +1085,8 @@ protected static void AssertKeys(Root expected, Root actual) actual.RequiredNonPkSingleAkMoreDerived?.Single?.AlternateId); Assert.Equal( - expected.RequiredCompositeChildren.OrderBy(e => e.Id).Select( - e => new { e.Id, e.ParentAlternateId }), - actual.RequiredCompositeChildren.OrderBy(e => e.Id).Select( - e => new { e.Id, e.ParentAlternateId })); + expected.RequiredCompositeChildren.OrderBy(e => e.Id).Select(e => new { e.Id, e.ParentAlternateId }), + actual.RequiredCompositeChildren.OrderBy(e => e.Id).Select(e => new { e.Id, e.ParentAlternateId })); Assert.Equal( expected.RequiredCompositeChildren.OrderBy(e => e.Id).Select(e => e.CompositeChildren.Count), @@ -1140,11 +1094,9 @@ protected static void AssertKeys(Root expected, Root actual) Assert.Equal( expected.RequiredCompositeChildren.OrderBy(e => e.Id).SelectMany(e => e.CompositeChildren).OrderBy(e => e.Id) - .Select( - e => new { e.Id, e.ParentAlternateId }), + .Select(e => new { e.Id, e.ParentAlternateId }), actual.RequiredCompositeChildren.OrderBy(e => e.Id).SelectMany(e => e.CompositeChildren).OrderBy(e => e.Id) - .Select( - e => new { e.Id, e.ParentAlternateId })); + .Select(e => new { e.Id, e.ParentAlternateId })); } protected static void AssertNavigations(Root root) diff --git a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseMiscellaneous.cs b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseMiscellaneous.cs index 361a19c9c88..25f64e3a9bb 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseMiscellaneous.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseMiscellaneous.cs @@ -13,9 +13,7 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class GraphUpdatesTestBase where TFixture : GraphUpdatesTestBase.GraphUpdatesFixtureBase, new() { - [ConditionalTheory] // Issue #27299 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #27299 public virtual async Task Can_insert_when_composite_FK_has_default_value_for_one_part(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => @@ -55,9 +53,7 @@ public virtual async Task Can_insert_when_composite_FK_has_default_value_for_one Assert.Equal("B", something.SomethingOfCategoryB.Name); }); - [ConditionalTheory] // Issue #23974 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #23974 public virtual async Task Can_insert_when_FK_has_default_value(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => @@ -80,9 +76,7 @@ public virtual async Task Can_insert_when_FK_has_default_value(bool async) Assert.Equal(cruiser.IdUserState, cruiser.UserState.AccessStateId); }); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_when_FK_has_sentinel_value(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => @@ -105,29 +99,16 @@ public virtual async Task Can_insert_when_FK_has_sentinel_value(bool async) Assert.Equal(cruiser.IdUserState, cruiser.UserState.AccessStateWithSentinelId); }); - [ConditionalTheory] - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(true, false), InlineData(false, true), InlineData(true, true)] public virtual Task Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(bool async, bool initialValue) => Can_insert_when_PK_property_in_composite_key_has_sentinel_value(async, initialValue); - [ConditionalTheory] - [InlineData(false, 0)] - [InlineData(true, 0)] - [InlineData(false, 1)] - [InlineData(true, 1)] - [InlineData(false, 2)] - [InlineData(true, 2)] + [ConditionalTheory, InlineData(false, 0), InlineData(true, 0), InlineData(false, 1), InlineData(true, 1), InlineData(false, 2), + InlineData(true, 2)] public virtual Task Can_insert_when_int_PK_in_composite_key_has_sentinel_value(bool async, int initialValue) => Can_insert_when_PK_property_in_composite_key_has_sentinel_value(async, initialValue); - [ConditionalTheory] - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(true, false), InlineData(false, true), InlineData(true, true)] public virtual Task Can_insert_when_nullable_bool_PK_in_composite_key_has_sentinel_value(bool async, bool? initialValue) => Can_insert_when_PK_property_in_composite_key_has_sentinel_value(async, initialValue); @@ -165,19 +146,11 @@ await ExecuteWithStrategyInTransactionAsync( }); } - [ConditionalTheory] - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(true, false), InlineData(false, true), InlineData(true, true)] public virtual Task Throws_for_single_property_bool_key_with_default_value_generation(bool async, bool initialValue) => Throws_for_single_property_key_with_default_value_generation(async, initialValue); - [ConditionalTheory] - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(true, false), InlineData(false, true), InlineData(true, true)] public virtual Task Throws_for_single_property_nullable_bool_key_with_default_value_generation(bool async, bool? initialValue) => Throws_for_single_property_key_with_default_value_generation(async, initialValue); @@ -186,20 +159,17 @@ protected async Task Throws_for_single_property_key_with_default_value_generatio { var inserted = new BoolOnlyKey { PrimaryGroup = initialValue }; - await ExecuteWithStrategyInTransactionAsync( - async context => - { - Assert.Equal( - CoreStrings.NoValueGenerator("PrimaryGroup", typeof(BoolOnlyKey).ShortDisplayName(), typeof(T).ShortDisplayName()), - (async - ? (await Assert.ThrowsAsync(async () => await context.AddAsync(inserted))) - : Assert.Throws(() => context.Add(inserted))).Message); - }); + await ExecuteWithStrategyInTransactionAsync(async context => + { + Assert.Equal( + CoreStrings.NoValueGenerator("PrimaryGroup", typeof(BoolOnlyKey).ShortDisplayName(), typeof(T).ShortDisplayName()), + (async + ? (await Assert.ThrowsAsync(async () => await context.AddAsync(inserted))) + : Assert.Throws(() => context.Add(inserted))).Message); + }); } - [ConditionalTheory] // Issue #23043 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #23043 public virtual async Task Saving_multiple_modified_entities_with_the_same_key_does_not_overflow(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => @@ -228,8 +198,7 @@ public virtual async Task Saving_multiple_modified_entities_with_the_same_key_do { Assert.Equal( CoreStrings.RelationshipConceptualNullSensitive(nameof(City), nameof(College), $"{{CityId: {city.Id}}}"), - Assert.Throws( - () => context.Entry(college).State = EntityState.Modified).Message); + Assert.Throws(() => context.Entry(college).State = EntityState.Modified).Message); } else { @@ -239,9 +208,7 @@ public virtual async Task Saving_multiple_modified_entities_with_the_same_key_do } }); - [ConditionalTheory] // Issue #22465 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #22465 public virtual async Task Reset_unknown_original_value_when_current_value_is_set(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => @@ -295,134 +262,119 @@ public virtual async Task Reset_unknown_original_value_when_current_value_is_set } }); - [ConditionalTheory] // Issue #19856 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #19856 public virtual async Task Update_principal_with_shadow_key_owned_collection_throws(bool async) - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var owner = new Owner { Owned = new Owned(), OwnedCollection = { new Owned(), new Owned() } }; + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var owner = new Owner { Owned = new Owned(), OwnedCollection = { new Owned(), new Owned() } }; - if (async) - { - await context.AddAsync(owner); - await context.SaveChangesAsync(); - } - else - { - context.Add(owner); - context.SaveChanges(); - } + if (async) + { + await context.AddAsync(owner); + await context.SaveChangesAsync(); + } + else + { + context.Add(owner); + context.SaveChanges(); + } - context.ChangeTracker.Clear(); + context.ChangeTracker.Clear(); - context.Update(owner); + context.Update(owner); - Assert.Equal( - CoreStrings.UnknownShadowKeyValue("Owner.OwnedCollection#Owned", "Id"), - (async - ? await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()) - : Assert.Throws(() => context.SaveChanges())).Message); - }); + Assert.Equal( + CoreStrings.UnknownShadowKeyValue("Owner.OwnedCollection#Owned", "Id"), + (async + ? await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()) + : Assert.Throws(() => context.SaveChanges())).Message); + }); - [ConditionalTheory] // Issue #19856 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #19856 public virtual async Task Delete_principal_with_shadow_key_owned_collection_throws(bool async) - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var owner = new Owner { Owned = new Owned(), OwnedCollection = { new Owned(), new Owned() } }; - - if (async) - { - await context.AddAsync(owner); - await context.SaveChangesAsync(); - } - else - { - context.Add(owner); - context.SaveChanges(); - } + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var owner = new Owner { Owned = new Owned(), OwnedCollection = { new Owned(), new Owned() } }; - context.ChangeTracker.Clear(); + if (async) + { + await context.AddAsync(owner); + await context.SaveChangesAsync(); + } + else + { + context.Add(owner); + context.SaveChanges(); + } - context.Attach(owner); - context.Remove(owner); + context.ChangeTracker.Clear(); - if (Fixture.ForceClientNoAction) - { - if (async) - { - await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()); - } - else - { - Assert.Throws(() => context.SaveChanges()); - } - } - else - { - Assert.Equal( - CoreStrings.UnknownShadowKeyValue("Owner.OwnedCollection#Owned", "Id"), - (async - ? await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()) - : Assert.Throws(() => context.SaveChanges())).Message); - } - }); + context.Attach(owner); + context.Remove(owner); - [ConditionalTheory] // Issue #19856 - [InlineData(false, false, false)] - [InlineData(false, false, true)] - [InlineData(false, true, false)] - [InlineData(false, true, true)] - [InlineData(true, false, false)] - [InlineData(true, false, true)] - [InlineData(true, true, false)] - [InlineData(true, true, true)] - public virtual async Task Clearing_shadow_key_owned_collection_throws(bool async, bool useUpdate, bool addNew) - => await ExecuteWithStrategyInTransactionAsync( - async context => + if (Fixture.ForceClientNoAction) { - var owner = new Owner { Owned = new Owned(), OwnedCollection = { new Owned(), new Owned() } }; - if (async) { - await context.AddAsync(owner); - await context.SaveChangesAsync(); + await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()); } else { - context.Add(owner); - context.SaveChanges(); + Assert.Throws(() => context.SaveChanges()); } - - context.ChangeTracker.Clear(); - - if (useUpdate) - { - context.Update(owner); - } - else - { - context.Attach(owner); - } - - owner.OwnedCollection = addNew - ? [new Owned(), new Owned()] - : new List(); - + } + else + { Assert.Equal( CoreStrings.UnknownShadowKeyValue("Owner.OwnedCollection#Owned", "Id"), (async ? await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()) : Assert.Throws(() => context.SaveChanges())).Message); - }); + } + }); + + [ConditionalTheory, InlineData(false, false, false), InlineData(false, false, true), InlineData(false, true, false), + InlineData(false, true, true), InlineData(true, false, false), InlineData(true, false, true), InlineData(true, true, false), + InlineData(true, true, true)] // Issue #19856 + public virtual async Task Clearing_shadow_key_owned_collection_throws(bool async, bool useUpdate, bool addNew) + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var owner = new Owner { Owned = new Owned(), OwnedCollection = { new Owned(), new Owned() } }; + + if (async) + { + await context.AddAsync(owner); + await context.SaveChangesAsync(); + } + else + { + context.Add(owner); + context.SaveChanges(); + } + + context.ChangeTracker.Clear(); + + if (useUpdate) + { + context.Update(owner); + } + else + { + context.Attach(owner); + } + + owner.OwnedCollection = addNew + ? [new Owned(), new Owned()] + : new List(); + + Assert.Equal( + CoreStrings.UnknownShadowKeyValue("Owner.OwnedCollection#Owned", "Id"), + (async + ? await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()) + : Assert.Throws(() => context.SaveChanges())).Message); + }); - [ConditionalTheory] // Issue #26330 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #26330 public virtual async Task Saving_unknown_key_value_marks_it_as_unmodified(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => @@ -446,11 +398,10 @@ public virtual async Task Saving_unknown_key_value_marks_it_as_unmodified(bool a if (Fixture.ForceClientNoAction) { - await Assert.ThrowsAsync( - async () => - _ = async - ? await context.SaveChangesAsync() - : context.SaveChanges()); + await Assert.ThrowsAsync(async () => + _ = async + ? await context.SaveChangesAsync() + : context.SaveChanges()); } else { @@ -471,9 +422,7 @@ await Assert.ThrowsAsync( } }); - [ConditionalTheory] // Issue #19856 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #19856 public virtual async Task Update_principal_with_CLR_key_owned_collection(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => @@ -528,9 +477,7 @@ public virtual async Task Update_principal_with_CLR_key_owned_collection(bool as Assert.Equal(1, owner.OwnedCollectionPrivateKey.Count(e => e.Bar == "OfGold")); }); - [ConditionalTheory] // Issue #19856 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #19856 public virtual async Task Delete_principal_with_CLR_key_owned_collection(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => @@ -593,15 +540,9 @@ public virtual async Task Delete_principal_with_CLR_key_owned_collection(bool as } }); - [ConditionalTheory] // Issue #19856 - [InlineData(false, false, false)] - [InlineData(false, false, true)] - [InlineData(false, true, false)] - [InlineData(false, true, true)] - [InlineData(true, false, false)] - [InlineData(true, false, true)] - [InlineData(true, true, false)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(false, false, true), InlineData(false, true, false), + InlineData(false, true, true), InlineData(true, false, false), InlineData(true, false, true), InlineData(true, true, false), + InlineData(true, true, true)] // Issue #19856 public virtual async Task Clearing_CLR_key_owned_collection(bool async, bool useUpdate, bool addNew) => await ExecuteWithStrategyInTransactionAsync( async context => @@ -674,63 +615,56 @@ public virtual async Task Clearing_CLR_key_owned_collection(bool async, bool use } }); - [ConditionalTheory] // Issue #19856 - [InlineData(false, false)] - [InlineData(false, true)] - [InlineData(true, false)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(false, true), InlineData(true, false), InlineData(true, true)] // Issue #19856 public virtual async Task Update_principal_with_non_generated_shadow_key_owned_collection_throws(bool async, bool delete) - => await ExecuteWithStrategyInTransactionAsync( - async context => - { - var owner = new OwnerNoKeyGeneration { Id = 77, Owned = new OwnedNoKeyGeneration() }; - - if (async) - { - await context.AddAsync(owner); - } - else - { - context.Add(owner); - } + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var owner = new OwnerNoKeyGeneration { Id = 77, Owned = new OwnedNoKeyGeneration() }; - context.Entry(owner.Owned).Property("OwnerNoKeyGenerationId").CurrentValue = 77; + if (async) + { + await context.AddAsync(owner); + } + else + { + context.Add(owner); + } - var owned1 = new OwnedNoKeyGeneration(); - owner.OwnedCollection.Add(owned1); - context.ChangeTracker.DetectChanges(); - context.Entry(owned1).Property("OwnerNoKeyGenerationId").CurrentValue = 77; - context.Entry(owned1).Property("OwnedNoKeyGenerationId").CurrentValue = 100; + context.Entry(owner.Owned).Property("OwnerNoKeyGenerationId").CurrentValue = 77; - if (async) - { - await context.SaveChangesAsync(); - } - else - { - context.SaveChanges(); - } + var owned1 = new OwnedNoKeyGeneration(); + owner.OwnedCollection.Add(owned1); + context.ChangeTracker.DetectChanges(); + context.Entry(owned1).Property("OwnerNoKeyGenerationId").CurrentValue = 77; + context.Entry(owned1).Property("OwnedNoKeyGenerationId").CurrentValue = 100; - context.ChangeTracker.Clear(); + if (async) + { + await context.SaveChangesAsync(); + } + else + { + context.SaveChanges(); + } - context.Update(owner); + context.ChangeTracker.Clear(); - if (delete) - { - context.Remove(owner); - } + context.Update(owner); - Assert.Equal( - CoreStrings.UnknownShadowKeyValue( - "OwnerNoKeyGeneration.OwnedCollection#OwnedNoKeyGeneration", "OwnedNoKeyGenerationId"), - (async - ? await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()) - : Assert.Throws(() => context.SaveChanges())).Message); - }); + if (delete) + { + context.Remove(owner); + } - [ConditionalTheory] // Issue #21206 - [InlineData(false)] - [InlineData(true)] + Assert.Equal( + CoreStrings.UnknownShadowKeyValue( + "OwnerNoKeyGeneration.OwnedCollection#OwnedNoKeyGeneration", "OwnedNoKeyGenerationId"), + (async + ? await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()) + : Assert.Throws(() => context.SaveChanges())).Message); + }); + + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #21206 public virtual async Task Discriminator_values_are_not_marked_as_unknown(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => @@ -873,9 +807,7 @@ public virtual Task Avoid_nulling_shared_FK_property_when_deleting() } }); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual Task Avoid_nulling_shared_FK_property_when_nulling_navigation(bool nullPrincipal) => ExecuteWithStrategyInTransactionAsync( async context => @@ -963,21 +895,20 @@ public virtual Task Avoid_nulling_shared_FK_property_when_nulling_navigation(boo [ConditionalFact] public virtual Task Mutating_discriminator_value_throws_by_convention() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var instance = await context.Set().FirstAsync(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var instance = await context.Set().FirstAsync(); - var propertyEntry = context.Entry(instance).Property("Discriminator"); + var propertyEntry = context.Entry(instance).Property("Discriminator"); - Assert.Equal(nameof(OptionalSingle1Derived), propertyEntry.CurrentValue); + Assert.Equal(nameof(OptionalSingle1Derived), propertyEntry.CurrentValue); - propertyEntry.CurrentValue = nameof(OptionalSingle1MoreDerived); + propertyEntry.CurrentValue = nameof(OptionalSingle1MoreDerived); - Assert.Equal( - CoreStrings.PropertyReadOnlyAfterSave("Discriminator", nameof(OptionalSingle1Derived)), - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + CoreStrings.PropertyReadOnlyAfterSave("Discriminator", nameof(OptionalSingle1Derived)), + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); [ConditionalFact] public virtual Task Mutating_discriminator_value_can_be_configured_to_allow_mutation() @@ -1006,10 +937,8 @@ public virtual Task Mutating_discriminator_value_can_be_configured_to_allow_muta }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Fk)] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)(ChangeMechanism.Dependent | ChangeMechanism.Fk))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Fk), InlineData((int)ChangeMechanism.Dependent), + InlineData((int)(ChangeMechanism.Dependent | ChangeMechanism.Fk))] public virtual Task Changes_to_Added_relationships_are_picked_up(ChangeMechanism changeMechanism) { var id = 0; @@ -1062,15 +991,15 @@ public virtual Task Changes_to_Added_relationships_are_picked_up(ChangeMechanism }); } - [ConditionalTheory] - [InlineData(false, CascadeTiming.OnSaveChanges)] - [InlineData(false, CascadeTiming.Immediate)] - [InlineData(false, CascadeTiming.Never)] - [InlineData(false, null)] - [InlineData(true, CascadeTiming.OnSaveChanges)] - [InlineData(true, CascadeTiming.Immediate)] - [InlineData(true, CascadeTiming.Never)] - [InlineData(true, null)] + [ConditionalTheory, + InlineData(false, CascadeTiming.OnSaveChanges), + InlineData(false, CascadeTiming.Immediate), + InlineData(false, CascadeTiming.Never), + InlineData(false, null), + InlineData(true, CascadeTiming.OnSaveChanges), + InlineData(true, CascadeTiming.Immediate), + InlineData(true, CascadeTiming.Never), + InlineData(true, null)] public virtual Task New_FK_is_not_cleared_on_old_dependent_delete( bool loadNewParent, CascadeTiming? deleteOrphansTiming) @@ -1150,11 +1079,8 @@ public virtual Task New_FK_is_not_cleared_on_old_dependent_delete( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never)] - [InlineData(null)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate), InlineData(CascadeTiming.Never), + InlineData(null)] public virtual async Task No_fixup_to_Deleted_entities( CascadeTiming? deleteOrphansTiming) { @@ -1187,348 +1113,344 @@ public virtual async Task No_fixup_to_Deleted_entities( [ConditionalFact] public virtual Task Notification_entities_can_have_indexes() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var produce = new Produce { Name = "Apple", BarCode = 77 }; - context.Add(produce); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var produce = new Produce { Name = "Apple", BarCode = 77 }; + context.Add(produce); - Assert.Equal(EntityState.Added, context.Entry(produce).State); + Assert.Equal(EntityState.Added, context.Entry(produce).State); - Assert.True(context.ChangeTracker.HasChanges()); + Assert.True(context.ChangeTracker.HasChanges()); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - Assert.False(context.ChangeTracker.HasChanges()); + Assert.False(context.ChangeTracker.HasChanges()); - Assert.Equal(EntityState.Unchanged, context.Entry(produce).State); - Assert.NotEqual(Guid.Empty, context.Entry(produce).Property(e => e.ProduceId).OriginalValue); - Assert.Equal(77, context.Entry(produce).Property(e => e.BarCode).OriginalValue); + Assert.Equal(EntityState.Unchanged, context.Entry(produce).State); + Assert.NotEqual(Guid.Empty, context.Entry(produce).Property(e => e.ProduceId).OriginalValue); + Assert.Equal(77, context.Entry(produce).Property(e => e.BarCode).OriginalValue); - context.Remove(produce); - Assert.Equal(EntityState.Deleted, context.Entry(produce).State); - Assert.NotEqual(Guid.Empty, context.Entry(produce).Property(e => e.ProduceId).OriginalValue); - Assert.Equal(77, context.Entry(produce).Property(e => e.BarCode).OriginalValue); + context.Remove(produce); + Assert.Equal(EntityState.Deleted, context.Entry(produce).State); + Assert.NotEqual(Guid.Empty, context.Entry(produce).Property(e => e.ProduceId).OriginalValue); + Assert.Equal(77, context.Entry(produce).Property(e => e.BarCode).OriginalValue); - Assert.True(context.ChangeTracker.HasChanges()); + Assert.True(context.ChangeTracker.HasChanges()); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - Assert.False(context.ChangeTracker.HasChanges()); + Assert.False(context.ChangeTracker.HasChanges()); - Assert.Equal(EntityState.Detached, context.Entry(produce).State); - }); + Assert.Equal(EntityState.Detached, context.Entry(produce).State); + }); [ConditionalFact] public virtual Task Resetting_a_deleted_reference_fixes_up_again() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var bloog = await context.Set().Include(e => e.Poosts).SingleAsync(); - var poost1 = bloog.Poosts.First(); - var poost2 = bloog.Poosts.Skip(1).First(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var bloog = await context.Set().Include(e => e.Poosts).SingleAsync(); + var poost1 = bloog.Poosts.First(); + var poost2 = bloog.Poosts.Skip(1).First(); - Assert.Equal(2, bloog.Poosts.Count()); - Assert.Same(bloog, poost1.Bloog); - Assert.Same(bloog, poost2.Bloog); + Assert.Equal(2, bloog.Poosts.Count()); + Assert.Same(bloog, poost1.Bloog); + Assert.Same(bloog, poost2.Bloog); - context.Remove(bloog); + context.Remove(bloog); - Assert.True(context.ChangeTracker.HasChanges()); + Assert.True(context.ChangeTracker.HasChanges()); - Assert.Equal(2, bloog.Poosts.Count()); + Assert.Equal(2, bloog.Poosts.Count()); - if (Fixture.ForceClientNoAction) - { - Assert.Same(bloog, poost1.Bloog); - Assert.Same(bloog, poost2.Bloog); - } - else - { - Assert.Null(poost1.Bloog); - Assert.Null(poost2.Bloog); - } + if (Fixture.ForceClientNoAction) + { + Assert.Same(bloog, poost1.Bloog); + Assert.Same(bloog, poost2.Bloog); + } + else + { + Assert.Null(poost1.Bloog); + Assert.Null(poost2.Bloog); + } - poost1.Bloog = bloog; + poost1.Bloog = bloog; - Assert.Equal(2, bloog.Poosts.Count()); + Assert.Equal(2, bloog.Poosts.Count()); - if (Fixture.ForceClientNoAction) - { - Assert.Same(bloog, poost1.Bloog); - Assert.Same(bloog, poost2.Bloog); - } - else - { - Assert.Same(bloog, poost1.Bloog); - Assert.Null(poost2.Bloog); - } + if (Fixture.ForceClientNoAction) + { + Assert.Same(bloog, poost1.Bloog); + Assert.Same(bloog, poost2.Bloog); + } + else + { + Assert.Same(bloog, poost1.Bloog); + Assert.Null(poost2.Bloog); + } - poost1.Bloog = null; + poost1.Bloog = null; - Assert.Equal(2, bloog.Poosts.Count()); + Assert.Equal(2, bloog.Poosts.Count()); - if (Fixture.ForceClientNoAction) - { - Assert.Null(poost1.Bloog); - Assert.Same(bloog, poost2.Bloog); - } - else - { - Assert.Null(poost1.Bloog); - Assert.Null(poost2.Bloog); - } + if (Fixture.ForceClientNoAction) + { + Assert.Null(poost1.Bloog); + Assert.Same(bloog, poost2.Bloog); + } + else + { + Assert.Null(poost1.Bloog); + Assert.Null(poost2.Bloog); + } - if (!Fixture.ForceClientNoAction) - { - Assert.True(context.ChangeTracker.HasChanges()); + if (!Fixture.ForceClientNoAction) + { + Assert.True(context.ChangeTracker.HasChanges()); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - Assert.False(context.ChangeTracker.HasChanges()); + Assert.False(context.ChangeTracker.HasChanges()); - Assert.Equal(2, bloog.Poosts.Count()); - Assert.Null(poost1.Bloog); - Assert.Null(poost2.Bloog); - } - }); + Assert.Equal(2, bloog.Poosts.Count()); + Assert.Null(poost1.Bloog); + Assert.Null(poost2.Bloog); + } + }); [ConditionalFact] public virtual Task Detaching_principal_entity_will_remove_references_to_it() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var root = await LoadOptionalGraphAsync(context); - await LoadRequiredGraphAsync(context); - await LoadOptionalAkGraphAsync(context); - await LoadRequiredAkGraphAsync(context); - await LoadRequiredCompositeGraphAsync(context); - await LoadRequiredNonPkGraphAsync(context); - await LoadOptionalOneToManyGraphAsync(context); - await LoadRequiredNonPkAkGraphAsync(context); - - var optionalSingle = root.OptionalSingle; - var requiredSingle = root.RequiredSingle; - var optionalSingleAk = root.OptionalSingleAk; - var optionalSingleDerived = root.OptionalSingleDerived; - var requiredSingleAk = root.RequiredSingleAk; - var optionalSingleAkDerived = root.OptionalSingleAkDerived; - var optionalSingleMoreDerived = root.OptionalSingleMoreDerived; - var requiredNonPkSingle = root.RequiredNonPkSingle; - var optionalSingleAkMoreDerived = root.OptionalSingleAkMoreDerived; - var requiredNonPkSingleAk = root.RequiredNonPkSingleAk; - var requiredNonPkSingleDerived = root.RequiredNonPkSingleDerived; - var requiredNonPkSingleAkDerived = root.RequiredNonPkSingleAkDerived; - var requiredNonPkSingleMoreDerived = root.RequiredNonPkSingleMoreDerived; - var requiredNonPkSingleAkMoreDerived = root.RequiredNonPkSingleAkMoreDerived; - - Assert.Same(root, optionalSingle.Root); - Assert.Same(root, requiredSingle.Root); - Assert.Same(root, optionalSingleAk.Root); - Assert.Same(root, optionalSingleDerived.DerivedRoot); - Assert.Same(root, requiredSingleAk.Root); - Assert.Same(root, optionalSingleAkDerived.DerivedRoot); - Assert.Same(root, optionalSingleMoreDerived.MoreDerivedRoot); - Assert.Same(root, requiredNonPkSingle.Root); - Assert.Same(root, optionalSingleAkMoreDerived.MoreDerivedRoot); - Assert.Same(root, requiredNonPkSingleAk.Root); - Assert.Same(root, requiredNonPkSingleDerived.DerivedRoot); - Assert.Same(root, requiredNonPkSingleAkDerived.DerivedRoot); - Assert.Same(root, requiredNonPkSingleMoreDerived.MoreDerivedRoot); - Assert.Same(root, requiredNonPkSingleAkMoreDerived.MoreDerivedRoot); - - Assert.True(root.OptionalChildren.All(e => e.Parent == root)); - Assert.True(root.RequiredChildren.All(e => e.Parent == root)); - Assert.True(root.OptionalChildrenAk.All(e => e.Parent == root)); - Assert.True(root.RequiredChildrenAk.All(e => e.Parent == root)); - Assert.True(root.RequiredCompositeChildren.All(e => e.Parent == root)); - - Assert.False(context.ChangeTracker.HasChanges()); - - context.Entry(optionalSingle).State = EntityState.Detached; - context.Entry(requiredSingle).State = EntityState.Detached; - context.Entry(optionalSingleAk).State = EntityState.Detached; - context.Entry(optionalSingleDerived).State = EntityState.Detached; - context.Entry(requiredSingleAk).State = EntityState.Detached; - context.Entry(optionalSingleAkDerived).State = EntityState.Detached; - context.Entry(optionalSingleMoreDerived).State = EntityState.Detached; - context.Entry(requiredNonPkSingle).State = EntityState.Detached; - context.Entry(optionalSingleAkMoreDerived).State = EntityState.Detached; - context.Entry(requiredNonPkSingleAk).State = EntityState.Detached; - context.Entry(requiredNonPkSingleDerived).State = EntityState.Detached; - context.Entry(requiredNonPkSingleAkDerived).State = EntityState.Detached; - context.Entry(requiredNonPkSingleMoreDerived).State = EntityState.Detached; - context.Entry(requiredNonPkSingleAkMoreDerived).State = EntityState.Detached; - - Assert.False(context.ChangeTracker.HasChanges()); - - Assert.NotNull(optionalSingle.Root); - Assert.NotNull(requiredSingle.Root); - Assert.NotNull(optionalSingleAk.Root); - Assert.NotNull(optionalSingleDerived.DerivedRoot); - Assert.NotNull(requiredSingleAk.Root); - Assert.NotNull(optionalSingleAkDerived.DerivedRoot); - Assert.NotNull(optionalSingleMoreDerived.MoreDerivedRoot); - Assert.NotNull(requiredNonPkSingle.Root); - Assert.NotNull(optionalSingleAkMoreDerived.MoreDerivedRoot); - Assert.NotNull(requiredNonPkSingleAk.Root); - Assert.NotNull(requiredNonPkSingleDerived.DerivedRoot); - Assert.NotNull(requiredNonPkSingleAkDerived.DerivedRoot); - Assert.NotNull(requiredNonPkSingleMoreDerived.MoreDerivedRoot); - Assert.NotNull(requiredNonPkSingleAkMoreDerived.MoreDerivedRoot); - - Assert.True(root.OptionalChildren.All(e => e.Parent != null)); - Assert.True(root.RequiredChildren.All(e => e.Parent != null)); - Assert.True(root.OptionalChildrenAk.All(e => e.Parent != null)); - Assert.True(root.RequiredChildrenAk.All(e => e.Parent != null)); - Assert.True(root.RequiredCompositeChildren.All(e => e.Parent != null)); - }); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var root = await LoadOptionalGraphAsync(context); + await LoadRequiredGraphAsync(context); + await LoadOptionalAkGraphAsync(context); + await LoadRequiredAkGraphAsync(context); + await LoadRequiredCompositeGraphAsync(context); + await LoadRequiredNonPkGraphAsync(context); + await LoadOptionalOneToManyGraphAsync(context); + await LoadRequiredNonPkAkGraphAsync(context); + + var optionalSingle = root.OptionalSingle; + var requiredSingle = root.RequiredSingle; + var optionalSingleAk = root.OptionalSingleAk; + var optionalSingleDerived = root.OptionalSingleDerived; + var requiredSingleAk = root.RequiredSingleAk; + var optionalSingleAkDerived = root.OptionalSingleAkDerived; + var optionalSingleMoreDerived = root.OptionalSingleMoreDerived; + var requiredNonPkSingle = root.RequiredNonPkSingle; + var optionalSingleAkMoreDerived = root.OptionalSingleAkMoreDerived; + var requiredNonPkSingleAk = root.RequiredNonPkSingleAk; + var requiredNonPkSingleDerived = root.RequiredNonPkSingleDerived; + var requiredNonPkSingleAkDerived = root.RequiredNonPkSingleAkDerived; + var requiredNonPkSingleMoreDerived = root.RequiredNonPkSingleMoreDerived; + var requiredNonPkSingleAkMoreDerived = root.RequiredNonPkSingleAkMoreDerived; + + Assert.Same(root, optionalSingle.Root); + Assert.Same(root, requiredSingle.Root); + Assert.Same(root, optionalSingleAk.Root); + Assert.Same(root, optionalSingleDerived.DerivedRoot); + Assert.Same(root, requiredSingleAk.Root); + Assert.Same(root, optionalSingleAkDerived.DerivedRoot); + Assert.Same(root, optionalSingleMoreDerived.MoreDerivedRoot); + Assert.Same(root, requiredNonPkSingle.Root); + Assert.Same(root, optionalSingleAkMoreDerived.MoreDerivedRoot); + Assert.Same(root, requiredNonPkSingleAk.Root); + Assert.Same(root, requiredNonPkSingleDerived.DerivedRoot); + Assert.Same(root, requiredNonPkSingleAkDerived.DerivedRoot); + Assert.Same(root, requiredNonPkSingleMoreDerived.MoreDerivedRoot); + Assert.Same(root, requiredNonPkSingleAkMoreDerived.MoreDerivedRoot); + + Assert.True(root.OptionalChildren.All(e => e.Parent == root)); + Assert.True(root.RequiredChildren.All(e => e.Parent == root)); + Assert.True(root.OptionalChildrenAk.All(e => e.Parent == root)); + Assert.True(root.RequiredChildrenAk.All(e => e.Parent == root)); + Assert.True(root.RequiredCompositeChildren.All(e => e.Parent == root)); + + Assert.False(context.ChangeTracker.HasChanges()); + + context.Entry(optionalSingle).State = EntityState.Detached; + context.Entry(requiredSingle).State = EntityState.Detached; + context.Entry(optionalSingleAk).State = EntityState.Detached; + context.Entry(optionalSingleDerived).State = EntityState.Detached; + context.Entry(requiredSingleAk).State = EntityState.Detached; + context.Entry(optionalSingleAkDerived).State = EntityState.Detached; + context.Entry(optionalSingleMoreDerived).State = EntityState.Detached; + context.Entry(requiredNonPkSingle).State = EntityState.Detached; + context.Entry(optionalSingleAkMoreDerived).State = EntityState.Detached; + context.Entry(requiredNonPkSingleAk).State = EntityState.Detached; + context.Entry(requiredNonPkSingleDerived).State = EntityState.Detached; + context.Entry(requiredNonPkSingleAkDerived).State = EntityState.Detached; + context.Entry(requiredNonPkSingleMoreDerived).State = EntityState.Detached; + context.Entry(requiredNonPkSingleAkMoreDerived).State = EntityState.Detached; + + Assert.False(context.ChangeTracker.HasChanges()); + + Assert.NotNull(optionalSingle.Root); + Assert.NotNull(requiredSingle.Root); + Assert.NotNull(optionalSingleAk.Root); + Assert.NotNull(optionalSingleDerived.DerivedRoot); + Assert.NotNull(requiredSingleAk.Root); + Assert.NotNull(optionalSingleAkDerived.DerivedRoot); + Assert.NotNull(optionalSingleMoreDerived.MoreDerivedRoot); + Assert.NotNull(requiredNonPkSingle.Root); + Assert.NotNull(optionalSingleAkMoreDerived.MoreDerivedRoot); + Assert.NotNull(requiredNonPkSingleAk.Root); + Assert.NotNull(requiredNonPkSingleDerived.DerivedRoot); + Assert.NotNull(requiredNonPkSingleAkDerived.DerivedRoot); + Assert.NotNull(requiredNonPkSingleMoreDerived.MoreDerivedRoot); + Assert.NotNull(requiredNonPkSingleAkMoreDerived.MoreDerivedRoot); + + Assert.True(root.OptionalChildren.All(e => e.Parent != null)); + Assert.True(root.RequiredChildren.All(e => e.Parent != null)); + Assert.True(root.OptionalChildrenAk.All(e => e.Parent != null)); + Assert.True(root.RequiredChildrenAk.All(e => e.Parent != null)); + Assert.True(root.RequiredCompositeChildren.All(e => e.Parent != null)); + }); [ConditionalFact] public virtual Task Detaching_dependent_entity_will_not_remove_references_to_it() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var root = await LoadOptionalGraphAsync(context); - await LoadRequiredGraphAsync(context); - await LoadOptionalAkGraphAsync(context); - await LoadRequiredAkGraphAsync(context); - await LoadRequiredCompositeGraphAsync(context); - await LoadRequiredNonPkGraphAsync(context); - await LoadOptionalOneToManyGraphAsync(context); - await LoadRequiredNonPkAkGraphAsync(context); - - var optionalSingle = root.OptionalSingle; - var requiredSingle = root.RequiredSingle; - var optionalSingleAk = root.OptionalSingleAk; - var optionalSingleDerived = root.OptionalSingleDerived; - var requiredSingleAk = root.RequiredSingleAk; - var optionalSingleAkDerived = root.OptionalSingleAkDerived; - var optionalSingleMoreDerived = root.OptionalSingleMoreDerived; - var requiredNonPkSingle = root.RequiredNonPkSingle; - var optionalSingleAkMoreDerived = root.OptionalSingleAkMoreDerived; - var requiredNonPkSingleAk = root.RequiredNonPkSingleAk; - var requiredNonPkSingleDerived = root.RequiredNonPkSingleDerived; - var requiredNonPkSingleAkDerived = root.RequiredNonPkSingleAkDerived; - var requiredNonPkSingleMoreDerived = root.RequiredNonPkSingleMoreDerived; - var requiredNonPkSingleAkMoreDerived = root.RequiredNonPkSingleAkMoreDerived; - - var optionalChildren = root.OptionalChildren; - var requiredChildren = root.RequiredChildren; - var optionalChildrenAk = root.OptionalChildrenAk; - var requiredChildrenAk = root.RequiredChildrenAk; - var requiredCompositeChildren = root.RequiredCompositeChildren; - var optionalChild = optionalChildren.First(); - var requiredChild = requiredChildren.First(); - var optionalChildAk = optionalChildrenAk.First(); - var requieredChildAk = requiredChildrenAk.First(); - var requiredCompositeChild = requiredCompositeChildren.First(); - - Assert.Same(root, optionalSingle.Root); - Assert.Same(root, requiredSingle.Root); - Assert.Same(root, optionalSingleAk.Root); - Assert.Same(root, optionalSingleDerived.DerivedRoot); - Assert.Same(root, requiredSingleAk.Root); - Assert.Same(root, optionalSingleAkDerived.DerivedRoot); - Assert.Same(root, optionalSingleMoreDerived.MoreDerivedRoot); - Assert.Same(root, requiredNonPkSingle.Root); - Assert.Same(root, optionalSingleAkMoreDerived.MoreDerivedRoot); - Assert.Same(root, requiredNonPkSingleAk.Root); - Assert.Same(root, requiredNonPkSingleDerived.DerivedRoot); - Assert.Same(root, requiredNonPkSingleAkDerived.DerivedRoot); - Assert.Same(root, requiredNonPkSingleMoreDerived.MoreDerivedRoot); - Assert.Same(root, requiredNonPkSingleAkMoreDerived.MoreDerivedRoot); - - Assert.True(optionalChildren.All(e => e.Parent == root)); - Assert.True(requiredChildren.All(e => e.Parent == root)); - Assert.True(optionalChildrenAk.All(e => e.Parent == root)); - Assert.True(requiredChildrenAk.All(e => e.Parent == root)); - Assert.True(requiredCompositeChildren.All(e => e.Parent == root)); - - Assert.False(context.ChangeTracker.HasChanges()); - - context.Entry(optionalSingle).State = EntityState.Detached; - context.Entry(requiredSingle).State = EntityState.Detached; - context.Entry(optionalSingleAk).State = EntityState.Detached; - context.Entry(optionalSingleDerived).State = EntityState.Detached; - context.Entry(requiredSingleAk).State = EntityState.Detached; - context.Entry(optionalSingleAkDerived).State = EntityState.Detached; - context.Entry(optionalSingleMoreDerived).State = EntityState.Detached; - context.Entry(requiredNonPkSingle).State = EntityState.Detached; - context.Entry(optionalSingleAkMoreDerived).State = EntityState.Detached; - context.Entry(requiredNonPkSingleAk).State = EntityState.Detached; - context.Entry(requiredNonPkSingleDerived).State = EntityState.Detached; - context.Entry(requiredNonPkSingleAkDerived).State = EntityState.Detached; - context.Entry(requiredNonPkSingleMoreDerived).State = EntityState.Detached; - context.Entry(requiredNonPkSingleAkMoreDerived).State = EntityState.Detached; - context.Entry(optionalChild).State = EntityState.Detached; - context.Entry(requiredChild).State = EntityState.Detached; - context.Entry(optionalChildAk).State = EntityState.Detached; - context.Entry(requieredChildAk).State = EntityState.Detached; - - foreach (var overlappingEntry in context.ChangeTracker.Entries()) - { - overlappingEntry.State = EntityState.Detached; - } - - context.Entry(requiredCompositeChild).State = EntityState.Detached; - - Assert.False(context.ChangeTracker.HasChanges()); - - Assert.Same(root, optionalSingle.Root); - Assert.Same(root, requiredSingle.Root); - Assert.Same(root, optionalSingleAk.Root); - Assert.Same(root, optionalSingleDerived.DerivedRoot); - Assert.Same(root, requiredSingleAk.Root); - Assert.Same(root, optionalSingleAkDerived.DerivedRoot); - Assert.Same(root, optionalSingleMoreDerived.MoreDerivedRoot); - Assert.Same(root, requiredNonPkSingle.Root); - Assert.Same(root, optionalSingleAkMoreDerived.MoreDerivedRoot); - Assert.Same(root, requiredNonPkSingleAk.Root); - Assert.Same(root, requiredNonPkSingleDerived.DerivedRoot); - Assert.Same(root, requiredNonPkSingleAkDerived.DerivedRoot); - Assert.Same(root, requiredNonPkSingleMoreDerived.MoreDerivedRoot); - Assert.Same(root, requiredNonPkSingleAkMoreDerived.MoreDerivedRoot); - - Assert.True(optionalChildren.All(e => e.Parent == root)); - Assert.True(requiredChildren.All(e => e.Parent == root)); - Assert.True(optionalChildrenAk.All(e => e.Parent == root)); - Assert.True(requiredChildrenAk.All(e => e.Parent == root)); - Assert.True(requiredCompositeChildren.All(e => e.Parent == root)); - - Assert.NotNull(root.OptionalSingle); - Assert.NotNull(root.RequiredSingle); - Assert.NotNull(root.OptionalSingleAk); - Assert.NotNull(root.OptionalSingleDerived); - Assert.NotNull(root.RequiredSingleAk); - Assert.NotNull(root.OptionalSingleAkDerived); - Assert.NotNull(root.OptionalSingleMoreDerived); - Assert.NotNull(root.RequiredNonPkSingle); - Assert.NotNull(root.OptionalSingleAkMoreDerived); - Assert.NotNull(root.RequiredNonPkSingleAk); - Assert.NotNull(root.RequiredNonPkSingleDerived); - Assert.NotNull(root.RequiredNonPkSingleAkDerived); - Assert.NotNull(root.RequiredNonPkSingleMoreDerived); - Assert.NotNull(root.RequiredNonPkSingleAkMoreDerived); - - Assert.Contains(optionalChild, root.OptionalChildren); - Assert.Contains(requiredChild, root.RequiredChildren); - Assert.Contains(optionalChildAk, root.OptionalChildrenAk); - Assert.Contains(requieredChildAk, root.RequiredChildrenAk); - Assert.Contains(requiredCompositeChild, root.RequiredCompositeChildren); - }); - - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + => ExecuteWithStrategyInTransactionAsync(async context => + { + var root = await LoadOptionalGraphAsync(context); + await LoadRequiredGraphAsync(context); + await LoadOptionalAkGraphAsync(context); + await LoadRequiredAkGraphAsync(context); + await LoadRequiredCompositeGraphAsync(context); + await LoadRequiredNonPkGraphAsync(context); + await LoadOptionalOneToManyGraphAsync(context); + await LoadRequiredNonPkAkGraphAsync(context); + + var optionalSingle = root.OptionalSingle; + var requiredSingle = root.RequiredSingle; + var optionalSingleAk = root.OptionalSingleAk; + var optionalSingleDerived = root.OptionalSingleDerived; + var requiredSingleAk = root.RequiredSingleAk; + var optionalSingleAkDerived = root.OptionalSingleAkDerived; + var optionalSingleMoreDerived = root.OptionalSingleMoreDerived; + var requiredNonPkSingle = root.RequiredNonPkSingle; + var optionalSingleAkMoreDerived = root.OptionalSingleAkMoreDerived; + var requiredNonPkSingleAk = root.RequiredNonPkSingleAk; + var requiredNonPkSingleDerived = root.RequiredNonPkSingleDerived; + var requiredNonPkSingleAkDerived = root.RequiredNonPkSingleAkDerived; + var requiredNonPkSingleMoreDerived = root.RequiredNonPkSingleMoreDerived; + var requiredNonPkSingleAkMoreDerived = root.RequiredNonPkSingleAkMoreDerived; + + var optionalChildren = root.OptionalChildren; + var requiredChildren = root.RequiredChildren; + var optionalChildrenAk = root.OptionalChildrenAk; + var requiredChildrenAk = root.RequiredChildrenAk; + var requiredCompositeChildren = root.RequiredCompositeChildren; + var optionalChild = optionalChildren.First(); + var requiredChild = requiredChildren.First(); + var optionalChildAk = optionalChildrenAk.First(); + var requieredChildAk = requiredChildrenAk.First(); + var requiredCompositeChild = requiredCompositeChildren.First(); + + Assert.Same(root, optionalSingle.Root); + Assert.Same(root, requiredSingle.Root); + Assert.Same(root, optionalSingleAk.Root); + Assert.Same(root, optionalSingleDerived.DerivedRoot); + Assert.Same(root, requiredSingleAk.Root); + Assert.Same(root, optionalSingleAkDerived.DerivedRoot); + Assert.Same(root, optionalSingleMoreDerived.MoreDerivedRoot); + Assert.Same(root, requiredNonPkSingle.Root); + Assert.Same(root, optionalSingleAkMoreDerived.MoreDerivedRoot); + Assert.Same(root, requiredNonPkSingleAk.Root); + Assert.Same(root, requiredNonPkSingleDerived.DerivedRoot); + Assert.Same(root, requiredNonPkSingleAkDerived.DerivedRoot); + Assert.Same(root, requiredNonPkSingleMoreDerived.MoreDerivedRoot); + Assert.Same(root, requiredNonPkSingleAkMoreDerived.MoreDerivedRoot); + + Assert.True(optionalChildren.All(e => e.Parent == root)); + Assert.True(requiredChildren.All(e => e.Parent == root)); + Assert.True(optionalChildrenAk.All(e => e.Parent == root)); + Assert.True(requiredChildrenAk.All(e => e.Parent == root)); + Assert.True(requiredCompositeChildren.All(e => e.Parent == root)); + + Assert.False(context.ChangeTracker.HasChanges()); + + context.Entry(optionalSingle).State = EntityState.Detached; + context.Entry(requiredSingle).State = EntityState.Detached; + context.Entry(optionalSingleAk).State = EntityState.Detached; + context.Entry(optionalSingleDerived).State = EntityState.Detached; + context.Entry(requiredSingleAk).State = EntityState.Detached; + context.Entry(optionalSingleAkDerived).State = EntityState.Detached; + context.Entry(optionalSingleMoreDerived).State = EntityState.Detached; + context.Entry(requiredNonPkSingle).State = EntityState.Detached; + context.Entry(optionalSingleAkMoreDerived).State = EntityState.Detached; + context.Entry(requiredNonPkSingleAk).State = EntityState.Detached; + context.Entry(requiredNonPkSingleDerived).State = EntityState.Detached; + context.Entry(requiredNonPkSingleAkDerived).State = EntityState.Detached; + context.Entry(requiredNonPkSingleMoreDerived).State = EntityState.Detached; + context.Entry(requiredNonPkSingleAkMoreDerived).State = EntityState.Detached; + context.Entry(optionalChild).State = EntityState.Detached; + context.Entry(requiredChild).State = EntityState.Detached; + context.Entry(optionalChildAk).State = EntityState.Detached; + context.Entry(requieredChildAk).State = EntityState.Detached; + + foreach (var overlappingEntry in context.ChangeTracker.Entries()) + { + overlappingEntry.State = EntityState.Detached; + } + + context.Entry(requiredCompositeChild).State = EntityState.Detached; + + Assert.False(context.ChangeTracker.HasChanges()); + + Assert.Same(root, optionalSingle.Root); + Assert.Same(root, requiredSingle.Root); + Assert.Same(root, optionalSingleAk.Root); + Assert.Same(root, optionalSingleDerived.DerivedRoot); + Assert.Same(root, requiredSingleAk.Root); + Assert.Same(root, optionalSingleAkDerived.DerivedRoot); + Assert.Same(root, optionalSingleMoreDerived.MoreDerivedRoot); + Assert.Same(root, requiredNonPkSingle.Root); + Assert.Same(root, optionalSingleAkMoreDerived.MoreDerivedRoot); + Assert.Same(root, requiredNonPkSingleAk.Root); + Assert.Same(root, requiredNonPkSingleDerived.DerivedRoot); + Assert.Same(root, requiredNonPkSingleAkDerived.DerivedRoot); + Assert.Same(root, requiredNonPkSingleMoreDerived.MoreDerivedRoot); + Assert.Same(root, requiredNonPkSingleAkMoreDerived.MoreDerivedRoot); + + Assert.True(optionalChildren.All(e => e.Parent == root)); + Assert.True(requiredChildren.All(e => e.Parent == root)); + Assert.True(optionalChildrenAk.All(e => e.Parent == root)); + Assert.True(requiredChildrenAk.All(e => e.Parent == root)); + Assert.True(requiredCompositeChildren.All(e => e.Parent == root)); + + Assert.NotNull(root.OptionalSingle); + Assert.NotNull(root.RequiredSingle); + Assert.NotNull(root.OptionalSingleAk); + Assert.NotNull(root.OptionalSingleDerived); + Assert.NotNull(root.RequiredSingleAk); + Assert.NotNull(root.OptionalSingleAkDerived); + Assert.NotNull(root.OptionalSingleMoreDerived); + Assert.NotNull(root.RequiredNonPkSingle); + Assert.NotNull(root.OptionalSingleAkMoreDerived); + Assert.NotNull(root.RequiredNonPkSingleAk); + Assert.NotNull(root.RequiredNonPkSingleDerived); + Assert.NotNull(root.RequiredNonPkSingleAkDerived); + Assert.NotNull(root.RequiredNonPkSingleMoreDerived); + Assert.NotNull(root.RequiredNonPkSingleAkMoreDerived); + + Assert.Contains(optionalChild, root.OptionalChildren); + Assert.Contains(requiredChild, root.RequiredChildren); + Assert.Contains(optionalChildAk, root.OptionalChildrenAk); + Assert.Contains(requieredChildAk, root.RequiredChildrenAk); + Assert.Contains(requiredCompositeChild, root.RequiredCompositeChildren); + }); + + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Re_childing_parent_to_new_child_with_delete( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1718,34 +1640,31 @@ public virtual Task Can_add_multiple_dependents_when_multiple_possible_principal } }); - [ConditionalTheory] // Issue #30122 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #30122 public virtual Task Sever_relationship_that_will_later_be_deleted(bool async) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var swedes = await context.Set() - .Include(x => x.Carrot) - .ThenInclude(x => x.Turnips) - .Include(x => x.Swede) - .ThenInclude(x => x.TurnipSwedes) - .SingleAsync(x => x.Id == 1); - - swedes.Carrot.Turnips.Clear(); - swedes.Swede.TurnipSwedes.Clear(); - - _ = async - ? await context.SaveChangesAsync() - : context.SaveChanges(); - - var entries = context.ChangeTracker.Entries(); - Assert.Equal(3, entries.Count()); - Assert.All(entries, e => Assert.Equal(EntityState.Unchanged, e.State)); - Assert.Contains(entries, e => e.Entity.GetType() == typeof(Carrot)); - Assert.Contains(entries, e => e.Entity.GetType() == typeof(Parsnip)); - Assert.Contains(entries, e => e.Entity.GetType() == typeof(Swede)); - }); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var swedes = await context.Set() + .Include(x => x.Carrot) + .ThenInclude(x => x.Turnips) + .Include(x => x.Swede) + .ThenInclude(x => x.TurnipSwedes) + .SingleAsync(x => x.Id == 1); + + swedes.Carrot.Turnips.Clear(); + swedes.Swede.TurnipSwedes.Clear(); + + _ = async + ? await context.SaveChangesAsync() + : context.SaveChanges(); + + var entries = context.ChangeTracker.Entries(); + Assert.Equal(3, entries.Count()); + Assert.All(entries, e => Assert.Equal(EntityState.Unchanged, e.State)); + Assert.Contains(entries, e => e.Entity.GetType() == typeof(Carrot)); + Assert.Contains(entries, e => e.Entity.GetType() == typeof(Parsnip)); + Assert.Contains(entries, e => e.Entity.GetType() == typeof(Swede)); + }); [ConditionalFact] // Issue #32168 public virtual Task Save_changed_owned_one_to_one() @@ -1871,146 +1790,128 @@ void AssertGraph(OwnerRoot ownerRoot) } } - [ConditionalTheory] // Issue #30135 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #30135 public virtual Task Update_root_by_collection_replacement_of_inserted_first_level(bool async) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - await PopulateGraphAsync(context); - var newRoot = BuildNewRoot(firstLevel1: true, secondLevel1: true, thirdLevel1: true, firstLevel2: true); + => ExecuteWithStrategyInTransactionAsync(async context => + { + await PopulateGraphAsync(context); + var newRoot = BuildNewRoot(firstLevel1: true, secondLevel1: true, thirdLevel1: true, firstLevel2: true); - Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); - if (await UpdateRoot(context, newRoot, async)) - { - Assert.Equal( - Fixture.HasIdentityResolution || !Fixture.AutoDetectChanges ? 1 : 2, - context.Set().Count(x => x.BayazId == 1)); - } - }); + if (await UpdateRoot(context, newRoot, async)) + { + Assert.Equal( + Fixture.HasIdentityResolution || !Fixture.AutoDetectChanges ? 1 : 2, + context.Set().Count(x => x.BayazId == 1)); + } + }); - [ConditionalTheory] // Issue #30135 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #30135 public virtual Task Update_root_by_collection_replacement_of_deleted_first_level(bool async) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - await PopulateGraphAsync(context); - var newRoot = BuildNewRoot(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + await PopulateGraphAsync(context); + var newRoot = BuildNewRoot(); - Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); - if (await UpdateRoot(context, newRoot, async)) - { - Assert.Equal(Fixture.AutoDetectChanges ? 0 : 1, context.Set().Count(x => x.BayazId == 1)); - } - }); + if (await UpdateRoot(context, newRoot, async)) + { + Assert.Equal(Fixture.AutoDetectChanges ? 0 : 1, context.Set().Count(x => x.BayazId == 1)); + } + }); - [ConditionalTheory] // Issue #30135 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #30135 public virtual Task Update_root_by_collection_replacement_of_inserted_second_level(bool async) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - await PopulateGraphAsync(context); - var newRoot = BuildNewRoot(firstLevel1: true, secondLevel1: true, thirdLevel1: true, firstLevel2: true, secondLevel2: true); + => ExecuteWithStrategyInTransactionAsync(async context => + { + await PopulateGraphAsync(context); + var newRoot = BuildNewRoot(firstLevel1: true, secondLevel1: true, thirdLevel1: true, firstLevel2: true, secondLevel2: true); - Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); - Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); + Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); - if (await UpdateRoot(context, newRoot, async)) + if (await UpdateRoot(context, newRoot, async)) + { + if (Fixture.AutoDetectChanges) { - if (Fixture.AutoDetectChanges) - { - Assert.Equal(Fixture.HasIdentityResolution ? 1 : 2, context.Set().Count(x => x.BayazId == 1)); - Assert.Equal(Fixture.HasIdentityResolution ? 0 : 2, context.Set().Count(x => x.FirstLawId == 11)); - } - else - { - Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); - Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); - } + Assert.Equal(Fixture.HasIdentityResolution ? 1 : 2, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(Fixture.HasIdentityResolution ? 0 : 2, context.Set().Count(x => x.FirstLawId == 11)); } - }); + else + { + Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); + } + } + }); - [ConditionalTheory] // Issue #30135 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #30135 public virtual Task Update_root_by_collection_replacement_of_deleted_second_level( bool async) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - await PopulateGraphAsync(context); - var newRoot = BuildNewRoot(firstLevel1: true); + => ExecuteWithStrategyInTransactionAsync(async context => + { + await PopulateGraphAsync(context); + var newRoot = BuildNewRoot(firstLevel1: true); - Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); - Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); + Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); - if (await UpdateRoot(context, newRoot, async)) - { - Assert.Equal(Fixture.HasIdentityResolution ? 0 : 1, context.Set().Count(x => x.BayazId == 1)); - Assert.Equal(Fixture.AutoDetectChanges ? 0 : 1, context.Set().Count(x => x.FirstLawId == 11)); - } - }); + if (await UpdateRoot(context, newRoot, async)) + { + Assert.Equal(Fixture.HasIdentityResolution ? 0 : 1, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(Fixture.AutoDetectChanges ? 0 : 1, context.Set().Count(x => x.FirstLawId == 11)); + } + }); - [ConditionalTheory] // Issue #30135 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #30135 public virtual Task Update_root_by_collection_replacement_of_inserted_first_level_level(bool async) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - await PopulateGraphAsync(context); - var newRoot = BuildNewRoot( - firstLevel1: true, secondLevel1: true, thirdLevel1: true, firstLevel2: true, secondLevel2: true, thirdLevel2: true); + => ExecuteWithStrategyInTransactionAsync(async context => + { + await PopulateGraphAsync(context); + var newRoot = BuildNewRoot( + firstLevel1: true, secondLevel1: true, thirdLevel1: true, firstLevel2: true, secondLevel2: true, thirdLevel2: true); - Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); - Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); - Assert.Equal(1, context.Set().Count(x => x.SecondLawId == 111)); + Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); + Assert.Equal(1, context.Set().Count(x => x.SecondLawId == 111)); - if (await UpdateRoot(context, newRoot, async)) + if (await UpdateRoot(context, newRoot, async)) + { + if (Fixture.AutoDetectChanges) { - if (Fixture.AutoDetectChanges) - { - Assert.Equal(Fixture.HasIdentityResolution ? 1 : 2, context.Set().Count(x => x.BayazId == 1)); - Assert.Equal(Fixture.HasIdentityResolution ? 0 : 2, context.Set().Count(x => x.FirstLawId == 11)); - Assert.Equal(Fixture.HasIdentityResolution ? 0 : 2, context.Set().Count(x => x.SecondLawId == 111)); - } - else - { - Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); - Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); - Assert.Equal(1, context.Set().Count(x => x.SecondLawId == 111)); - } + Assert.Equal(Fixture.HasIdentityResolution ? 1 : 2, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(Fixture.HasIdentityResolution ? 0 : 2, context.Set().Count(x => x.FirstLawId == 11)); + Assert.Equal(Fixture.HasIdentityResolution ? 0 : 2, context.Set().Count(x => x.SecondLawId == 111)); } - }); + else + { + Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); + Assert.Equal(1, context.Set().Count(x => x.SecondLawId == 111)); + } + } + }); - [ConditionalTheory] // Issue #30135 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #30135 public virtual Task Update_root_by_collection_replacement_of_deleted_third_level(bool async) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - await PopulateGraphAsync(context); - var newRoot = BuildNewRoot(firstLevel1: true, secondLevel1: true); + => ExecuteWithStrategyInTransactionAsync(async context => + { + await PopulateGraphAsync(context); + var newRoot = BuildNewRoot(firstLevel1: true, secondLevel1: true); - Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); - Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); - Assert.Equal(1, context.Set().Count(x => x.SecondLawId == 111)); + Assert.Equal(1, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(1, context.Set().Count(x => x.FirstLawId == 11)); + Assert.Equal(1, context.Set().Count(x => x.SecondLawId == 111)); - if (await UpdateRoot(context, newRoot, async)) - { - Assert.Equal(Fixture.HasIdentityResolution ? 0 : 1, context.Set().Count(x => x.BayazId == 1)); - Assert.Equal(Fixture.HasIdentityResolution ? 0 : 1, context.Set().Count(x => x.FirstLawId == 11)); - Assert.Equal(Fixture.AutoDetectChanges ? 0 : 1, context.Set().Count(x => x.SecondLawId == 111)); - } - }); + if (await UpdateRoot(context, newRoot, async)) + { + Assert.Equal(Fixture.HasIdentityResolution ? 0 : 1, context.Set().Count(x => x.BayazId == 1)); + Assert.Equal(Fixture.HasIdentityResolution ? 0 : 1, context.Set().Count(x => x.FirstLawId == 11)); + Assert.Equal(Fixture.AutoDetectChanges ? 0 : 1, context.Set().Count(x => x.SecondLawId == 111)); + } + }); protected async Task UpdateRoot(DbContext context, Bayaz newRoot, bool async) { @@ -2027,13 +1928,12 @@ protected async Task UpdateRoot(DbContext context, Bayaz newRoot, bool asy { Assert.Equal( CoreStrings.RelationshipConceptualNullSensitive(nameof(Bayaz), nameof(FirstLaw), "{BayazId: 1}"), - (await Assert.ThrowsAsync( - async () => - { - _ = async - ? await context.SaveChangesAsync() - : context.SaveChanges(); - })).Message); + (await Assert.ThrowsAsync(async () => + { + _ = async + ? await context.SaveChangesAsync() + : context.SaveChanges(); + })).Message); return false; } @@ -2167,50 +2067,40 @@ private static SecondLaw AddSecondLevel(bool thirdLevel1, bool thirdLevel2) return secondLevel; } - [ConditionalTheory] // Issue #28961 and Issue #32385 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #28961 and Issue #32385 public virtual Task Alternate_key_over_foreign_key_doesnt_bypass_delete_behavior(bool async) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var parent = new NaiveParent { Children = { new SneakyChild() } }; - context.Add(parent); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var parent = new NaiveParent { Children = { new SneakyChild() } }; + context.Add(parent); - _ = async - ? await context.SaveChangesAsync() - : context.SaveChanges(); + _ = async + ? await context.SaveChangesAsync() + : context.SaveChanges(); - Assert.Equal(2, context.ChangeTracker.Entries().Count()); + Assert.Equal(2, context.ChangeTracker.Entries().Count()); - parent.Children.Remove(parent.Children.First()); - _ = async - ? await context.SaveChangesAsync() - : context.SaveChanges(); + parent.Children.Remove(parent.Children.First()); + _ = async + ? await context.SaveChangesAsync() + : context.SaveChanges(); - Assert.Equal(1, context.ChangeTracker.Entries().Count()); - }); + Assert.Equal(1, context.ChangeTracker.Entries().Count()); + }); - [ConditionalTheory] // Issue #30764 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #30764 public virtual Task Shadow_skip_navigation_in_base_class_is_handled(bool async) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var entities = async - ? await context.Set().ToListAsync() - : context.Set().ToList(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var entities = async + ? await context.Set().ToListAsync() + : context.Set().ToList(); - Assert.Equal(1, entities.Count); - Assert.Equal(nameof(Lettuce2), context.Entry(entities[0]).Property("Discriminator").CurrentValue); - }); + Assert.Equal(1, entities.Count); + Assert.Equal(nameof(Lettuce2), context.Entry(entities[0]).Property("Discriminator").CurrentValue); + }); - [ConditionalTheory] // Issue #32084 - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(true, false), InlineData(false, true), InlineData(true, true)] // Issue #32084 public virtual Task Mark_explicitly_set_dependent_appropriately_with_any_inheritance_and_stable_generator(bool async, bool useAdd) { var parentId = Guid.NewGuid(); @@ -2264,17 +2154,13 @@ public virtual Task Mark_explicitly_set_dependent_appropriately_with_any_inherit else { Assert.Equal(EntityState.Modified, context.Entry(child).State); - await Assert.ThrowsAsync( - async () => _ = async ? await context.SaveChangesAsync() : context.SaveChanges()); + await Assert.ThrowsAsync(async () + => _ = async ? await context.SaveChangesAsync() : context.SaveChanges()); } }); } - [ConditionalTheory] // Issue #32084 - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(true, false), InlineData(false, true), InlineData(true, true)] // Issue #32084 public virtual Task Mark_explicitly_set_stable_dependent_appropriately(bool async, bool useAdd) { var parentId = Guid.NewGuid(); @@ -2323,11 +2209,7 @@ public virtual Task Mark_explicitly_set_stable_dependent_appropriately(bool asyn }); } - [ConditionalTheory] // Issue #32084 - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(true, false), InlineData(false, true), InlineData(true, true)] // Issue #32084 public virtual Task Mark_explicitly_set_stable_dependent_appropriately_when_deep_in_graph(bool async, bool useAdd) { var parentId = Guid.NewGuid(); diff --git a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToMany.cs b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToMany.cs index 43de76256a9..223a3e2624c 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToMany.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToMany.cs @@ -12,65 +12,63 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class GraphUpdatesTestBase where TFixture : GraphUpdatesTestBase.GraphUpdatesFixtureBase, new() { - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Save_optional_many_to_one_dependents( ChangeMechanism changeMechanism, bool useExistingEntities, @@ -190,65 +188,63 @@ public virtual Task Save_optional_many_to_one_dependents( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Save_required_many_to_one_dependents( ChangeMechanism changeMechanism, bool useExistingEntities, @@ -373,35 +369,34 @@ public virtual Task Save_required_many_to_one_dependents( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)ChangeMechanism.Fk, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)ChangeMechanism.Fk, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] public virtual Task Save_removed_optional_many_to_one_dependents( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -464,35 +459,35 @@ public virtual Task Save_removed_optional_many_to_one_dependents( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)ChangeMechanism.Fk, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)ChangeMechanism.Fk, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] public virtual Task Save_removed_required_many_to_one_dependents( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -619,65 +614,63 @@ public virtual Task Save_removed_required_many_to_one_dependents( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Reparent_to_different_one_to_many( ChangeMechanism changeMechanism, bool useExistingParent, @@ -802,35 +795,35 @@ public virtual Task Reparent_to_different_one_to_many( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)ChangeMechanism.Fk, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)ChangeMechanism.Fk, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] public virtual Task Reparent_dependent_one_to_many( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -920,35 +913,35 @@ public virtual Task Reparent_dependent_one_to_many( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)ChangeMechanism.Fk, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)ChangeMechanism.Fk, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] public virtual Task Reparent_dependent_one_to_many_ak( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -1038,65 +1031,63 @@ public virtual Task Reparent_dependent_one_to_many_ak( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Reparent_one_to_many_overlapping( ChangeMechanism changeMechanism, bool useExistingParent, @@ -1224,75 +1215,73 @@ public virtual Task Reparent_one_to_many_overlapping( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)ChangeMechanism.Fk, null)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)ChangeMechanism.Fk, null)] public virtual Task Mark_modified_one_to_many_overlapping( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; - - var root = await LoadRequiredCompositeGraphAsync(context); - var parent = root.RequiredCompositeChildren.OrderBy(e => e.Id).First(); - var child = parent.CompositeChildren.OrderBy(e => e.Id).First(); - - var childCount = context.Set().Count(); - - if ((changeMechanism & ChangeMechanism.Principal) != 0) - { - context.Entry(parent).Collection(p => p.CompositeChildren).IsModified = true; - } + => ExecuteWithStrategyInTransactionAsync(async context => + { + context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; - if ((changeMechanism & ChangeMechanism.Dependent) != 0) - { - context.Entry(child).Reference(c => c.Parent).IsModified = true; - } + var root = await LoadRequiredCompositeGraphAsync(context); + var parent = root.RequiredCompositeChildren.OrderBy(e => e.Id).First(); + var child = parent.CompositeChildren.OrderBy(e => e.Id).First(); - if ((changeMechanism & ChangeMechanism.Fk) != 0) - { - context.Entry(child).Property(c => c.ParentId).IsModified = true; - } + var childCount = context.Set().Count(); - Assert.True(context.ChangeTracker.HasChanges()); - - await context.SaveChangesAsync(); - - Assert.False(context.ChangeTracker.HasChanges()); - - Assert.Same(child, parent.CompositeChildren.OrderBy(e => e.Id).First()); - Assert.Same(parent, child.Parent); - Assert.Equal(parent.Id, child.ParentId); - Assert.Equal(parent.ParentAlternateId, child.ParentAlternateId); - Assert.Equal(root.AlternateId, child.ParentAlternateId); - Assert.Same(root, child.Root); + if ((changeMechanism & ChangeMechanism.Principal) != 0) + { + context.Entry(parent).Collection(p => p.CompositeChildren).IsModified = true; + } - Assert.Equal(childCount, context.Set().Count()); - }); + if ((changeMechanism & ChangeMechanism.Dependent) != 0) + { + context.Entry(child).Reference(c => c.Parent).IsModified = true; + } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + if ((changeMechanism & ChangeMechanism.Fk) != 0) + { + context.Entry(child).Property(c => c.ParentId).IsModified = true; + } + + Assert.True(context.ChangeTracker.HasChanges()); + + await context.SaveChangesAsync(); + + Assert.False(context.ChangeTracker.HasChanges()); + + Assert.Same(child, parent.CompositeChildren.OrderBy(e => e.Id).First()); + Assert.Same(parent, child.Parent); + Assert.Equal(parent.Id, child.ParentId); + Assert.Equal(parent.ParentAlternateId, child.ParentAlternateId); + Assert.Equal(root.AlternateId, child.ParentAlternateId); + Assert.Same(root, child.Root); + + Assert.Equal(childCount, context.Set().Count()); + }); + + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_many_to_one_dependents_are_cascade_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1329,9 +1318,8 @@ public virtual Task Required_many_to_one_dependents_are_cascade_deleted( context.ChangeTracker.CascadeChanges(); Assert.True( - cascadeRemoved.All( - e => context.Entry(e).State - == (Fixture.ForceClientNoAction ? EntityState.Unchanged : EntityState.Deleted))); + cascadeRemoved.All(e => context.Entry(e).State + == (Fixture.ForceClientNoAction ? EntityState.Unchanged : EntityState.Deleted))); } if (Fixture.ForceClientNoAction) @@ -1376,17 +1364,17 @@ public virtual Task Required_many_to_one_dependents_are_cascade_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_many_to_one_dependent_leaves_can_be_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1439,17 +1427,17 @@ public virtual Task Required_many_to_one_dependent_leaves_can_be_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_many_to_one_dependents_are_orphaned( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1545,80 +1533,80 @@ public virtual Task Optional_many_to_one_dependents_are_orphaned( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_many_to_one_dependents_are_orphaned_with_Added_graph( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) // Issue #29318 - => ExecuteWithStrategyInTransactionAsync( - async context => - { - context.ChangeTracker.CascadeDeleteTiming = cascadeDeleteTiming ?? CascadeTiming.Never; - context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; + => ExecuteWithStrategyInTransactionAsync(async context => + { + context.ChangeTracker.CascadeDeleteTiming = cascadeDeleteTiming ?? CascadeTiming.Never; + context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; - var root = new Root { AlternateId = Guid.NewGuid() }; - var removed = new Optional1 { Parent = root }; - var orphaned = new List { new() { Parent = removed }, new() { Parent = removed } }; + var root = new Root { AlternateId = Guid.NewGuid() }; + var removed = new Optional1 { Parent = root }; + var orphaned = new List { new() { Parent = removed }, new() { Parent = removed } }; - context.AddRange(orphaned); - var removedId = context.Entry(removed).Property(e => e.Id).CurrentValue; - context.Remove(removed); + context.AddRange(orphaned); + var removedId = context.Entry(removed).Property(e => e.Id).CurrentValue; + Assert.NotEqual(0, removedId); + context.Remove(removed); - Assert.Equal(EntityState.Detached, context.Entry(removed).State); + Assert.Equal(EntityState.Detached, context.Entry(removed).State); - if (cascadeDeleteTiming == null) - { - Assert.True(orphaned.All(e => context.Entry(e).State == EntityState.Added)); + if (cascadeDeleteTiming == null) + { + Assert.True(orphaned.All(e => context.Entry(e).State == EntityState.Added)); - context.ChangeTracker.CascadeChanges(); - } + context.ChangeTracker.CascadeChanges(); + } - if (Fixture.ForceClientNoAction) + if (Fixture.ForceClientNoAction) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + foreach (var orphanEntry in orphaned.Select(context.Entry)) { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + Assert.Equal(EntityState.Added, orphanEntry.State); + Assert.Null(orphanEntry.Entity.ParentId); + Assert.Null(orphanEntry.Property(e => e.ParentId).CurrentValue); } - else - { - foreach (var orphanEntry in orphaned.Select(context.Entry)) - { - Assert.Equal(EntityState.Added, orphanEntry.State); - Assert.Null(orphanEntry.Entity.ParentId); - Assert.Null(orphanEntry.Property(e => e.ParentId).CurrentValue); - } - - await context.SaveChangesAsync(); - Assert.False(context.ChangeTracker.HasChanges()); - - Assert.Equal(EntityState.Detached, context.Entry(removed).State); - Assert.True(orphaned.All(e => context.Entry(e).State == EntityState.Unchanged)); + await context.SaveChangesAsync(); - Assert.Empty(root.OptionalChildren); - Assert.Same(root, removed.Parent); - Assert.Equal(2, removed.Children.Count()); - } - }); + Assert.False(context.ChangeTracker.HasChanges()); - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + Assert.Equal(EntityState.Detached, context.Entry(removed).State); + Assert.True(orphaned.All(e => context.Entry(e).State == EntityState.Unchanged)); + + Assert.Empty(root.OptionalChildren); + Assert.Same(root, removed.Parent); + Assert.Equal(2, removed.Children.Count()); + } + }); + + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_many_to_one_dependent_leaves_can_be_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1671,17 +1659,17 @@ public virtual Task Optional_many_to_one_dependent_leaves_can_be_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_many_to_one_dependents_are_cascade_deleted_in_store( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1757,17 +1745,17 @@ public virtual Task Required_many_to_one_dependents_are_cascade_deleted_in_store }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_many_to_one_dependents_are_orphaned_in_store( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1847,17 +1835,17 @@ public virtual Task Optional_many_to_one_dependents_are_orphaned_in_store( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_many_to_one_dependents_are_cascade_deleted_starting_detached( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1941,17 +1929,17 @@ public virtual Task Required_many_to_one_dependents_are_cascade_deleted_starting }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_many_to_one_dependents_are_orphaned_starting_detached( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2045,17 +2033,17 @@ public virtual Task Optional_many_to_one_dependents_are_orphaned_starting_detach }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_many_to_one_dependents_are_cascade_detached_when_Added( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) diff --git a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToManyAk.cs b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToManyAk.cs index 60584ae36ec..1df4b874456 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToManyAk.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToManyAk.cs @@ -12,65 +12,64 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class GraphUpdatesTestBase where TFixture : GraphUpdatesTestBase.GraphUpdatesFixtureBase, new() { - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Save_optional_many_to_one_dependents_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingEntities, @@ -210,65 +209,63 @@ public virtual Task Save_optional_many_to_one_dependents_with_alternate_key( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Save_required_many_to_one_dependents_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingEntities, @@ -420,35 +417,35 @@ public virtual Task Save_required_many_to_one_dependents_with_alternate_key( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)ChangeMechanism.Fk, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)ChangeMechanism.Fk, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] public virtual Task Save_removed_optional_many_to_one_dependents_with_alternate_key( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -521,19 +518,19 @@ public virtual Task Save_removed_optional_many_to_one_dependents_with_alternate_ }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] public virtual Task Save_removed_required_many_to_one_dependents_with_alternate_key( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -646,17 +643,17 @@ public virtual Task Save_removed_required_many_to_one_dependents_with_alternate_ }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orphaned( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -691,9 +688,8 @@ public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orpha context.ChangeTracker.CascadeChanges(); Assert.True( - orphaned.All( - e => context.Entry(e).State - == (Fixture.ForceClientNoAction ? EntityState.Unchanged : EntityState.Modified))); + orphaned.All(e => context.Entry(e).State + == (Fixture.ForceClientNoAction ? EntityState.Unchanged : EntityState.Modified))); } Assert.True(context.ChangeTracker.HasChanges()); @@ -735,17 +731,17 @@ public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orpha }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -842,17 +838,17 @@ public virtual Task Required_many_to_one_dependents_with_alternate_key_are_casca }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -931,17 +927,17 @@ public virtual Task Required_many_to_one_dependents_with_alternate_key_are_casca }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orphaned_in_store( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1035,17 +1031,17 @@ public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orpha }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orphaned_starting_detached( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1132,17 +1128,17 @@ public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orpha }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1233,17 +1229,17 @@ public virtual Task Required_many_to_one_dependents_with_alternate_key_are_casca }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_many_to_one_dependents_with_alternate_key_are_cascade_detached_when_Added( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) diff --git a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOne.cs b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOne.cs index 7b3d7b72d49..555714673fc 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOne.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOne.cs @@ -12,88 +12,85 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class GraphUpdatesTestBase where TFixture : GraphUpdatesTestBase.GraphUpdatesFixtureBase, new() { - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never)] - [InlineData(null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate), + InlineData(CascadeTiming.Never), + InlineData(null)] public virtual Task Optional_one_to_one_relationships_are_one_to_one( CascadeTiming? deleteOrphansTiming) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; - - var root = await context.Set().SingleAsync(IsTheRoot); - - Assert.False(context.ChangeTracker.HasChanges()); - - root.OptionalSingle = new OptionalSingle1(); - - Assert.True(context.ChangeTracker.HasChanges()); - - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - }); - - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + => ExecuteWithStrategyInTransactionAsync(async context => + { + context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; + + var root = await context.Set().SingleAsync(IsTheRoot); + + Assert.False(context.ChangeTracker.HasChanges()); + + root.OptionalSingle = new OptionalSingle1(); + + Assert.True(context.ChangeTracker.HasChanges()); + + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + }); + + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Save_changed_optional_one_to_one( ChangeMechanism changeMechanism, bool useExistingEntities, @@ -234,35 +231,35 @@ public virtual Task Save_changed_optional_one_to_one( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)ChangeMechanism.Fk, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)ChangeMechanism.Fk, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] public virtual Task Sever_optional_one_to_one( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -327,65 +324,63 @@ public virtual Task Sever_optional_one_to_one( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Reparent_optional_one_to_one( ChangeMechanism changeMechanism, bool useExistingRoot, @@ -460,17 +455,17 @@ public virtual Task Reparent_optional_one_to_one( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_one_to_one_are_orphaned( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -541,17 +536,17 @@ public virtual Task Optional_one_to_one_are_orphaned( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_one_to_one_leaf_can_be_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -599,17 +594,17 @@ public virtual Task Optional_one_to_one_leaf_can_be_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_one_to_one_are_orphaned_in_store( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -677,17 +672,17 @@ public virtual Task Optional_one_to_one_are_orphaned_in_store( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_one_to_one_are_orphaned_starting_detached( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -758,58 +753,57 @@ public virtual Task Optional_one_to_one_are_orphaned_starting_detached( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never)] - [InlineData(null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate), + InlineData(CascadeTiming.Never), + InlineData(null)] public virtual Task Required_one_to_one_relationships_are_one_to_one( CascadeTiming? deleteOrphansTiming) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; - - var root = await context.Set().SingleAsync(IsTheRoot); - - Assert.False(context.ChangeTracker.HasChanges()); - - root.RequiredSingle = new RequiredSingle1(); - - Assert.True(context.ChangeTracker.HasChanges()); - - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - }); - - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)ChangeMechanism.Fk, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] + => ExecuteWithStrategyInTransactionAsync(async context => + { + context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; + + var root = await context.Set().SingleAsync(IsTheRoot); + + Assert.False(context.ChangeTracker.HasChanges()); + + root.RequiredSingle = new RequiredSingle1(); + + Assert.True(context.ChangeTracker.HasChanges()); + + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + }); + + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)ChangeMechanism.Fk, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] public virtual async Task Save_required_one_to_one_changed_by_reference( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -824,14 +818,13 @@ public virtual async Task Save_required_one_to_one_changed_by_reference( IReadOnlyList entries = null; RequiredSingle1 old1 = null; RequiredSingle2 old2 = null; - await ExecuteWithStrategyInTransactionAsync( - async context => - { - oldRoot = await LoadRequiredGraphAsync(context); + await ExecuteWithStrategyInTransactionAsync(async context => + { + oldRoot = await LoadRequiredGraphAsync(context); - old1 = oldRoot.RequiredSingle; - old2 = oldRoot.RequiredSingle.Single; - }); + old1 = oldRoot.RequiredSingle; + old2 = oldRoot.RequiredSingle.Single; + }); var new2 = new RequiredSingle2(); var new1 = new RequiredSingle1 { Single = new2 }; @@ -910,65 +903,63 @@ await ExecuteWithStrategyInTransactionAsync( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Save_required_non_PK_one_to_one_changed_by_reference( ChangeMechanism changeMechanism, bool useExistingEntities, @@ -1150,19 +1141,19 @@ public virtual Task Save_required_non_PK_one_to_one_changed_by_reference( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] public virtual Task Sever_required_one_to_one( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -1246,19 +1237,19 @@ public virtual Task Sever_required_one_to_one( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] public virtual Task Sever_required_non_PK_one_to_one( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -1351,65 +1342,63 @@ public virtual Task Sever_required_non_PK_one_to_one( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Reparent_required_one_to_one( ChangeMechanism changeMechanism, bool useExistingRoot, @@ -1436,91 +1425,88 @@ public virtual Task Reparent_required_one_to_one( context.Entry(newRoot).State = useExistingRoot ? EntityState.Unchanged : EntityState.Added; Assert.Equal( - CoreStrings.KeyReadOnly("Id", typeof(RequiredSingle1).Name), - (await Assert.ThrowsAsync( - async () => + CoreStrings.KeyReadOnly("Id", nameof(RequiredSingle1)), + (await Assert.ThrowsAsync(async () => + { + if ((changeMechanism & ChangeMechanism.Principal) != 0) { - if ((changeMechanism & ChangeMechanism.Principal) != 0) - { - newRoot.RequiredSingle = root.RequiredSingle; - } + newRoot.RequiredSingle = root.RequiredSingle; + } - if ((changeMechanism & ChangeMechanism.Dependent) != 0) - { - root.RequiredSingle.Root = newRoot; - } + if ((changeMechanism & ChangeMechanism.Dependent) != 0) + { + root.RequiredSingle.Root = newRoot; + } - if ((changeMechanism & ChangeMechanism.Fk) != 0) - { - root.RequiredSingle.Id = newRoot.Id; - } + if ((changeMechanism & ChangeMechanism.Fk) != 0) + { + root.RequiredSingle.Id = newRoot.Id; + } - newRoot.RequiredSingle = root.RequiredSingle; + newRoot.RequiredSingle = root.RequiredSingle; - await context.SaveChangesAsync(); - })).Message); + await context.SaveChangesAsync(); + })).Message); }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Reparent_required_non_PK_one_to_one( ChangeMechanism changeMechanism, bool useExistingRoot, @@ -1595,17 +1581,17 @@ public virtual Task Reparent_required_non_PK_one_to_one( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_one_to_one_are_cascade_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1686,17 +1672,17 @@ public virtual Task Required_one_to_one_are_cascade_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_one_to_one_leaf_can_be_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1748,17 +1734,17 @@ public virtual Task Required_one_to_one_leaf_can_be_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_non_PK_one_to_one_are_cascade_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1834,17 +1820,17 @@ public virtual Task Required_non_PK_one_to_one_are_cascade_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_non_PK_one_to_one_leaf_can_be_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1891,17 +1877,17 @@ public virtual Task Required_non_PK_one_to_one_leaf_can_be_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_one_to_one_are_cascade_deleted_in_store( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -1968,17 +1954,17 @@ public virtual Task Required_one_to_one_are_cascade_deleted_in_store( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_non_PK_one_to_one_are_cascade_deleted_in_store( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2048,17 +2034,17 @@ public virtual Task Required_non_PK_one_to_one_are_cascade_deleted_in_store( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_one_to_one_are_cascade_deleted_starting_detached( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2143,17 +2129,17 @@ public virtual Task Required_one_to_one_are_cascade_deleted_starting_detached( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_non_PK_one_to_one_are_cascade_deleted_starting_detached( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2229,17 +2215,17 @@ public virtual Task Required_non_PK_one_to_one_are_cascade_deleted_starting_deta }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_one_to_one_are_cascade_detached_when_Added( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2336,17 +2322,17 @@ public virtual Task Required_one_to_one_are_cascade_detached_when_Added( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_non_PK_one_to_one_are_cascade_detached_when_Added( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) diff --git a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOneAk.cs b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOneAk.cs index d4dcd4159fe..45634ea9f8a 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOneAk.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOneAk.cs @@ -12,88 +12,84 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class GraphUpdatesTestBase where TFixture : GraphUpdatesTestBase.GraphUpdatesFixtureBase, new() { - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never)] - [InlineData(null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate), + InlineData(CascadeTiming.Never), + InlineData(null)] public virtual Task Optional_one_to_one_with_AK_relationships_are_one_to_one( CascadeTiming? deleteOrphansTiming) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; - - var root = await context.Set().SingleAsync(IsTheRoot); - - Assert.False(context.ChangeTracker.HasChanges()); - - root.OptionalSingleAk = new OptionalSingleAk1(); - - Assert.True(context.ChangeTracker.HasChanges()); - - await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()); - }); - - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + => ExecuteWithStrategyInTransactionAsync(async context => + { + context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; + + var root = await context.Set().SingleAsync(IsTheRoot); + + Assert.False(context.ChangeTracker.HasChanges()); + + root.OptionalSingleAk = new OptionalSingleAk1(); + + Assert.True(context.ChangeTracker.HasChanges()); + + await Assert.ThrowsAsync(async () => await context.SaveChangesAsync()); + }); + + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), InlineData( + (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Save_changed_optional_one_to_one_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingEntities, @@ -422,35 +418,35 @@ public virtual Task Save_changed_optional_one_to_one_with_alternate_key_in_store }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)ChangeMechanism.Fk, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)ChangeMechanism.Fk, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), null)] public virtual Task Sever_optional_one_to_one_with_alternate_key( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -524,65 +520,63 @@ public virtual Task Sever_optional_one_to_one_with_alternate_key( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Reparent_optional_one_to_one_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingRoot, @@ -666,17 +660,17 @@ public virtual Task Reparent_optional_one_to_one_with_alternate_key( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -762,17 +756,17 @@ public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned_in_store( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -848,17 +842,17 @@ public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned_in_store }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned_starting_detached( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -936,54 +930,53 @@ public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned_starting }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never)] - [InlineData(null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate), + InlineData(CascadeTiming.Never), + InlineData(null)] public virtual Task Required_one_to_one_with_AK_relationships_are_one_to_one( CascadeTiming? deleteOrphansTiming) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; - - var root = await context.Set().SingleAsync(IsTheRoot); - - Assert.False(context.ChangeTracker.HasChanges()); - - root.RequiredSingleAk = new RequiredSingleAk1(); - - Assert.True(context.ChangeTracker.HasChanges()); - - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - }); - - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] + => ExecuteWithStrategyInTransactionAsync(async context => + { + context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; + + var root = await context.Set().SingleAsync(IsTheRoot); + + Assert.False(context.ChangeTracker.HasChanges()); + + root.RequiredSingleAk = new RequiredSingleAk1(); + + Assert.True(context.ChangeTracker.HasChanges()); + + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + }); + + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] public virtual Task Save_required_one_to_one_changed_by_reference_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingEntities, @@ -1156,65 +1149,63 @@ public virtual Task Save_required_one_to_one_changed_by_reference_with_alternate }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Save_required_non_PK_one_to_one_changed_by_reference_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingEntities, @@ -1405,19 +1396,19 @@ public virtual Task Save_required_non_PK_one_to_one_changed_by_reference_with_al }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] public virtual Task Sever_required_one_to_one_with_alternate_key( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -1538,19 +1529,19 @@ public virtual Task Sever_required_one_to_one_with_alternate_key( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, null)] - [InlineData((int)ChangeMechanism.Dependent, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, null), + InlineData((int)ChangeMechanism.Dependent, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), null)] public virtual Task Sever_required_non_PK_one_to_one_with_alternate_key( ChangeMechanism changeMechanism, CascadeTiming? deleteOrphansTiming) @@ -1645,65 +1636,63 @@ public virtual Task Sever_required_non_PK_one_to_one_with_alternate_key( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Reparent_required_one_to_one_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingRoot, @@ -1795,65 +1784,62 @@ public virtual Task Reparent_required_one_to_one_with_alternate_key( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges)] - [InlineData( - (int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate)] - [InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never)] - [InlineData((int)ChangeMechanism.Principal, false, null)] - [InlineData((int)ChangeMechanism.Principal, true, null)] - [InlineData((int)ChangeMechanism.Dependent, false, null)] - [InlineData((int)ChangeMechanism.Dependent, true, null)] - [InlineData((int)ChangeMechanism.Fk, false, null)] - [InlineData((int)ChangeMechanism.Fk, true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.OnSaveChanges), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.OnSaveChanges), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Immediate), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Immediate), + InlineData((int)ChangeMechanism.Principal, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Dependent, true, CascadeTiming.Never), InlineData((int)ChangeMechanism.Fk, false, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Fk, true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, CascadeTiming.Never), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, CascadeTiming.Never), + InlineData((int)ChangeMechanism.Principal, false, null), + InlineData((int)ChangeMechanism.Principal, true, null), + InlineData((int)ChangeMechanism.Dependent, false, null), + InlineData((int)ChangeMechanism.Dependent, true, null), + InlineData((int)ChangeMechanism.Fk, false, null), + InlineData((int)ChangeMechanism.Fk, true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false, null), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false, null), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true, null)] public virtual Task Reparent_required_non_PK_one_to_one_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingRoot, @@ -1928,17 +1914,17 @@ public virtual Task Reparent_required_non_PK_one_to_one_with_alternate_key( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2038,17 +2024,17 @@ public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_deleted( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2124,17 +2110,17 @@ public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_de }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted_in_store( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2204,17 +2190,17 @@ public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted_i }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_deleted_in_store( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2284,17 +2270,17 @@ public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_de }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted_starting_detached( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2390,17 +2376,17 @@ public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted_s }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_deleted_starting_detached( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2476,17 +2462,17 @@ public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_de }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) @@ -2601,17 +2587,17 @@ public virtual Task Required_one_to_one_with_alternate_key_are_cascade_detached_ }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), + InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), + InlineData(CascadeTiming.Never, CascadeTiming.Never), + InlineData(null, null)] public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_detached_when_Added( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) diff --git a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesFixtureBase.cs b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesFixtureBase.cs index 81d2d29fe02..e57b256ac31 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesFixtureBase.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesFixtureBase.cs @@ -25,109 +25,108 @@ public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder build protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId).ValueGeneratedOnAdd(); - - b.HasMany(e => e.RequiredChildren) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - - b.HasMany(e => e.OptionalChildren) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne(e => e.RequiredSingle) - .WithOne(e => e.Root) - .HasForeignKey(e => e.Id); - - b.HasOne(e => e.OptionalSingle) - .WithOne(e => e.Root) - .HasForeignKey(e => e.RootId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne(e => e.OptionalSingleDerived) - .WithOne(e => e.DerivedRoot) - .HasForeignKey(e => e.DerivedRootId) - .OnDelete(DeleteBehavior.ClientSetNull); - - b.HasOne(e => e.OptionalSingleMoreDerived) - .WithOne(e => e.MoreDerivedRoot) - .HasForeignKey(e => e.MoreDerivedRootId) - .OnDelete(DeleteBehavior.ClientSetNull); - - b.HasOne(e => e.RequiredNonPkSingle) - .WithOne(e => e.Root) - .HasForeignKey(e => e.RootId); - - b.HasOne(e => e.RequiredNonPkSingleDerived) - .WithOne(e => e.DerivedRoot) - .HasForeignKey(e => e.DerivedRootId) - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne(e => e.RequiredNonPkSingleMoreDerived) - .WithOne(e => e.MoreDerivedRoot) - .HasForeignKey(e => e.MoreDerivedRootId) - .OnDelete(DeleteBehavior.Restrict); - - b.HasMany(e => e.RequiredChildrenAk) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId); - - b.HasMany(e => e.OptionalChildrenAk) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne(e => e.RequiredSingleAk) - .WithOne(e => e.Root) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.RootId); - - b.HasOne(e => e.OptionalSingleAk) - .WithOne(e => e.Root) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.RootId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne(e => e.OptionalSingleAkDerived) - .WithOne(e => e.DerivedRoot) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.DerivedRootId) - .OnDelete(DeleteBehavior.ClientSetNull); - - b.HasOne(e => e.OptionalSingleAkMoreDerived) - .WithOne(e => e.MoreDerivedRoot) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.MoreDerivedRootId) - .OnDelete(DeleteBehavior.ClientSetNull); - - b.HasOne(e => e.RequiredNonPkSingleAk) - .WithOne(e => e.Root) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.RootId); - - b.HasOne(e => e.RequiredNonPkSingleAkDerived) - .WithOne(e => e.DerivedRoot) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.DerivedRootId) - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne(e => e.RequiredNonPkSingleAkMoreDerived) - .WithOne(e => e.MoreDerivedRoot) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.MoreDerivedRootId) - .OnDelete(DeleteBehavior.Restrict); - - b.HasMany(e => e.RequiredCompositeChildren) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentAlternateId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId).ValueGeneratedOnAdd(); + + b.HasMany(e => e.RequiredChildren) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + + b.HasMany(e => e.OptionalChildren) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne(e => e.RequiredSingle) + .WithOne(e => e.Root) + .HasForeignKey(e => e.Id); + + b.HasOne(e => e.OptionalSingle) + .WithOne(e => e.Root) + .HasForeignKey(e => e.RootId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne(e => e.OptionalSingleDerived) + .WithOne(e => e.DerivedRoot) + .HasForeignKey(e => e.DerivedRootId) + .OnDelete(DeleteBehavior.ClientSetNull); + + b.HasOne(e => e.OptionalSingleMoreDerived) + .WithOne(e => e.MoreDerivedRoot) + .HasForeignKey(e => e.MoreDerivedRootId) + .OnDelete(DeleteBehavior.ClientSetNull); + + b.HasOne(e => e.RequiredNonPkSingle) + .WithOne(e => e.Root) + .HasForeignKey(e => e.RootId); + + b.HasOne(e => e.RequiredNonPkSingleDerived) + .WithOne(e => e.DerivedRoot) + .HasForeignKey(e => e.DerivedRootId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(e => e.RequiredNonPkSingleMoreDerived) + .WithOne(e => e.MoreDerivedRoot) + .HasForeignKey(e => e.MoreDerivedRootId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasMany(e => e.RequiredChildrenAk) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId); + + b.HasMany(e => e.OptionalChildrenAk) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne(e => e.RequiredSingleAk) + .WithOne(e => e.Root) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.RootId); + + b.HasOne(e => e.OptionalSingleAk) + .WithOne(e => e.Root) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.RootId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne(e => e.OptionalSingleAkDerived) + .WithOne(e => e.DerivedRoot) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.DerivedRootId) + .OnDelete(DeleteBehavior.ClientSetNull); + + b.HasOne(e => e.OptionalSingleAkMoreDerived) + .WithOne(e => e.MoreDerivedRoot) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.MoreDerivedRootId) + .OnDelete(DeleteBehavior.ClientSetNull); + + b.HasOne(e => e.RequiredNonPkSingleAk) + .WithOne(e => e.Root) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.RootId); + + b.HasOne(e => e.RequiredNonPkSingleAkDerived) + .WithOne(e => e.DerivedRoot) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.DerivedRootId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(e => e.RequiredNonPkSingleAkMoreDerived) + .WithOne(e => e.MoreDerivedRoot) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.MoreDerivedRootId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasMany(e => e.RequiredCompositeChildren) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentAlternateId); + }); modelBuilder.Entity() .HasMany(e => e.Children) @@ -139,19 +138,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.HasMany(e => e.Children) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasMany(e => e.CompositeChildren) - .WithOne(e => e.Parent2) - .HasForeignKey( - e => new { e.Parent2Id }); - }); + modelBuilder.Entity(b => + { + b.HasMany(e => e.Children) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasMany(e => e.CompositeChildren) + .WithOne(e => e.Parent2) + .HasForeignKey(e => new { e.Parent2Id }); + }); modelBuilder.Entity(); modelBuilder.Entity(); @@ -180,104 +177,91 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId) - .ValueGeneratedOnAdd(); - - b.HasMany(e => e.Children) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId); - - b.HasMany(e => e.CompositeChildren) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.Id, e.AlternateId }) - .HasForeignKey( - e => new { e.ParentId, e.ParentAlternateId }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId) + .ValueGeneratedOnAdd(); + + b.HasMany(e => e.Children) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId); + + b.HasMany(e => e.CompositeChildren) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.Id, e.AlternateId }) + .HasForeignKey(e => new { e.ParentId, e.ParentAlternateId }); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId) - .ValueGeneratedOnAdd(); - - b.HasMany(e => e.Children) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasMany(e => e.CompositeChildren) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.Id, e.AlternateId }) - .HasForeignKey( - e => new { e.ParentId, e.ParentAlternateId }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId) + .ValueGeneratedOnAdd(); + + b.HasMany(e => e.Children) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasMany(e => e.CompositeChildren) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.Id, e.AlternateId }) + .HasForeignKey(e => new { e.ParentId, e.ParentAlternateId }); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId) - .ValueGeneratedOnAdd(); - - b.HasOne(e => e.Single) - .WithOne(e => e.Back) - .HasForeignKey(e => e.BackId) - .HasPrincipalKey(e => e.AlternateId); - - b.HasOne(e => e.SingleComposite) - .WithOne(e => e.Back) - .HasForeignKey( - e => new { e.BackId, e.BackAlternateId }) - .HasPrincipalKey( - e => new { e.Id, e.AlternateId }); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId) - .ValueGeneratedOnAdd(); - - b.HasOne(e => e.Single) - .WithOne(e => e.Back) - .HasForeignKey(e => e.BackId) - .HasPrincipalKey(e => e.AlternateId) - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne(e => e.SingleComposite) - .WithOne(e => e.Back) - .HasForeignKey( - e => new { e.BackId, e.ParentAlternateId }) - .HasPrincipalKey( - e => new { e.Id, e.AlternateId }); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId) + .ValueGeneratedOnAdd(); + + b.HasOne(e => e.Single) + .WithOne(e => e.Back) + .HasForeignKey(e => e.BackId) + .HasPrincipalKey(e => e.AlternateId); + + b.HasOne(e => e.SingleComposite) + .WithOne(e => e.Back) + .HasForeignKey(e => new { e.BackId, e.BackAlternateId }) + .HasPrincipalKey(e => new { e.Id, e.AlternateId }); + }); + + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId) + .ValueGeneratedOnAdd(); + + b.HasOne(e => e.Single) + .WithOne(e => e.Back) + .HasForeignKey(e => e.BackId) + .HasPrincipalKey(e => e.AlternateId) + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne(e => e.SingleComposite) + .WithOne(e => e.Back) + .HasForeignKey(e => new { e.BackId, e.ParentAlternateId }) + .HasPrincipalKey(e => new { e.Id, e.AlternateId }); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId) - .ValueGeneratedOnAdd(); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId) + .ValueGeneratedOnAdd(); - b.HasOne(e => e.Single) - .WithOne(e => e.Back) - .HasForeignKey(e => e.BackId) - .HasPrincipalKey(e => e.AlternateId); - }); + b.HasOne(e => e.Single) + .WithOne(e => e.Back) + .HasForeignKey(e => e.BackId) + .HasPrincipalKey(e => e.AlternateId); + }); modelBuilder.Entity() .Property(e => e.AlternateId) @@ -308,322 +292,291 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .Property(e => e.AlternateId) .ValueGeneratedOnAdd(); - modelBuilder.Entity( - eb => - { - eb.Property(e => e.Id).ValueGeneratedNever(); + modelBuilder.Entity(eb => + { + eb.Property(e => e.Id).ValueGeneratedNever(); - eb.HasKey( - e => new { e.Id, e.ParentAlternateId }); + eb.HasKey(e => new { e.Id, e.ParentAlternateId }); - eb.HasMany(e => e.CompositeChildren) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.Id, e.ParentAlternateId }) - .HasForeignKey( - e => new { e.ParentId, e.ParentAlternateId }); - }); + eb.HasMany(e => e.CompositeChildren) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.Id, e.ParentAlternateId }) + .HasForeignKey(e => new { e.ParentId, e.ParentAlternateId }); + }); - modelBuilder.Entity( - eb => - { - eb.Property(e => e.Id).ValueGeneratedNever(); + modelBuilder.Entity(eb => + { + eb.Property(e => e.Id).ValueGeneratedNever(); - eb.HasKey( - e => new { e.Id, e.ParentAlternateId }); + eb.HasKey(e => new { e.Id, e.ParentAlternateId }); - eb.HasOne(e => e.Root) - .WithMany() - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentAlternateId); - }); + eb.HasOne(e => e.Root) + .WithMany() + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentAlternateId); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - builder => - { - builder.HasMany(x => x.Dependants).WithOne(x => x.Root) - .HasForeignKey(x => new { x.RootId }) - .HasPrincipalKey(x => x.Id) - .OnDelete(DeleteBehavior.Cascade); - - builder.HasMany(x => x.Parents).WithOne(x => x.Root) - .HasForeignKey(x => new { x.RootId }) - .HasPrincipalKey(x => x.Id) - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity( - builder => - { - builder.HasOne(x => x.Dependant).WithOne(x => x!.Parent).IsRequired(false) - .HasForeignKey(x => new { x.RootId, x.DependantId }) - .HasPrincipalKey(x => new { x.RootId, x.Id }) - .OnDelete(DeleteBehavior.ClientSetNull); - }); + modelBuilder.Entity(builder => + { + builder.HasMany(x => x.Dependants).WithOne(x => x.Root) + .HasForeignKey(x => new { x.RootId }) + .HasPrincipalKey(x => x.Id) + .OnDelete(DeleteBehavior.Cascade); + + builder.HasMany(x => x.Parents).WithOne(x => x.Root) + .HasForeignKey(x => new { x.RootId }) + .HasPrincipalKey(x => x.Id) + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity(builder => + { + builder.HasOne(x => x.Dependant).WithOne(x => x!.Parent).IsRequired(false) + .HasForeignKey(x => new { x.RootId, x.DependantId }) + .HasPrincipalKey(x => new { x.RootId, x.Id }) + .OnDelete(DeleteBehavior.ClientSetNull); + }); modelBuilder.Entity(); - modelBuilder.Entity( - p => - { - p.HasKey(tp => tp.Id); - }); + modelBuilder.Entity(p => + { + p.HasKey(tp => tp.Id); + }); - modelBuilder.Entity( - c => - { - c.HasKey(tc => tc.Id); - c.HasOne(tc => tc.Owner) - .WithOne(tp => tp.Vehicle) - .HasForeignKey("fk_PersonId") - .IsRequired(); - }); + modelBuilder.Entity(c => + { + c.HasKey(tc => tc.Id); + c.HasOne(tc => tc.Owner) + .WithOne(tp => tp.Vehicle) + .HasForeignKey("fk_PersonId") + .IsRequired(); + }); modelBuilder.Entity(); } protected virtual object CreateFullGraph(DbContext context) - => context.CreateProxy( - e => + => context.CreateProxy(e => + { + e.AlternateId = RootAK; + + e.RequiredChildren = new ObservableHashSet(ReferenceEqualityComparer.Instance) { - e.AlternateId = RootAK; + context.CreateProxy(e => + { + e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(), context.Set().CreateProxy() + }; + }), + context.CreateProxy(e => + { + e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(), context.Set().CreateProxy() + }; + }) + }; - e.RequiredChildren = new ObservableHashSet(ReferenceEqualityComparer.Instance) + e.OptionalChildren = new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(e => { - context.CreateProxy( - e => - { - e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(), context.Set().CreateProxy() - }; - }), - context.CreateProxy( - e => - { - e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(), context.Set().CreateProxy() - }; - }) - }; - - e.OptionalChildren = new ObservableHashSet(ReferenceEqualityComparer.Instance) + e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(), context.Set().CreateProxy() + }; + + e.CompositeChildren = + new ObservableHashSet(ReferenceEqualityComparer.Instance); + }), + context.Set().CreateProxy(e => { - context.Set().CreateProxy( - e => - { - e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(), context.Set().CreateProxy() - }; - - e.CompositeChildren = - new ObservableHashSet(ReferenceEqualityComparer.Instance); - }), - context.Set().CreateProxy( - e => - { - e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(), context.Set().CreateProxy() - }; + e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(), context.Set().CreateProxy() + }; - e.CompositeChildren = - new ObservableHashSet(ReferenceEqualityComparer.Instance); - }) - }; + e.CompositeChildren = + new ObservableHashSet(ReferenceEqualityComparer.Instance); + }) + }; - e.RequiredSingle = context.CreateProxy( - e => e.Single = context.Set().CreateProxy()); + e.RequiredSingle = context.CreateProxy(e => e.Single = context.Set().CreateProxy()); - e.OptionalSingle = context.CreateProxy( - e => e.Single = context.Set().CreateProxy()); + e.OptionalSingle = context.CreateProxy(e => e.Single = context.Set().CreateProxy()); - e.OptionalSingleDerived = context.CreateProxy( - e => e.Single = context.Set().CreateProxy()); + e.OptionalSingleDerived = + context.CreateProxy(e => e.Single = context.Set().CreateProxy()); - e.OptionalSingleMoreDerived = context.CreateProxy( - e => e.Single = context.Set().CreateProxy()); + e.OptionalSingleMoreDerived = + context.CreateProxy(e + => e.Single = context.Set().CreateProxy()); - e.RequiredNonPkSingle = context.CreateProxy( - e => e.Single = context.Set().CreateProxy()); + e.RequiredNonPkSingle = + context.CreateProxy(e => e.Single = context.Set().CreateProxy()); - e.RequiredNonPkSingleDerived = context.CreateProxy( - e => - { - e.Single = context.Set().CreateProxy(); - e.Root = context.Set().CreateProxy(); - }); + e.RequiredNonPkSingleDerived = context.CreateProxy(e => + { + e.Single = context.Set().CreateProxy(); + e.Root = context.Set().CreateProxy(); + }); - e.RequiredNonPkSingleMoreDerived = context.CreateProxy( - e => - { - e.Single = context.Set().CreateProxy(); - e.Root = context.Set().CreateProxy(); - e.DerivedRoot = context.Set().CreateProxy(); - }); + e.RequiredNonPkSingleMoreDerived = context.CreateProxy(e => + { + e.Single = context.Set().CreateProxy(); + e.Root = context.Set().CreateProxy(); + e.DerivedRoot = context.Set().CreateProxy(); + }); - e.RequiredChildrenAk = new ObservableHashSet(ReferenceEqualityComparer.Instance) + e.RequiredChildrenAk = new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(e => { - context.Set().CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - - e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()), - context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()) - }; - - e.CompositeChildren = - new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(), context.Set().CreateProxy() - }; - }), - context.Set().CreateProxy( - e => + e.AlternateId = Guid.NewGuid(); + + e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()), + context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()) + }; + + e.CompositeChildren = + new ObservableHashSet(ReferenceEqualityComparer.Instance) { - e.AlternateId = Guid.NewGuid(); - - e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()), - context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()) - }; - - e.CompositeChildren = - new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(), context.Set().CreateProxy() - }; - }) - }; - - e.OptionalChildrenAk = new ObservableHashSet(ReferenceEqualityComparer.Instance) + context.Set().CreateProxy(), context.Set().CreateProxy() + }; + }), + context.Set().CreateProxy(e => { - context.Set().CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - - e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()), - context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()) - }; - e.CompositeChildren = - new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(), context.Set().CreateProxy() - }; - }), - context.Set().CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - - e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()), - context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()) - }; - - e.CompositeChildren = - new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.Set().CreateProxy(), context.Set().CreateProxy() - }; - }) - }; - - e.RequiredSingleAk = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - e.SingleComposite = context.CreateProxy(); - }); + e.AlternateId = Guid.NewGuid(); - e.OptionalSingleAk = context.CreateProxy( - e => + e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) { - e.AlternateId = Guid.NewGuid(); - e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - e.SingleComposite = context.CreateProxy(); - }); + context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()), + context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()) + }; - e.OptionalSingleAkDerived = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - }); + e.CompositeChildren = + new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(), context.Set().CreateProxy() + }; + }) + }; - e.OptionalSingleAkMoreDerived = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - }); + e.OptionalChildrenAk = new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); - e.RequiredNonPkSingleAk = context.CreateProxy( - e => + e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) { - e.AlternateId = Guid.NewGuid(); - e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - }); + context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()), + context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()) + }; + e.CompositeChildren = + new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(), context.Set().CreateProxy() + }; + }), + context.Set().CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); - e.RequiredNonPkSingleAkDerived = context.CreateProxy( - e => + e.Children = new ObservableHashSet(ReferenceEqualityComparer.Instance) { - e.AlternateId = Guid.NewGuid(); - e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - e.Root = context.CreateProxy(); - }); + context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()), + context.Set().CreateProxy(e => e.AlternateId = Guid.NewGuid()) + }; - e.RequiredNonPkSingleAkMoreDerived = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - e.Root = context.CreateProxy(); - e.DerivedRoot = context.CreateProxy(); - }); + e.CompositeChildren = + new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(), context.Set().CreateProxy() + }; + }) + }; + + e.RequiredSingleAk = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); + e.SingleComposite = context.CreateProxy(); + }); - e.RequiredCompositeChildren = new ObservableHashSet(ReferenceEqualityComparer.Instance) + e.OptionalSingleAk = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); + e.SingleComposite = context.CreateProxy(); + }); + + e.OptionalSingleAkDerived = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); + }); + + e.OptionalSingleAkMoreDerived = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); + }); + + e.RequiredNonPkSingleAk = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); + }); + + e.RequiredNonPkSingleAkDerived = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); + e.Root = context.CreateProxy(); + }); + + e.RequiredNonPkSingleAkMoreDerived = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); + e.Root = context.CreateProxy(); + e.DerivedRoot = context.CreateProxy(); + }); + + e.RequiredCompositeChildren = new ObservableHashSet(ReferenceEqualityComparer.Instance) + { + context.Set().CreateProxy(e => { - context.Set().CreateProxy( - e => + e.Id = 1; + + e.CompositeChildren = + new ObservableHashSet(ReferenceEqualityComparer.Instance) { - e.Id = 1; - - e.CompositeChildren = - new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.CreateProxy(e => e.Id = 1), - context.CreateProxy(e => e.Id = 2) - }; - }), - context.Set().CreateProxy( - e => + context.CreateProxy(e => e.Id = 1), + context.CreateProxy(e => e.Id = 2) + }; + }), + context.Set().CreateProxy(e => + { + e.Id = 2; + + e.CompositeChildren = + new ObservableHashSet(ReferenceEqualityComparer.Instance) { - e.Id = 2; - - e.CompositeChildren = - new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.CreateProxy(e => e.Id = 3), - context.CreateProxy(e => e.Id = 4) - }; - }) - }; - }); + context.CreateProxy(e => e.Id = 3), + context.CreateProxy(e => e.Id = 4) + }; + }) + }; + }); protected override Task SeedAsync(DbContext context) { diff --git a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseMiscellaneous.cs b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseMiscellaneous.cs index d690524494a..b8621a695c9 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseMiscellaneous.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseMiscellaneous.cs @@ -16,18 +16,16 @@ public virtual Task Save_two_entity_cycle_with_lazy_loading() context => { context.AddRange( - context.CreateProxy( - car => - { - car.Owner = context.CreateProxy(); - car.Id = Guid.NewGuid(); - }), - context.CreateProxy( - car => - { - car.Owner = context.CreateProxy(); - car.Id = Guid.NewGuid(); - })); + context.CreateProxy(car => + { + car.Owner = context.CreateProxy(); + car.Id = Guid.NewGuid(); + }), + context.CreateProxy(car => + { + car.Owner = context.CreateProxy(); + car.Id = Guid.NewGuid(); + })); context.SaveChanges(); return Task.CompletedTask; @@ -67,11 +65,10 @@ public virtual Task Can_use_record_proxies_with_base_types_to_load_reference() context => { context.AddRange( - context.CreateProxy( - car => - { - car.Owner = context.CreateProxy(); - })); + context.CreateProxy(car => + { + car.Owner = context.CreateProxy(); + })); context.SaveChanges(); return Task.CompletedTask; @@ -95,11 +92,10 @@ public virtual Task Can_use_record_proxies_with_base_types_to_load_collection() context => { context.AddRange( - context.CreateProxy( - car => - { - car.Owner = context.CreateProxy(); - })); + context.CreateProxy(car => + { + car.Owner = context.CreateProxy(); + })); context.SaveChanges(); return Task.CompletedTask; @@ -198,9 +194,7 @@ public virtual Task Avoid_nulling_shared_FK_property_when_deleting() return Task.CompletedTask; }); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual Task Avoid_nulling_shared_FK_property_when_nulling_navigation(bool nullPrincipal) => ExecuteWithStrategyInTransactionAsync( context => @@ -354,121 +348,113 @@ public virtual Task Sometimes_not_calling_DetectChanges_when_required_does_not_t [ConditionalFact] public virtual Task Can_attach_full_required_graph_of_duplicates() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var trackedRoot = await LoadRequiredGraphAsync(context); - var entries = context.ChangeTracker.Entries().ToList(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var trackedRoot = await LoadRequiredGraphAsync(context); + var entries = context.ChangeTracker.Entries().ToList(); - context.Attach(QueryRequiredGraph(context).AsNoTracking().Single(IsTheRoot)); + context.Attach(QueryRequiredGraph(context).AsNoTracking().Single(IsTheRoot)); - AssertEntries(entries, context.ChangeTracker.Entries().ToList()); + AssertEntries(entries, context.ChangeTracker.Entries().ToList()); - Assert.Equal(0, context.SaveChanges()); - }); + Assert.Equal(0, context.SaveChanges()); + }); [ConditionalFact] public virtual Task Can_attach_full_optional_graph_of_duplicates() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var trackedRoot = await LoadOptionalGraphAsync(context); - var entries = context.ChangeTracker.Entries().ToList(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var trackedRoot = await LoadOptionalGraphAsync(context); + var entries = context.ChangeTracker.Entries().ToList(); - context.Attach(QueryOptionalGraph(context).AsNoTracking().Single(IsTheRoot)); + context.Attach(QueryOptionalGraph(context).AsNoTracking().Single(IsTheRoot)); - AssertEntries(entries, context.ChangeTracker.Entries().ToList()); + AssertEntries(entries, context.ChangeTracker.Entries().ToList()); - Assert.Equal(0, context.SaveChanges()); - }); + Assert.Equal(0, context.SaveChanges()); + }); [ConditionalFact] public virtual Task Can_attach_full_required_non_PK_graph_of_duplicates() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var trackedRoot = await LoadRequiredNonPkGraphAsync(context); - var entries = context.ChangeTracker.Entries().ToList(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var trackedRoot = await LoadRequiredNonPkGraphAsync(context); + var entries = context.ChangeTracker.Entries().ToList(); - context.Attach(QueryRequiredNonPkGraph(context).AsNoTracking().Single(IsTheRoot)); + context.Attach(QueryRequiredNonPkGraph(context).AsNoTracking().Single(IsTheRoot)); - AssertEntries(entries, context.ChangeTracker.Entries().ToList()); + AssertEntries(entries, context.ChangeTracker.Entries().ToList()); - Assert.Equal(0, context.SaveChanges()); - }); + Assert.Equal(0, context.SaveChanges()); + }); [ConditionalFact] public virtual Task Can_attach_full_required_AK_graph_of_duplicates() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var trackedRoot = await LoadRequiredAkGraphAsync(context); - var entries = context.ChangeTracker.Entries().ToList(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var trackedRoot = await LoadRequiredAkGraphAsync(context); + var entries = context.ChangeTracker.Entries().ToList(); - context.Attach(QueryRequiredAkGraph(context).AsNoTracking().Single(IsTheRoot)); + context.Attach(QueryRequiredAkGraph(context).AsNoTracking().Single(IsTheRoot)); - AssertEntries(entries, context.ChangeTracker.Entries().ToList()); + AssertEntries(entries, context.ChangeTracker.Entries().ToList()); - Assert.Equal(0, context.SaveChanges()); - }); + Assert.Equal(0, context.SaveChanges()); + }); [ConditionalFact] public virtual Task Can_attach_full_optional_AK_graph_of_duplicates() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var trackedRoot = await LoadOptionalAkGraphAsync(context); - var entries = context.ChangeTracker.Entries().ToList(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var trackedRoot = await LoadOptionalAkGraphAsync(context); + var entries = context.ChangeTracker.Entries().ToList(); - context.Attach(QueryOptionalAkGraph(context).AsNoTracking().Single(IsTheRoot)); + context.Attach(QueryOptionalAkGraph(context).AsNoTracking().Single(IsTheRoot)); - AssertEntries(entries, context.ChangeTracker.Entries().ToList()); + AssertEntries(entries, context.ChangeTracker.Entries().ToList()); - Assert.Equal(0, context.SaveChanges()); - }); + Assert.Equal(0, context.SaveChanges()); + }); [ConditionalFact] public virtual Task Can_attach_full_required_non_PK_AK_graph_of_duplicates() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var trackedRoot = await LoadRequiredNonPkAkGraphAsync(context); - var entries = context.ChangeTracker.Entries().ToList(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var trackedRoot = await LoadRequiredNonPkAkGraphAsync(context); + var entries = context.ChangeTracker.Entries().ToList(); - context.Attach(QueryRequiredNonPkAkGraph(context).AsNoTracking().Single(IsTheRoot)); + context.Attach(QueryRequiredNonPkAkGraph(context).AsNoTracking().Single(IsTheRoot)); - AssertEntries(entries, context.ChangeTracker.Entries().ToList()); + AssertEntries(entries, context.ChangeTracker.Entries().ToList()); - Assert.Equal(0, context.SaveChanges()); - }); + Assert.Equal(0, context.SaveChanges()); + }); [ConditionalFact] public virtual Task Can_attach_full_required_one_to_many_graph_of_duplicates() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var trackedRoot = await LoadOptionalOneToManyGraphAsync(context); - var entries = context.ChangeTracker.Entries().ToList(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var trackedRoot = await LoadOptionalOneToManyGraphAsync(context); + var entries = context.ChangeTracker.Entries().ToList(); - context.Attach(QueryOptionalOneToManyGraph(context).AsNoTracking().Single(IsTheRoot)); + context.Attach(QueryOptionalOneToManyGraph(context).AsNoTracking().Single(IsTheRoot)); - AssertEntries(entries, context.ChangeTracker.Entries().ToList()); + AssertEntries(entries, context.ChangeTracker.Entries().ToList()); - Assert.Equal(0, context.SaveChanges()); - }); + Assert.Equal(0, context.SaveChanges()); + }); [ConditionalFact] public virtual Task Can_attach_full_required_composite_graph_of_duplicates() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var trackedRoot = await LoadRequiredCompositeGraphAsync(context); - var entries = context.ChangeTracker.Entries().ToList(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var trackedRoot = await LoadRequiredCompositeGraphAsync(context); + var entries = context.ChangeTracker.Entries().ToList(); - context.Attach(QueryRequiredCompositeGraph(context).AsNoTracking().Single(IsTheRoot)); + context.Attach(QueryRequiredCompositeGraph(context).AsNoTracking().Single(IsTheRoot)); - AssertEntries(entries, context.ChangeTracker.Entries().ToList()); + AssertEntries(entries, context.ChangeTracker.Entries().ToList()); - Assert.Equal(0, context.SaveChanges()); - }); + Assert.Equal(0, context.SaveChanges()); + }); } diff --git a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToMany.cs b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToMany.cs index 7d8d701c842..cc5c460be6d 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToMany.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToMany.cs @@ -12,21 +12,17 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class ProxyGraphUpdatesTestBase : IClassFixture where TFixture : ProxyGraphUpdatesTestBase.ProxyGraphUpdatesFixtureBase, new() { - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Save_optional_many_to_one_dependents(ChangeMechanism changeMechanism, bool useExistingEntities) { Optional1 new1 = null; @@ -146,21 +142,17 @@ public virtual Task Save_optional_many_to_one_dependents(ChangeMechanism changeM }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Save_required_many_to_one_dependents(ChangeMechanism changeMechanism, bool useExistingEntities) { Root newRoot; @@ -286,14 +278,10 @@ public virtual Task Save_required_many_to_one_dependents(ChangeMechanism changeM }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)ChangeMechanism.Fk)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk))] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal), InlineData((int)ChangeMechanism.Dependent), + InlineData((int)ChangeMechanism.Fk), InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk)), InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] public virtual Task Save_removed_optional_many_to_one_dependents(ChangeMechanism changeMechanism) { Root root; @@ -361,14 +349,10 @@ public virtual Task Save_removed_optional_many_to_one_dependents(ChangeMechanism }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)ChangeMechanism.Fk)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk))] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal), InlineData((int)ChangeMechanism.Dependent), + InlineData((int)ChangeMechanism.Fk), InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk)), InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] public virtual Task Save_removed_required_many_to_one_dependents(ChangeMechanism changeMechanism) { var removed1Id = 0; @@ -435,21 +419,17 @@ public virtual Task Save_removed_required_many_to_one_dependents(ChangeMechanism }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Reparent_to_different_one_to_many(ChangeMechanism changeMechanism, bool useExistingParent) { var compositeCount = 0; @@ -463,8 +443,8 @@ public virtual Task Reparent_to_different_one_to_many(ChangeMechanism changeMech { if (!useExistingParent) { - newParent = context.CreateProxy( - e => e.CompositeChildren = new ObservableHashSet(ReferenceEqualityComparer.Instance)); + newParent = context.CreateProxy(e + => e.CompositeChildren = new ObservableHashSet(ReferenceEqualityComparer.Instance)); context.Set().Add(newParent); context.SaveChanges(); @@ -574,21 +554,17 @@ public virtual Task Reparent_to_different_one_to_many(ChangeMechanism changeMech }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Reparent_one_to_many_overlapping(ChangeMechanism changeMechanism, bool useExistingParent) { Root root = null; @@ -603,17 +579,16 @@ public virtual Task Reparent_one_to_many_overlapping(ChangeMechanism changeMecha { if (!useExistingParent) { - newParent = context.CreateProxy( - e => + newParent = context.CreateProxy(e => + { + e.Id = 3; + e.Parent = context.Set().Single(IsTheRoot); + e.CompositeChildren = new ObservableHashSet(ReferenceEqualityComparer.Instance) { - e.Id = 3; - e.Parent = context.Set().Single(IsTheRoot); - e.CompositeChildren = new ObservableHashSet(ReferenceEqualityComparer.Instance) - { - context.CreateProxy(e => e.Id = 5), - context.CreateProxy(e => e.Id = 6) - }; - }); + context.CreateProxy(e => e.Id = 5), + context.CreateProxy(e => e.Id = 6) + }; + }); context.Set().Add(newParent); context.SaveChanges(); @@ -728,16 +703,11 @@ public virtual Task Reparent_one_to_many_overlapping(ChangeMechanism changeMecha }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_many_to_one_dependents_are_cascade_deleted( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -819,16 +789,11 @@ public virtual Task Required_many_to_one_dependents_are_cascade_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_many_to_one_dependents_are_orphaned( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -921,76 +886,64 @@ public virtual Task Optional_many_to_one_dependents_are_orphaned( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] - [InlineData(null, null)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never), InlineData(null, null)] public virtual Task Optional_many_to_one_dependents_are_orphaned_with_Added_graph( CascadeTiming? cascadeDeleteTiming, CascadeTiming? deleteOrphansTiming) // Issue #29318 - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + context.ChangeTracker.CascadeDeleteTiming = cascadeDeleteTiming ?? CascadeTiming.Never; + context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; + + var root = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); + var removed = context.CreateProxy(e => e.Parent = root); + var orphaned = new List { - context.ChangeTracker.CascadeDeleteTiming = cascadeDeleteTiming ?? CascadeTiming.Never; - context.ChangeTracker.DeleteOrphansTiming = deleteOrphansTiming ?? CascadeTiming.Never; - - var root = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - var removed = context.CreateProxy(e => e.Parent = root); - var orphaned = new List - { - context.CreateProxy(e => e.Parent = removed), context.CreateProxy(e => e.Parent = removed) - }; + context.CreateProxy(e => e.Parent = removed), context.CreateProxy(e => e.Parent = removed) + }; - context.AddRange(orphaned); - var removedId = context.Entry(removed).Property(e => e.Id).CurrentValue; - context.Remove(removed); + context.AddRange(orphaned); + var removedId = context.Entry(removed).Property(e => e.Id).CurrentValue; + context.Remove(removed); - Assert.Equal(EntityState.Detached, context.Entry(removed).State); + Assert.Equal(EntityState.Detached, context.Entry(removed).State); - if (cascadeDeleteTiming == null) - { - Assert.True(orphaned.All(e => context.Entry(e).State == EntityState.Added)); + if (cascadeDeleteTiming == null) + { + Assert.True(orphaned.All(e => context.Entry(e).State == EntityState.Added)); - context.ChangeTracker.CascadeChanges(); - } + context.ChangeTracker.CascadeChanges(); + } - foreach (var orphanEntry in orphaned.Select(context.Entry)) - { - Assert.Equal(EntityState.Added, orphanEntry.State); - Assert.Null(orphanEntry.Entity.ParentId); - Assert.Null(orphanEntry.Property(e => e.ParentId).CurrentValue); - } + foreach (var orphanEntry in orphaned.Select(context.Entry)) + { + Assert.Equal(EntityState.Added, orphanEntry.State); + Assert.Null(orphanEntry.Entity.ParentId); + Assert.Null(orphanEntry.Property(e => e.ParentId).CurrentValue); + } - context.SaveChanges(); + context.SaveChanges(); - Assert.False(context.ChangeTracker.HasChanges()); + Assert.False(context.ChangeTracker.HasChanges()); - Assert.Equal(EntityState.Detached, context.Entry(removed).State); - Assert.True(orphaned.All(e => context.Entry(e).State == EntityState.Unchanged)); + Assert.Equal(EntityState.Detached, context.Entry(removed).State); + Assert.True(orphaned.All(e => context.Entry(e).State == EntityState.Unchanged)); - Assert.Empty(root.OptionalChildren); - Assert.Same(root, removed.Parent); - Assert.Equal(2, removed.Children.Count()); - return Task.CompletedTask; - }); + Assert.Empty(root.OptionalChildren); + Assert.Same(root, removed.Parent); + Assert.Equal(2, removed.Children.Count()); + return Task.CompletedTask; + }); - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_many_to_one_dependents_are_cascade_deleted_in_store( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1067,16 +1020,11 @@ public virtual Task Required_many_to_one_dependents_are_cascade_deleted_in_store }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_many_to_one_dependents_are_orphaned_in_store( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1159,16 +1107,11 @@ public virtual Task Optional_many_to_one_dependents_are_orphaned_in_store( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_many_to_one_dependents_are_cascade_deleted_starting_detached( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1260,16 +1203,11 @@ public virtual Task Required_many_to_one_dependents_are_cascade_deleted_starting }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_many_to_one_dependents_are_orphaned_starting_detached( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1365,16 +1303,11 @@ public virtual Task Optional_many_to_one_dependents_are_orphaned_starting_detach }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_many_to_one_dependents_are_cascade_detached_when_Added( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) diff --git a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToManyAk.cs b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToManyAk.cs index 9529afe4740..89f2a0d2851 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToManyAk.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToManyAk.cs @@ -12,21 +12,17 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class ProxyGraphUpdatesTestBase : IClassFixture where TFixture : ProxyGraphUpdatesTestBase.ProxyGraphUpdatesFixtureBase, new() { - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Save_optional_many_to_one_dependents_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingEntities) @@ -170,21 +166,17 @@ public virtual Task Save_optional_many_to_one_dependents_with_alternate_key( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Save_required_many_to_one_dependents_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingEntities) @@ -204,50 +196,43 @@ public virtual Task Save_required_many_to_one_dependents_with_alternate_key( context => { newRoot = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - new1 = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Parent = newRoot; - }); - new1d = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Parent = newRoot; - }); - new1dd = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Parent = newRoot; - }); - new2a = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Parent = new1; - }); - new2b = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Parent = new1; - }); + new1 = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Parent = newRoot; + }); + new1d = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Parent = newRoot; + }); + new1dd = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Parent = newRoot; + }); + new2a = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Parent = new1; + }); + new2b = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Parent = new1; + }); new2ca = context.CreateProxy(e => e.Parent = new1); new2cb = context.CreateProxy(e => e.Parent = new1); - new2d = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Parent = new1; - }); - new2dd = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Parent = new1; - }); + new2d = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Parent = new1; + }); + new2dd = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Parent = new1; + }); if (useExistingEntities) { @@ -369,14 +354,10 @@ public virtual Task Save_required_many_to_one_dependents_with_alternate_key( }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)ChangeMechanism.Fk)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk))] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal), InlineData((int)ChangeMechanism.Dependent), + InlineData((int)ChangeMechanism.Fk), InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk)), InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] public virtual Task Save_removed_optional_many_to_one_dependents_with_alternate_key(ChangeMechanism changeMechanism) { Root root; @@ -454,10 +435,8 @@ public virtual Task Save_removed_optional_many_to_one_dependents_with_alternate_ }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Principal), InlineData((int)ChangeMechanism.Dependent), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] public virtual Task Save_removed_required_many_to_one_dependents_with_alternate_key(ChangeMechanism changeMechanism) { Root root = null; @@ -536,16 +515,11 @@ public virtual Task Save_removed_required_many_to_one_dependents_with_alternate_ }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orphaned( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -618,16 +592,11 @@ public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orpha }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -716,16 +685,11 @@ public virtual Task Required_many_to_one_dependents_with_alternate_key_are_casca }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_in_store( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -806,16 +770,11 @@ public virtual Task Required_many_to_one_dependents_with_alternate_key_are_casca }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orphaned_in_store( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -913,16 +872,11 @@ public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orpha }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orphaned_starting_detached( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1012,16 +966,11 @@ public virtual Task Optional_many_to_one_dependents_with_alternate_key_are_orpha }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_many_to_one_dependents_with_alternate_key_are_cascade_deleted_starting_detached( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1121,16 +1070,11 @@ public virtual Task Required_many_to_one_dependents_with_alternate_key_are_casca }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_many_to_one_dependents_with_alternate_key_are_cascade_detached_when_Added( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) diff --git a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOne.cs b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOne.cs index 9d0e3af3e95..45023d93acc 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOne.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOne.cs @@ -14,71 +14,63 @@ public abstract partial class ProxyGraphUpdatesTestBase : IClassFixtur { [ConditionalFact] public virtual Task Optional_one_to_one_relationships_are_one_to_one() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var root = context.Set().Single(IsTheRoot); + => ExecuteWithStrategyInTransactionAsync(context => + { + var root = context.Set().Single(IsTheRoot); - root.OptionalSingle = context.CreateProxy(); + root.OptionalSingle = context.CreateProxy(); - Assert.Throws(() => context.SaveChanges()); - return Task.CompletedTask; - }); + Assert.Throws(() => context.SaveChanges()); + return Task.CompletedTask; + }); [ConditionalFact] public virtual Task Required_one_to_one_relationships_are_one_to_one() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var root = context.Set().Single(IsTheRoot); + => ExecuteWithStrategyInTransactionAsync(context => + { + var root = context.Set().Single(IsTheRoot); - root.RequiredSingle = context.CreateProxy(); + root.RequiredSingle = context.CreateProxy(); - Assert.Throws(() => context.SaveChanges()); - return Task.CompletedTask; - }); + Assert.Throws(() => context.SaveChanges()); + return Task.CompletedTask; + }); [ConditionalFact] public virtual Task Optional_one_to_one_with_AK_relationships_are_one_to_one() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var root = context.Set().Single(IsTheRoot); + => ExecuteWithStrategyInTransactionAsync(context => + { + var root = context.Set().Single(IsTheRoot); - root.OptionalSingleAk = context.CreateProxy(); + root.OptionalSingleAk = context.CreateProxy(); - Assert.Throws(() => context.SaveChanges()); - return Task.CompletedTask; - }); + Assert.Throws(() => context.SaveChanges()); + return Task.CompletedTask; + }); [ConditionalFact] public virtual Task Required_one_to_one_with_AK_relationships_are_one_to_one() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var root = context.Set().Single(IsTheRoot); - - root.RequiredSingleAk = context.CreateProxy(); - - Assert.Throws(() => context.SaveChanges()); - return Task.CompletedTask; - }); - - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + => ExecuteWithStrategyInTransactionAsync(context => + { + var root = context.Set().Single(IsTheRoot); + + root.RequiredSingleAk = context.CreateProxy(); + + Assert.Throws(() => context.SaveChanges()); + return Task.CompletedTask; + }); + + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Save_changed_optional_one_to_one(ChangeMechanism changeMechanism, bool useExistingEntities) { OptionalSingle2 new2 = null; @@ -229,14 +221,10 @@ public virtual Task Save_changed_optional_one_to_one(ChangeMechanism changeMecha }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)ChangeMechanism.Fk)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk))] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent), InlineData((int)ChangeMechanism.Principal), + InlineData((int)ChangeMechanism.Fk), InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk)), InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] public virtual async Task Save_required_one_to_one_changed_by_reference(ChangeMechanism changeMechanism) { RequiredSingle1 old1 = null; @@ -244,93 +232,87 @@ public virtual async Task Save_required_one_to_one_changed_by_reference(ChangeMe Root oldRoot; RequiredSingle2 new2 = null; RequiredSingle1 new1 = null; - await ExecuteWithStrategyInTransactionAsync( - async context => - { - oldRoot = await LoadRootAsync(context); + await ExecuteWithStrategyInTransactionAsync(async context => + { + oldRoot = await LoadRootAsync(context); - if (!DoesLazyLoading) - { - context.Entry(oldRoot).Reference(e => e.RequiredSingle).Load(); - } + if (!DoesLazyLoading) + { + context.Entry(oldRoot).Reference(e => e.RequiredSingle).Load(); + } - old1 = oldRoot.RequiredSingle; + old1 = oldRoot.RequiredSingle; - if (!DoesLazyLoading) - { - context.Entry(old1).Reference(e => e.Single).Load(); - } + if (!DoesLazyLoading) + { + context.Entry(old1).Reference(e => e.Single).Load(); + } - old2 = oldRoot.RequiredSingle.Single; + old2 = oldRoot.RequiredSingle.Single; - context.Entry(oldRoot).State = EntityState.Detached; - context.Entry(old1).State = EntityState.Detached; - context.Entry(old2).State = EntityState.Detached; + context.Entry(oldRoot).State = EntityState.Detached; + context.Entry(old1).State = EntityState.Detached; + context.Entry(old2).State = EntityState.Detached; - new2 = context.CreateProxy(); - new1 = context.CreateProxy(e => e.Single = new2); - }); + new2 = context.CreateProxy(); + new1 = context.CreateProxy(e => e.Single = new2); + }); - await ExecuteWithStrategyInTransactionAsync( - context => - { - var root = context.Set().Include(e => e.RequiredSingle.Single).Single(IsTheRoot); + await ExecuteWithStrategyInTransactionAsync(context => + { + var root = context.Set().Include(e => e.RequiredSingle.Single).Single(IsTheRoot); - context.Entry(root.RequiredSingle.Single).State = EntityState.Deleted; - context.Entry(root.RequiredSingle).State = EntityState.Deleted; + context.Entry(root.RequiredSingle.Single).State = EntityState.Deleted; + context.Entry(root.RequiredSingle).State = EntityState.Deleted; - if ((changeMechanism & ChangeMechanism.Principal) != 0) - { - root.RequiredSingle = new1; - } + if ((changeMechanism & ChangeMechanism.Principal) != 0) + { + root.RequiredSingle = new1; + } - if ((changeMechanism & ChangeMechanism.Dependent) != 0) - { - context.Add(new1); - new1.Root = root; - } + if ((changeMechanism & ChangeMechanism.Dependent) != 0) + { + context.Add(new1); + new1.Root = root; + } - if ((changeMechanism & ChangeMechanism.Fk) != 0) - { - context.Add(new1); - new1.Id = root.Id; - context.Entry(new1).Property(e => e.Id).IsTemporary = false; - context.Entry(new2).Property(e => e.Id).IsTemporary = false; - } + if ((changeMechanism & ChangeMechanism.Fk) != 0) + { + context.Add(new1); + new1.Id = root.Id; + context.Entry(new1).Property(e => e.Id).IsTemporary = false; + context.Entry(new2).Property(e => e.Id).IsTemporary = false; + } - Assert.True(context.ChangeTracker.HasChanges()); + Assert.True(context.ChangeTracker.HasChanges()); - context.SaveChanges(); + context.SaveChanges(); - Assert.False(context.ChangeTracker.HasChanges()); + Assert.False(context.ChangeTracker.HasChanges()); - Assert.Equal(root.Id, new1.Id); - Assert.Equal(new1.Id, new2.Id); - Assert.Same(root, new1.Root); - Assert.Same(new1, new2.Back); + Assert.Equal(root.Id, new1.Id); + Assert.Equal(new1.Id, new2.Id); + Assert.Same(root, new1.Root); + Assert.Same(new1, new2.Back); - Assert.NotNull(old1.Root); - Assert.Same(old1, old2.Back); - Assert.Equal(old1.Id, old2.Id); - return Task.CompletedTask; - }); + Assert.NotNull(old1.Root); + Assert.Same(old1, old2.Back); + Assert.Equal(old1.Id, old2.Id); + return Task.CompletedTask; + }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Save_required_non_PK_one_to_one_changed_by_reference(ChangeMechanism changeMechanism, bool useExistingEntities) { RequiredNonPkSingle2 new2 = null; @@ -354,26 +336,23 @@ public virtual Task Save_required_non_PK_one_to_one_changed_by_reference(ChangeM new2d = context.CreateProxy(); new2dd = context.CreateProxy(); new1 = context.CreateProxy(e => e.Single = new2); - new1d = context.CreateProxy( - e => - { - e.Single = new2d; - e.Root = context.CreateProxy(); - }); - new1dd = context.CreateProxy( - e => - { - e.Single = new2dd; - e.Root = context.CreateProxy(); - e.DerivedRoot = context.CreateProxy(); - }); - newRoot = context.CreateProxy( - e => - { - e.RequiredNonPkSingle = new1; - e.RequiredNonPkSingleDerived = new1d; - e.RequiredNonPkSingleMoreDerived = new1dd; - }); + new1d = context.CreateProxy(e => + { + e.Single = new2d; + e.Root = context.CreateProxy(); + }); + new1dd = context.CreateProxy(e => + { + e.Single = new2dd; + e.Root = context.CreateProxy(); + e.DerivedRoot = context.CreateProxy(); + }); + newRoot = context.CreateProxy(e => + { + e.RequiredNonPkSingle = new1; + e.RequiredNonPkSingleDerived = new1d; + e.RequiredNonPkSingleMoreDerived = new1dd; + }); if (useExistingEntities) { @@ -497,14 +476,10 @@ public virtual Task Save_required_non_PK_one_to_one_changed_by_reference(ChangeM }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)ChangeMechanism.Fk)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk))] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent), InlineData((int)ChangeMechanism.Principal), + InlineData((int)ChangeMechanism.Fk), InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk)), InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] public virtual Task Sever_optional_one_to_one(ChangeMechanism changeMechanism) { Root root; @@ -573,10 +548,8 @@ public virtual Task Sever_optional_one_to_one(ChangeMechanism changeMechanism) }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent), InlineData((int)ChangeMechanism.Principal), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] public virtual Task Sever_required_one_to_one(ChangeMechanism changeMechanism) { Root root = null; @@ -636,10 +609,8 @@ public virtual Task Sever_required_one_to_one(ChangeMechanism changeMechanism) }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent), InlineData((int)ChangeMechanism.Principal), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] public virtual Task Sever_required_non_PK_one_to_one(ChangeMechanism changeMechanism) { Root root; @@ -699,21 +670,17 @@ public virtual Task Sever_required_non_PK_one_to_one(ChangeMechanism changeMecha }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Reparent_optional_one_to_one(ChangeMechanism changeMechanism, bool useExistingRoot) { Root newRoot = null; @@ -795,21 +762,17 @@ public virtual Task Reparent_optional_one_to_one(ChangeMechanism changeMechanism }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Reparent_required_one_to_one(ChangeMechanism changeMechanism, bool useExistingRoot) { Root newRoot = null; @@ -838,47 +801,42 @@ public virtual Task Reparent_required_one_to_one(ChangeMechanism changeMechanism context.Entry(newRoot).State = useExistingRoot ? EntityState.Unchanged : EntityState.Added; Assert.Equal( - CoreStrings.KeyReadOnly("Id", typeof(RequiredSingle1).Name), - Assert.Throws( - () => + CoreStrings.KeyReadOnly("Id", nameof(RequiredSingle1)), + Assert.Throws(() => + { + if ((changeMechanism & ChangeMechanism.Principal) != 0) { - if ((changeMechanism & ChangeMechanism.Principal) != 0) - { - newRoot.RequiredSingle = root.RequiredSingle; - } + newRoot.RequiredSingle = root.RequiredSingle; + } - if ((changeMechanism & ChangeMechanism.Dependent) != 0) - { - root.RequiredSingle.Root = newRoot; - } + if ((changeMechanism & ChangeMechanism.Dependent) != 0) + { + root.RequiredSingle.Root = newRoot; + } - if ((changeMechanism & ChangeMechanism.Fk) != 0) - { - root.RequiredSingle.Id = newRoot.Id; - } + if ((changeMechanism & ChangeMechanism.Fk) != 0) + { + root.RequiredSingle.Id = newRoot.Id; + } - newRoot.RequiredSingle = root.RequiredSingle; + newRoot.RequiredSingle = root.RequiredSingle; - context.SaveChanges(); - }).Message); + context.SaveChanges(); + }).Message); }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Reparent_required_non_PK_one_to_one(ChangeMechanism changeMechanism, bool useExistingRoot) { Root newRoot = null; @@ -960,16 +918,11 @@ public virtual Task Reparent_required_non_PK_one_to_one(ChangeMechanism changeMe }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_one_to_one_are_orphaned( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1030,16 +983,11 @@ public virtual Task Optional_one_to_one_are_orphaned( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_one_to_one_are_cascade_deleted( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1115,16 +1063,11 @@ public virtual Task Required_one_to_one_are_cascade_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_non_PK_one_to_one_are_cascade_deleted( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1200,16 +1143,11 @@ public virtual Task Required_non_PK_one_to_one_are_cascade_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_one_to_one_are_cascade_deleted_in_store( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1303,16 +1241,11 @@ public virtual Task Required_one_to_one_are_cascade_deleted_in_store( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_non_PK_one_to_one_are_cascade_deleted_in_store( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1406,16 +1339,11 @@ public virtual Task Required_non_PK_one_to_one_are_cascade_deleted_in_store( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_one_to_one_are_orphaned_in_store( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1493,16 +1421,11 @@ public virtual Task Optional_one_to_one_are_orphaned_in_store( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_one_to_one_are_orphaned_starting_detached( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1578,16 +1501,11 @@ public virtual Task Optional_one_to_one_are_orphaned_starting_detached( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_one_to_one_are_cascade_deleted_starting_detached( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1674,16 +1592,11 @@ public virtual Task Required_one_to_one_are_cascade_deleted_starting_detached( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_non_PK_one_to_one_are_cascade_deleted_starting_detached( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1770,16 +1683,11 @@ public virtual Task Required_non_PK_one_to_one_are_cascade_deleted_starting_deta }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_one_to_one_are_cascade_detached_when_Added( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1863,16 +1771,11 @@ public virtual Task Required_one_to_one_are_cascade_detached_when_Added( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_non_PK_one_to_one_are_cascade_detached_when_Added( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) diff --git a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOneAk.cs b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOneAk.cs index 6ef5f5f40fd..183eb4c9f5a 100644 --- a/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOneAk.cs +++ b/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOneAk.cs @@ -12,21 +12,21 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class ProxyGraphUpdatesTestBase : IClassFixture where TFixture : ProxyGraphUpdatesTestBase.ProxyGraphUpdatesFixtureBase, new() { - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, + InlineData((int)ChangeMechanism.Dependent, false), + InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), + InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), + InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Save_changed_optional_one_to_one_with_alternate_key(ChangeMechanism changeMechanism, bool useExistingEntities) { OptionalSingleAk2 new2 = null; @@ -51,25 +51,22 @@ public virtual Task Save_changed_optional_one_to_one_with_alternate_key(ChangeMe new2d = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); new2dd = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); new2c = context.CreateProxy(); - new1 = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = new2; - e.SingleComposite = new2c; - }); - new1d = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = new2d; - }); - new1dd = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = new2dd; - }); + new1 = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = new2; + e.SingleComposite = new2c; + }); + new1d = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = new2d; + }); + new1dd = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = new2dd; + }); if (useExistingEntities) { @@ -234,25 +231,22 @@ public virtual Task Save_changed_optional_one_to_one_with_alternate_key_in_store new2d = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); new2dd = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); new2c = context.CreateProxy(); - new1 = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = new2; - e.SingleComposite = new2c; - }); - new1d = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = new2d; - }); - new1dd = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = new2dd; - }); + new1 = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = new2; + e.SingleComposite = new2c; + }); + new1d = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = new2d; + }); + new1dd = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = new2dd; + }); var root = await LoadRootAsync(context); @@ -403,13 +397,10 @@ public virtual Task Save_changed_optional_one_to_one_with_alternate_key_in_store }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] public virtual Task Save_required_one_to_one_changed_by_reference_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingEntities) @@ -427,19 +418,17 @@ public virtual Task Save_required_one_to_one_changed_by_reference_with_alternate { new2 = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); new2c = context.CreateProxy(); - new1 = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = new2; - e.SingleComposite = new2c; - }); - newRoot = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.RequiredSingleAk = new1; - }); + new1 = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = new2; + e.SingleComposite = new2c; + }); + newRoot = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.RequiredSingleAk = new1; + }); if (useExistingEntities) { @@ -524,21 +513,17 @@ public virtual Task Save_required_one_to_one_changed_by_reference_with_alternate }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Save_required_non_PK_one_to_one_changed_by_reference_with_alternate_key( ChangeMechanism changeMechanism, bool useExistingEntities) @@ -563,35 +548,31 @@ public virtual Task Save_required_non_PK_one_to_one_changed_by_reference_with_al new2 = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); new2d = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); new2dd = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - new1 = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = new2; - }); - new1d = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = new2d; - e.Root = context.CreateProxy(); - }); - new1dd = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.Single = new2dd; - e.Root = context.CreateProxy(); - e.DerivedRoot = context.CreateProxy(); - }); - newRoot = context.CreateProxy( - e => - { - e.AlternateId = Guid.NewGuid(); - e.RequiredNonPkSingleAk = new1; - e.RequiredNonPkSingleAkDerived = new1d; - e.RequiredNonPkSingleAkMoreDerived = new1dd; - }); + new1 = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = new2; + }); + new1d = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = new2d; + e.Root = context.CreateProxy(); + }); + new1dd = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.Single = new2dd; + e.Root = context.CreateProxy(); + e.DerivedRoot = context.CreateProxy(); + }); + newRoot = context.CreateProxy(e => + { + e.AlternateId = Guid.NewGuid(); + e.RequiredNonPkSingleAk = new1; + e.RequiredNonPkSingleAkDerived = new1d; + e.RequiredNonPkSingleAkMoreDerived = new1dd; + }); if (useExistingEntities) { @@ -715,14 +696,10 @@ public virtual Task Save_required_non_PK_one_to_one_changed_by_reference_with_al }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)ChangeMechanism.Fk)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk))] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent))] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent), InlineData((int)ChangeMechanism.Principal), + InlineData((int)ChangeMechanism.Fk), InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk)), InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent)), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk))] public virtual Task Sever_optional_one_to_one_with_alternate_key(ChangeMechanism changeMechanism) { Root root = null; @@ -801,10 +778,8 @@ public virtual Task Sever_optional_one_to_one_with_alternate_key(ChangeMechanism }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent), InlineData((int)ChangeMechanism.Principal), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] public virtual Task Sever_required_one_to_one_with_alternate_key(ChangeMechanism changeMechanism) { Root root = null; @@ -871,10 +846,8 @@ public virtual Task Sever_required_one_to_one_with_alternate_key(ChangeMechanism }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent)] - [InlineData((int)ChangeMechanism.Principal)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent), InlineData((int)ChangeMechanism.Principal), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent))] public virtual Task Sever_required_non_PK_one_to_one_with_alternate_key(ChangeMechanism changeMechanism) { Root root = null; @@ -940,21 +913,17 @@ public virtual Task Sever_required_non_PK_one_to_one_with_alternate_key(ChangeMe }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Reparent_optional_one_to_one_with_alternate_key(ChangeMechanism changeMechanism, bool useExistingRoot) { Root newRoot = null; @@ -1044,21 +1013,17 @@ public virtual Task Reparent_optional_one_to_one_with_alternate_key(ChangeMechan }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Reparent_required_one_to_one_with_alternate_key(ChangeMechanism changeMechanism, bool useExistingRoot) { Root newRoot = null; @@ -1150,21 +1115,17 @@ public virtual Task Reparent_required_one_to_one_with_alternate_key(ChangeMechan }); } - [ConditionalTheory] - [InlineData((int)ChangeMechanism.Dependent, false)] - [InlineData((int)ChangeMechanism.Dependent, true)] - [InlineData((int)ChangeMechanism.Principal, false)] - [InlineData((int)ChangeMechanism.Principal, true)] - [InlineData((int)ChangeMechanism.Fk, false)] - [InlineData((int)ChangeMechanism.Fk, true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false)] - [InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false)] - [InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] + [ConditionalTheory, InlineData((int)ChangeMechanism.Dependent, false), InlineData((int)ChangeMechanism.Dependent, true), + InlineData((int)ChangeMechanism.Principal, false), InlineData((int)ChangeMechanism.Principal, true), + InlineData((int)ChangeMechanism.Fk, false), InlineData((int)ChangeMechanism.Fk, true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Fk), true), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), false), + InlineData((int)(ChangeMechanism.Fk | ChangeMechanism.Dependent), true), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), false), + InlineData((int)(ChangeMechanism.Principal | ChangeMechanism.Dependent | ChangeMechanism.Fk), true)] public virtual Task Reparent_required_non_PK_one_to_one_with_alternate_key(ChangeMechanism changeMechanism, bool useExistingRoot) { Root newRoot = null; @@ -1246,16 +1207,11 @@ public virtual Task Reparent_required_non_PK_one_to_one_with_alternate_key(Chang }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1328,16 +1284,11 @@ public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1420,16 +1371,11 @@ public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted( }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_deleted( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1505,16 +1451,11 @@ public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_de }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted_in_store( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1605,16 +1546,11 @@ public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted_i }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_deleted_in_store( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1703,16 +1639,11 @@ public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_de }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned_in_store( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1799,16 +1730,11 @@ public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned_in_store }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned_starting_detached( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1892,16 +1818,11 @@ public virtual Task Optional_one_to_one_with_alternate_key_are_orphaned_starting }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted_starting_detached( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -1996,16 +1917,11 @@ public virtual Task Required_one_to_one_with_alternate_key_are_cascade_deleted_s }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_deleted_starting_detached( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -2092,16 +2008,11 @@ public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_de }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_one_to_one_with_alternate_key_are_cascade_detached_when_Added( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) @@ -2194,16 +2105,11 @@ public virtual Task Required_one_to_one_with_alternate_key_are_cascade_detached_ }); } - [ConditionalTheory] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Immediate, CascadeTiming.Never)] - [InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never, CascadeTiming.Immediate)] - [InlineData(CascadeTiming.Never, CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges, CascadeTiming.Never), + InlineData(CascadeTiming.Immediate, CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Immediate, CascadeTiming.Immediate), + InlineData(CascadeTiming.Immediate, CascadeTiming.Never), InlineData(CascadeTiming.Never, CascadeTiming.OnSaveChanges), + InlineData(CascadeTiming.Never, CascadeTiming.Immediate), InlineData(CascadeTiming.Never, CascadeTiming.Never)] public virtual Task Required_non_PK_one_to_one_with_alternate_key_are_cascade_detached_when_Added( CascadeTiming cascadeDeleteTiming, CascadeTiming deleteOrphansTiming) diff --git a/test/EFCore.Specification.Tests/InterceptionTestBase.cs b/test/EFCore.Specification.Tests/InterceptionTestBase.cs index fb86d3ee0f4..f81f850c697 100644 --- a/test/EFCore.Specification.Tests/InterceptionTestBase.cs +++ b/test/EFCore.Specification.Tests/InterceptionTestBase.cs @@ -59,12 +59,12 @@ public Task CreateContextAsync(IInterceptor appInterceptor, par => SeedAsync( new UniverseContext( Fixture.CreateOptions( - new[] { appInterceptor }, injectedInterceptors))); + [appInterceptor], injectedInterceptors))); public Task CreateContextAsync( IEnumerable appInterceptors, IEnumerable injectedInterceptors = null) - => SeedAsync(new UniverseContext(Fixture.CreateOptions(appInterceptors, injectedInterceptors ?? Enumerable.Empty()))); + => SeedAsync(new UniverseContext(Fixture.CreateOptions(appInterceptors, injectedInterceptors ?? []))); public virtual Task SeedAsync(UniverseContext context) => Task.FromResult(context); diff --git a/test/EFCore.Specification.Tests/JsonTypesTestBase.cs b/test/EFCore.Specification.Tests/JsonTypesTestBase.cs index 12dd330f29a..0782dc005cb 100644 --- a/test/EFCore.Specification.Tests/JsonTypesTestBase.cs +++ b/test/EFCore.Specification.Tests/JsonTypesTestBase.cs @@ -19,11 +19,8 @@ namespace Microsoft.EntityFrameworkCore; public abstract class JsonTypesTestBase(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture { - [ConditionalTheory] - [InlineData(sbyte.MinValue, """{"Prop":-128}""")] - [InlineData(sbyte.MaxValue, """{"Prop":127}""")] - [InlineData((sbyte)0, """{"Prop":0}""")] - [InlineData((sbyte)1, """{"Prop":1}""")] + [ConditionalTheory, InlineData(sbyte.MinValue, """{"Prop":-128}"""), InlineData(sbyte.MaxValue, """{"Prop":127}"""), + InlineData((sbyte)0, """{"Prop":0}"""), InlineData((sbyte)1, """{"Prop":1}""")] public virtual Task Can_read_write_sbyte_JSON_values(sbyte value, string json) => Can_read_and_write_JSON_value(nameof(Int8Type.Int8), value, json); @@ -32,11 +29,8 @@ protected class Int8Type public sbyte Int8 { get; set; } } - [ConditionalTheory] - [InlineData(short.MinValue, """{"Prop":-32768}""")] - [InlineData(short.MaxValue, """{"Prop":32767}""")] - [InlineData((short)0, """{"Prop":0}""")] - [InlineData((short)1, """{"Prop":1}""")] + [ConditionalTheory, InlineData(short.MinValue, """{"Prop":-32768}"""), InlineData(short.MaxValue, """{"Prop":32767}"""), + InlineData((short)0, """{"Prop":0}"""), InlineData((short)1, """{"Prop":1}""")] public virtual Task Can_read_write_short_JSON_values(short value, string json) => Can_read_and_write_JSON_value(nameof(Int16Type.Int16), value, json); @@ -45,11 +39,8 @@ protected class Int16Type public short Int16 { get; set; } } - [ConditionalTheory] - [InlineData(int.MinValue, """{"Prop":-2147483648}""")] - [InlineData(int.MaxValue, """{"Prop":2147483647}""")] - [InlineData(0, """{"Prop":0}""")] - [InlineData(1, """{"Prop":1}""")] + [ConditionalTheory, InlineData(int.MinValue, """{"Prop":-2147483648}"""), InlineData(int.MaxValue, """{"Prop":2147483647}"""), + InlineData(0, """{"Prop":0}"""), InlineData(1, """{"Prop":1}""")] public virtual Task Can_read_write_int_JSON_values(int value, string json) => Can_read_and_write_JSON_value(nameof(Int32Type.Int32), value, json); @@ -58,11 +49,9 @@ protected class Int32Type public int Int32 { get; set; } } - [ConditionalTheory] - [InlineData(long.MinValue, """{"Prop":-9223372036854775808}""")] - [InlineData(long.MaxValue, """{"Prop":9223372036854775807}""")] - [InlineData((long)0, """{"Prop":0}""")] - [InlineData((long)1, """{"Prop":1}""")] + [ConditionalTheory, InlineData(long.MinValue, """{"Prop":-9223372036854775808}"""), + InlineData(long.MaxValue, """{"Prop":9223372036854775807}"""), InlineData((long)0, """{"Prop":0}"""), + InlineData((long)1, """{"Prop":1}""")] public virtual Task Can_read_write_long_JSON_values(long value, string json) => Can_read_and_write_JSON_value(nameof(Int64Type.Int64), value, json); @@ -71,10 +60,8 @@ protected class Int64Type public long Int64 { get; set; } } - [ConditionalTheory] - [InlineData(byte.MinValue, """{"Prop":0}""")] - [InlineData(byte.MaxValue, """{"Prop":255}""")] - [InlineData((byte)1, """{"Prop":1}""")] + [ConditionalTheory, InlineData(byte.MinValue, """{"Prop":0}"""), InlineData(byte.MaxValue, """{"Prop":255}"""), + InlineData((byte)1, """{"Prop":1}""")] public virtual Task Can_read_write_byte_JSON_values(byte value, string json) => Can_read_and_write_JSON_value(nameof(UInt8Type.UInt8), value, json); @@ -83,10 +70,8 @@ protected class UInt8Type public byte UInt8 { get; set; } } - [ConditionalTheory] - [InlineData(ushort.MinValue, """{"Prop":0}""")] - [InlineData(ushort.MaxValue, """{"Prop":65535}""")] - [InlineData((ushort)1, """{"Prop":1}""")] + [ConditionalTheory, InlineData(ushort.MinValue, """{"Prop":0}"""), InlineData(ushort.MaxValue, """{"Prop":65535}"""), + InlineData((ushort)1, """{"Prop":1}""")] public virtual Task Can_read_write_ushort_JSON_values(ushort value, string json) => Can_read_and_write_JSON_value(nameof(UInt16Type.UInt16), value, json); @@ -95,10 +80,8 @@ protected class UInt16Type public ushort UInt16 { get; set; } } - [ConditionalTheory] - [InlineData(uint.MinValue, """{"Prop":0}""")] - [InlineData(uint.MaxValue, """{"Prop":4294967295}""")] - [InlineData((uint)1, """{"Prop":1}""")] + [ConditionalTheory, InlineData(uint.MinValue, """{"Prop":0}"""), InlineData(uint.MaxValue, """{"Prop":4294967295}"""), + InlineData((uint)1, """{"Prop":1}""")] public virtual Task Can_read_write_uint_JSON_values(uint value, string json) => Can_read_and_write_JSON_value(nameof(UInt32Type.UInt32), value, json); @@ -107,10 +90,8 @@ protected class UInt32Type public uint UInt32 { get; set; } } - [ConditionalTheory] - [InlineData(ulong.MinValue, """{"Prop":0}""")] - [InlineData(ulong.MaxValue, """{"Prop":18446744073709551615}""")] - [InlineData((ulong)1, """{"Prop":1}""")] + [ConditionalTheory, InlineData(ulong.MinValue, """{"Prop":0}"""), InlineData(ulong.MaxValue, """{"Prop":18446744073709551615}"""), + InlineData((ulong)1, """{"Prop":1}""")] public virtual Task Can_read_write_ulong_JSON_values(ulong value, string json) => Can_read_and_write_JSON_value(nameof(UInt64Type.UInt64), value, json); @@ -119,11 +100,8 @@ protected class UInt64Type public ulong UInt64 { get; set; } } - [ConditionalTheory] - [InlineData(float.MinValue, """{"Prop":-3.4028235E+38}""")] - [InlineData(float.MaxValue, """{"Prop":3.4028235E+38}""")] - [InlineData((float)0.0, """{"Prop":0}""")] - [InlineData((float)1.1, """{"Prop":1.1}""")] + [ConditionalTheory, InlineData(float.MinValue, """{"Prop":-3.4028235E+38}"""), InlineData(float.MaxValue, """{"Prop":3.4028235E+38}"""), + InlineData((float)0.0, """{"Prop":0}"""), InlineData((float)1.1, """{"Prop":1.1}""")] public virtual Task Can_read_write_float_JSON_values(float value, string json) => Can_read_and_write_JSON_value(nameof(FloatType.Float), value, json); @@ -132,11 +110,9 @@ protected class FloatType public float Float { get; set; } } - [ConditionalTheory] - [InlineData(double.MinValue, """{"Prop":-1.7976931348623157E+308}""")] - [InlineData(double.MaxValue, """{"Prop":1.7976931348623157E+308}""")] - [InlineData(0.0, """{"Prop":0}""")] - [InlineData(1.1, """{"Prop":1.1}""")] + [ConditionalTheory, InlineData(double.MinValue, """{"Prop":-1.7976931348623157E+308}"""), + InlineData(double.MaxValue, """{"Prop":1.7976931348623157E+308}"""), InlineData(0.0, """{"Prop":0}"""), + InlineData(1.1, """{"Prop":1.1}""")] public virtual Task Can_read_write_double_JSON_values(double value, string json) => Can_read_and_write_JSON_value(nameof(DoubleType.Double), value, json); @@ -145,11 +121,9 @@ protected class DoubleType public double Double { get; set; } } - [ConditionalTheory] - [InlineData("-79228162514264337593543950335", """{"Prop":-79228162514264337593543950335}""")] - [InlineData("79228162514264337593543950335", """{"Prop":79228162514264337593543950335}""")] - [InlineData("0.0", """{"Prop":0.0}""")] - [InlineData("1.1", """{"Prop":1.1}""")] + [ConditionalTheory, InlineData("-79228162514264337593543950335", """{"Prop":-79228162514264337593543950335}"""), + InlineData("79228162514264337593543950335", """{"Prop":79228162514264337593543950335}"""), InlineData("0.0", """{"Prop":0.0}"""), + InlineData("1.1", """{"Prop":1.1}""")] public virtual Task Can_read_write_decimal_JSON_values(decimal value, string json) => Can_read_and_write_JSON_value(nameof(DecimalType.Decimal), value, json); @@ -158,10 +132,8 @@ protected class DecimalType public decimal Decimal { get; set; } } - [ConditionalTheory] - [InlineData("1/1/0001", """{"Prop":"0001-01-01"}""")] - [InlineData("12/31/9999", """{"Prop":"9999-12-31"}""")] - [InlineData("5/29/2023", """{"Prop":"2023-05-29"}""")] + [ConditionalTheory, InlineData("1/1/0001", """{"Prop":"0001-01-01"}"""), InlineData("12/31/9999", """{"Prop":"9999-12-31"}"""), + InlineData("5/29/2023", """{"Prop":"2023-05-29"}""")] public virtual Task Can_read_write_DateOnly_JSON_values(string value, string json) => Can_read_and_write_JSON_value( nameof(DateOnlyType.DateOnly), @@ -172,10 +144,8 @@ protected class DateOnlyType public DateOnly DateOnly { get; set; } } - [ConditionalTheory] - [InlineData("00:00:00.0000000", """{"Prop":"00:00:00.0000000"}""")] - [InlineData("23:59:59.9999999", """{"Prop":"23:59:59.9999999"}""")] - [InlineData("11:05:12.3456789", """{"Prop":"11:05:12.3456789"}""")] + [ConditionalTheory, InlineData("00:00:00.0000000", """{"Prop":"00:00:00.0000000"}"""), + InlineData("23:59:59.9999999", """{"Prop":"23:59:59.9999999"}"""), InlineData("11:05:12.3456789", """{"Prop":"11:05:12.3456789"}""")] public virtual Task Can_read_write_TimeOnly_JSON_values(string value, string json) => Can_read_and_write_JSON_value( nameof(TimeOnlyType.TimeOnly), @@ -186,10 +156,9 @@ protected class TimeOnlyType public TimeOnly TimeOnly { get; set; } } - [ConditionalTheory] - [InlineData("0001-01-01T00:00:00.0000000", """{"Prop":"0001-01-01T00:00:00"}""")] - [InlineData("9999-12-31T23:59:59.9999999", """{"Prop":"9999-12-31T23:59:59.9999999"}""")] - [InlineData("2023-05-29T10:52:47.2064353", """{"Prop":"2023-05-29T10:52:47.2064353"}""")] + [ConditionalTheory, InlineData("0001-01-01T00:00:00.0000000", """{"Prop":"0001-01-01T00:00:00"}"""), + InlineData("9999-12-31T23:59:59.9999999", """{"Prop":"9999-12-31T23:59:59.9999999"}"""), + InlineData("2023-05-29T10:52:47.2064353", """{"Prop":"2023-05-29T10:52:47.2064353"}""")] public virtual Task Can_read_write_DateTime_JSON_values(string value, string json) => Can_read_and_write_JSON_value( nameof(DateTimeType.DateTime), @@ -200,11 +169,10 @@ protected class DateTimeType public DateTime DateTime { get; set; } } - [ConditionalTheory] - [InlineData("0001-01-01T00:00:00.0000000-01:00", """{"Prop":"0001-01-01T00:00:00-01:00"}""")] - [InlineData("9999-12-31T23:59:59.9999999+02:00", """{"Prop":"9999-12-31T23:59:59.9999999+02:00"}""")] - [InlineData("0001-01-01T00:00:00.0000000-03:00", """{"Prop":"0001-01-01T00:00:00-03:00"}""")] - [InlineData("2023-05-29T11:11:15.5672854+04:00", """{"Prop":"2023-05-29T11:11:15.5672854+04:00"}""")] + [ConditionalTheory, InlineData("0001-01-01T00:00:00.0000000-01:00", """{"Prop":"0001-01-01T00:00:00-01:00"}"""), + InlineData("9999-12-31T23:59:59.9999999+02:00", """{"Prop":"9999-12-31T23:59:59.9999999+02:00"}"""), + InlineData("0001-01-01T00:00:00.0000000-03:00", """{"Prop":"0001-01-01T00:00:00-03:00"}"""), + InlineData("2023-05-29T11:11:15.5672854+04:00", """{"Prop":"2023-05-29T11:11:15.5672854+04:00"}""")] public virtual Task Can_read_write_DateTimeOffset_JSON_values(string value, string json) => Can_read_and_write_JSON_value( nameof(DateTimeOffsetType.DateTimeOffset), @@ -215,11 +183,9 @@ protected class DateTimeOffsetType public DateTimeOffset DateTimeOffset { get; set; } } - [ConditionalTheory] - [InlineData("-10675199.02:48:05.4775808", """{"Prop":"-10675199:2:48:05.4775808"}""")] - [InlineData("10675199.02:48:05.4775807", """{"Prop":"10675199:2:48:05.4775807"}""")] - [InlineData("00:00:00", """{"Prop":"0:00:00"}""")] - [InlineData("12:23:23.8018854", """{"Prop":"12:23:23.8018854"}""")] + [ConditionalTheory, InlineData("-10675199.02:48:05.4775808", """{"Prop":"-10675199:2:48:05.4775808"}"""), + InlineData("10675199.02:48:05.4775807", """{"Prop":"10675199:2:48:05.4775807"}"""), InlineData("00:00:00", """{"Prop":"0:00:00"}"""), + InlineData("12:23:23.8018854", """{"Prop":"12:23:23.8018854"}""")] public virtual Task Can_read_write_TimeSpan_JSON_values(string value, string json) => Can_read_and_write_JSON_value( nameof(TimeSpanType.TimeSpan), @@ -230,9 +196,7 @@ protected class TimeSpanType public TimeSpan TimeSpan { get; set; } } - [ConditionalTheory] - [InlineData(false, """{"Prop":false}""")] - [InlineData(true, """{"Prop":true}""")] + [ConditionalTheory, InlineData(false, """{"Prop":false}"""), InlineData(true, """{"Prop":true}""")] public virtual Task Can_read_write_bool_JSON_values(bool value, string json) => Can_read_and_write_JSON_value(nameof(BooleanType.Boolean), value, json); @@ -241,11 +205,8 @@ protected class BooleanType public bool Boolean { get; set; } } - [ConditionalTheory] - [InlineData(char.MinValue, """{"Prop":"\u0000"}""")] - [InlineData(char.MaxValue, """{"Prop":"\uFFFF"}""")] - [InlineData(' ', """{"Prop":" "}""")] - [InlineData("Z", """{"Prop":"Z"}""")] + [ConditionalTheory, InlineData(char.MinValue, """{"Prop":"\u0000"}"""), InlineData(char.MaxValue, """{"Prop":"\uFFFF"}"""), + InlineData(' ', """{"Prop":" "}"""), InlineData("Z", """{"Prop":"Z"}""")] public virtual Task Can_read_write_char_JSON_values(char value, string json) => Can_read_and_write_JSON_value(nameof(CharacterType.Character), value, json); @@ -254,10 +215,9 @@ protected class CharacterType public char Character { get; set; } } - [ConditionalTheory] - [InlineData("00000000-0000-0000-0000-000000000000", """{"Prop":"00000000-0000-0000-0000-000000000000"}""")] - [InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF", """{"Prop":"ffffffff-ffff-ffff-ffff-ffffffffffff"}""")] - [InlineData("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD", """{"Prop":"8c44242f-8e3f-4a20-8be8-98c7c1aadebd"}""")] + [ConditionalTheory, InlineData("00000000-0000-0000-0000-000000000000", """{"Prop":"00000000-0000-0000-0000-000000000000"}"""), + InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF", """{"Prop":"ffffffff-ffff-ffff-ffff-ffffffffffff"}"""), + InlineData("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD", """{"Prop":"8c44242f-8e3f-4a20-8be8-98c7c1aadebd"}""")] public virtual Task Can_read_write_GUID_JSON_values(string value, string json) => Can_read_and_write_JSON_value(nameof(GuidType.Guid), new Guid(value), json); @@ -266,13 +226,10 @@ protected class GuidType public Guid Guid { get; set; } } - [ConditionalTheory] - [InlineData("MinValue", """{"Prop":"MinValue"}""")] - [InlineData("MaxValue", """{"Prop":"MaxValue"}""")] - [InlineData("", """{"Prop":""}""")] - [InlineData( - "❤❥웃유♋☮✌☏☢☠✔☑♚▲♪฿Ɖ⛏♥❣♂♀☿👍✍✉☣☤✘☒♛▼♫⌘⌛¡♡ღツ☼☁❅♾️✎©®™Σ✪✯☭➳Ⓐ✞℃℉°✿⚡☃☂✄¢€£∞✫★½☯✡☪", - @"{""Prop"":""\u2764\u2765\uC6C3\uC720\u264B\u262E\u270C\u260F\u2622\u2620\u2714\u2611\u265A\u25B2\u266A\u0E3F\u0189\u26CF\u2665\u2763\u2642\u2640\u263F\uD83D\uDC4D\u270D\u2709\u2623\u2624\u2718\u2612\u265B\u25BC\u266B\u2318\u231B\u00A1\u2661\u10E6\u30C4\u263C\u2601\u2745\u267E\uFE0F\u270E\u00A9\u00AE\u2122\u03A3\u272A\u272F\u262D\u27B3\u24B6\u271E\u2103\u2109\u00B0\u273F\u26A1\u2603\u2602\u2704\u00A2\u20AC\u00A3\u221E\u272B\u2605\u00BD\u262F\u2721\u262A""}")] + [ConditionalTheory, InlineData("MinValue", """{"Prop":"MinValue"}"""), InlineData("MaxValue", """{"Prop":"MaxValue"}"""), + InlineData("", """{"Prop":""}"""), InlineData( + "❤❥웃유♋☮✌☏☢☠✔☑♚▲♪฿Ɖ⛏♥❣♂♀☿👍✍✉☣☤✘☒♛▼♫⌘⌛¡♡ღツ☼☁❅♾️✎©®™Σ✪✯☭➳Ⓐ✞℃℉°✿⚡☃☂✄¢€£∞✫★½☯✡☪", + @"{""Prop"":""\u2764\u2765\uC6C3\uC720\u264B\u262E\u270C\u260F\u2622\u2620\u2714\u2611\u265A\u25B2\u266A\u0E3F\u0189\u26CF\u2665\u2763\u2642\u2640\u263F\uD83D\uDC4D\u270D\u2709\u2623\u2624\u2718\u2612\u265B\u25BC\u266B\u2318\u231B\u00A1\u2661\u10E6\u30C4\u263C\u2601\u2745\u267E\uFE0F\u270E\u00A9\u00AE\u2122\u03A3\u272A\u272F\u262D\u27B3\u24B6\u271E\u2103\u2109\u00B0\u273F\u26A1\u2603\u2602\u2704\u00A2\u20AC\u00A3\u221E\u272B\u2605\u00BD\u262F\u2721\u262A""}")] public virtual Task Can_read_write_string_JSON_values(string value, string json) => Can_read_and_write_JSON_value(nameof(StringType.String), value, json); @@ -281,11 +238,8 @@ protected class StringType public string String { get; set; } = null!; } - [ConditionalTheory] - [InlineData("0,0,0,1", """{"Prop":"AAAAAQ=="}""")] - [InlineData("255,255,255,255", """{"Prop":"/////w=="}""")] - [InlineData("", """{"Prop":""}""")] - [InlineData("1,2,3,4", """{"Prop":"AQIDBA=="}""")] + [ConditionalTheory, InlineData("0,0,0,1", """{"Prop":"AAAAAQ=="}"""), InlineData("255,255,255,255", """{"Prop":"/////w=="}"""), + InlineData("", """{"Prop":""}"""), InlineData("1,2,3,4", """{"Prop":"AQIDBA=="}""")] public virtual Task Can_read_write_binary_JSON_values(string value, string json) => Can_read_and_write_JSON_value( nameof(BytesType.Bytes), @@ -296,11 +250,10 @@ protected class BytesType public byte[] Bytes { get; set; } = null!; } - [ConditionalTheory] - [InlineData( - "https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName", - """{"Prop":"https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1\u0026q2=v2#FragmentName"}""")] - [InlineData("file:///C:/test/path/file.txt", """{"Prop":"file:///C:/test/path/file.txt"}""")] + [ConditionalTheory, InlineData( + "https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName", + """{"Prop":"https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1\u0026q2=v2#FragmentName"}"""), + InlineData("file:///C:/test/path/file.txt", """{"Prop":"file:///C:/test/path/file.txt"}""")] public virtual Task Can_read_write_URI_JSON_values(string value, string json) => Can_read_and_write_JSON_value(nameof(UriType.Uri), new Uri(value), json); @@ -309,14 +262,10 @@ protected class UriType public Uri Uri { get; set; } = null!; } - [ConditionalTheory] - [InlineData("127.0.0.1", """{"Prop":"127.0.0.1"}""")] - [InlineData("0.0.0.0", """{"Prop":"0.0.0.0"}""")] - [InlineData("255.255.255.255", """{"Prop":"255.255.255.255"}""")] - [InlineData("192.168.1.156", """{"Prop":"192.168.1.156"}""")] - [InlineData("::1", """{"Prop":"::1"}""")] - [InlineData("::", """{"Prop":"::"}""")] - [InlineData("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577", """{"Prop":"2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"}""")] + [ConditionalTheory, InlineData("127.0.0.1", """{"Prop":"127.0.0.1"}"""), InlineData("0.0.0.0", """{"Prop":"0.0.0.0"}"""), + InlineData("255.255.255.255", """{"Prop":"255.255.255.255"}"""), InlineData("192.168.1.156", """{"Prop":"192.168.1.156"}"""), + InlineData("::1", """{"Prop":"::1"}"""), InlineData("::", """{"Prop":"::"}"""), + InlineData("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577", """{"Prop":"2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"}""")] public virtual Task Can_read_write_IP_address_JSON_values(string value, string json) => Can_read_and_write_JSON_value(nameof(IPAddressType.IpAddress), IPAddress.Parse(value), json); @@ -325,10 +274,8 @@ protected class IPAddressType public IPAddress IpAddress { get; set; } = null!; } - [ConditionalTheory] - [InlineData("001122334455", """{"Prop":"001122334455"}""")] - [InlineData("00-11-22-33-44-55", """{"Prop":"001122334455"}""")] - [InlineData("0011.2233.4455", """{"Prop":"001122334455"}""")] + [ConditionalTheory, InlineData("001122334455", """{"Prop":"001122334455"}"""), + InlineData("00-11-22-33-44-55", """{"Prop":"001122334455"}"""), InlineData("0011.2233.4455", """{"Prop":"001122334455"}""")] public virtual Task Can_read_write_physical_address_JSON_values(string value, string json) => Can_read_and_write_JSON_value( nameof(PhysicalAddressType.PhysicalAddress), @@ -339,11 +286,8 @@ protected class PhysicalAddressType public PhysicalAddress PhysicalAddress { get; set; } = null!; } - [ConditionalTheory] - [InlineData((sbyte)Enum8.Min, """{"Prop":-128}""")] - [InlineData((sbyte)Enum8.Max, """{"Prop":127}""")] - [InlineData((sbyte)Enum8.Default, """{"Prop":0}""")] - [InlineData((sbyte)Enum8.One, """{"Prop":1}""")] + [ConditionalTheory, InlineData((sbyte)Enum8.Min, """{"Prop":-128}"""), InlineData((sbyte)Enum8.Max, """{"Prop":127}"""), + InlineData((sbyte)Enum8.Default, """{"Prop":0}"""), InlineData((sbyte)Enum8.One, """{"Prop":1}""")] public virtual Task Can_read_write_sbyte_enum_JSON_values(Enum8 value, string json) => Can_read_and_write_JSON_value(nameof(Enum8Type.Enum8), value, json); @@ -352,11 +296,8 @@ protected class Enum8Type public Enum8 Enum8 { get; set; } } - [ConditionalTheory] - [InlineData((short)Enum16.Min, """{"Prop":-32768}""")] - [InlineData((short)Enum16.Max, """{"Prop":32767}""")] - [InlineData((short)Enum16.Default, """{"Prop":0}""")] - [InlineData((short)Enum16.One, """{"Prop":1}""")] + [ConditionalTheory, InlineData((short)Enum16.Min, """{"Prop":-32768}"""), InlineData((short)Enum16.Max, """{"Prop":32767}"""), + InlineData((short)Enum16.Default, """{"Prop":0}"""), InlineData((short)Enum16.One, """{"Prop":1}""")] public virtual Task Can_read_write_short_enum_JSON_values(Enum16 value, string json) => Can_read_and_write_JSON_value(nameof(Enum16Type.Enum16), value, json); @@ -365,11 +306,8 @@ protected class Enum16Type public Enum16 Enum16 { get; set; } } - [ConditionalTheory] - [InlineData((int)Enum32.Min, """{"Prop":-2147483648}""")] - [InlineData((int)Enum32.Max, """{"Prop":2147483647}""")] - [InlineData((int)Enum32.Default, """{"Prop":0}""")] - [InlineData((int)Enum32.One, """{"Prop":1}""")] + [ConditionalTheory, InlineData((int)Enum32.Min, """{"Prop":-2147483648}"""), InlineData((int)Enum32.Max, """{"Prop":2147483647}"""), + InlineData((int)Enum32.Default, """{"Prop":0}"""), InlineData((int)Enum32.One, """{"Prop":1}""")] public virtual Task Can_read_write_int_enum_JSON_values(Enum32 value, string json) => Can_read_and_write_JSON_value(nameof(Enum32Type.Enum32), value, json); @@ -378,11 +316,9 @@ protected class Enum32Type public Enum32 Enum32 { get; set; } } - [ConditionalTheory] - [InlineData((long)Enum64.Min, """{"Prop":-9223372036854775808}""")] - [InlineData((long)Enum64.Max, """{"Prop":9223372036854775807}""")] - [InlineData((long)Enum64.Default, """{"Prop":0}""")] - [InlineData((long)Enum64.One, """{"Prop":1}""")] + [ConditionalTheory, InlineData((long)Enum64.Min, """{"Prop":-9223372036854775808}"""), + InlineData((long)Enum64.Max, """{"Prop":9223372036854775807}"""), InlineData((long)Enum64.Default, """{"Prop":0}"""), + InlineData((long)Enum64.One, """{"Prop":1}""")] public virtual Task Can_read_write_long_enum_JSON_values(Enum64 value, string json) => Can_read_and_write_JSON_value(nameof(Enum64Type.Enum64), value, json); @@ -391,10 +327,8 @@ protected class Enum64Type public Enum64 Enum64 { get; set; } } - [ConditionalTheory] - [InlineData((byte)EnumU8.Min, """{"Prop":0}""")] - [InlineData((byte)EnumU8.Max, """{"Prop":255}""")] - [InlineData((byte)EnumU8.One, """{"Prop":1}""")] + [ConditionalTheory, InlineData((byte)EnumU8.Min, """{"Prop":0}"""), InlineData((byte)EnumU8.Max, """{"Prop":255}"""), + InlineData((byte)EnumU8.One, """{"Prop":1}""")] public virtual Task Can_read_write_byte_enum_JSON_values(EnumU8 value, string json) => Can_read_and_write_JSON_value(nameof(EnumU8Type.EnumU8), value, json); @@ -403,10 +337,8 @@ protected class EnumU8Type public EnumU8 EnumU8 { get; set; } } - [ConditionalTheory] - [InlineData((ushort)EnumU16.Min, """{"Prop":0}""")] - [InlineData((ushort)EnumU16.Max, """{"Prop":65535}""")] - [InlineData((ushort)EnumU16.One, """{"Prop":1}""")] + [ConditionalTheory, InlineData((ushort)EnumU16.Min, """{"Prop":0}"""), InlineData((ushort)EnumU16.Max, """{"Prop":65535}"""), + InlineData((ushort)EnumU16.One, """{"Prop":1}""")] public virtual Task Can_read_write_ushort_enum_JSON_values(EnumU16 value, string json) => Can_read_and_write_JSON_value(nameof(EnumU16Type.EnumU16), value, json); @@ -415,10 +347,8 @@ protected class EnumU16Type public EnumU16 EnumU16 { get; set; } } - [ConditionalTheory] - [InlineData((uint)EnumU32.Min, """{"Prop":0}""")] - [InlineData((uint)EnumU32.Max, """{"Prop":4294967295}""")] - [InlineData((uint)EnumU32.One, """{"Prop":1}""")] + [ConditionalTheory, InlineData((uint)EnumU32.Min, """{"Prop":0}"""), InlineData((uint)EnumU32.Max, """{"Prop":4294967295}"""), + InlineData((uint)EnumU32.One, """{"Prop":1}""")] public virtual Task Can_read_write_uint_enum_JSON_values(EnumU32 value, string json) => Can_read_and_write_JSON_value(nameof(EnumU32Type.EnumU32), value, json); @@ -427,10 +357,8 @@ protected class EnumU32Type public EnumU32 EnumU32 { get; set; } } - [ConditionalTheory] - [InlineData((ulong)EnumU64.Min, """{"Prop":0}""")] - [InlineData((ulong)EnumU64.Max, """{"Prop":18446744073709551615}""")] - [InlineData((ulong)EnumU64.One, """{"Prop":1}""")] + [ConditionalTheory, InlineData((ulong)EnumU64.Min, """{"Prop":0}"""), + InlineData((ulong)EnumU64.Max, """{"Prop":18446744073709551615}"""), InlineData((ulong)EnumU64.One, """{"Prop":1}""")] public virtual Task Can_read_write_ulong_enum_JSON_values(EnumU64 value, string json) => Can_read_and_write_JSON_value(nameof(EnumU64Type.EnumU64), value, json); @@ -439,12 +367,8 @@ protected class EnumU64Type public EnumU64 EnumU64 { get; set; } } - [ConditionalTheory] - [InlineData(sbyte.MinValue, """{"Prop":-128}""")] - [InlineData(sbyte.MaxValue, """{"Prop":127}""")] - [InlineData((sbyte)0, """{"Prop":0}""")] - [InlineData((sbyte)1, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(sbyte.MinValue, """{"Prop":-128}"""), InlineData(sbyte.MaxValue, """{"Prop":127}"""), + InlineData((sbyte)0, """{"Prop":0}"""), InlineData((sbyte)1, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_sbyte_JSON_values(sbyte? value, string json) => Can_read_and_write_JSON_value(nameof(NullableInt8Type.Int8), value, json); @@ -453,12 +377,8 @@ protected class NullableInt8Type public sbyte? Int8 { get; set; } } - [ConditionalTheory] - [InlineData(short.MinValue, """{"Prop":-32768}""")] - [InlineData(short.MaxValue, """{"Prop":32767}""")] - [InlineData((short)0, """{"Prop":0}""")] - [InlineData((short)1, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(short.MinValue, """{"Prop":-32768}"""), InlineData(short.MaxValue, """{"Prop":32767}"""), + InlineData((short)0, """{"Prop":0}"""), InlineData((short)1, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_short_JSON_values(short? value, string json) => Can_read_and_write_JSON_value(nameof(NullableInt16Type.Int16), value, json); @@ -467,12 +387,8 @@ protected class NullableInt16Type public short? Int16 { get; set; } } - [ConditionalTheory] - [InlineData(int.MinValue, """{"Prop":-2147483648}""")] - [InlineData(int.MaxValue, """{"Prop":2147483647}""")] - [InlineData(0, """{"Prop":0}""")] - [InlineData(1, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(int.MinValue, """{"Prop":-2147483648}"""), InlineData(int.MaxValue, """{"Prop":2147483647}"""), + InlineData(0, """{"Prop":0}"""), InlineData(1, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_int_JSON_values(int? value, string json) => Can_read_and_write_JSON_value(nameof(NullableInt32Type.Int32), value, json); @@ -481,12 +397,9 @@ protected class NullableInt32Type public int? Int32 { get; set; } } - [ConditionalTheory] - [InlineData(long.MinValue, """{"Prop":-9223372036854775808}""")] - [InlineData(long.MaxValue, """{"Prop":9223372036854775807}""")] - [InlineData((long)0, """{"Prop":0}""")] - [InlineData((long)1, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(long.MinValue, """{"Prop":-9223372036854775808}"""), + InlineData(long.MaxValue, """{"Prop":9223372036854775807}"""), InlineData((long)0, """{"Prop":0}"""), + InlineData((long)1, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_long_JSON_values(long? value, string json) => Can_read_and_write_JSON_value(nameof(NullableInt64Type.Int64), value, json); @@ -495,11 +408,8 @@ protected class NullableInt64Type public long? Int64 { get; set; } } - [ConditionalTheory] - [InlineData(byte.MinValue, """{"Prop":0}""")] - [InlineData(byte.MaxValue, """{"Prop":255}""")] - [InlineData((byte)1, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(byte.MinValue, """{"Prop":0}"""), InlineData(byte.MaxValue, """{"Prop":255}"""), + InlineData((byte)1, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_byte_JSON_values(byte? value, string json) => Can_read_and_write_JSON_value(nameof(NullableUInt8Type.UInt8), value, json); @@ -508,11 +418,8 @@ protected class NullableUInt8Type public byte? UInt8 { get; set; } } - [ConditionalTheory] - [InlineData(ushort.MinValue, """{"Prop":0}""")] - [InlineData(ushort.MaxValue, """{"Prop":65535}""")] - [InlineData((ushort)1, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(ushort.MinValue, """{"Prop":0}"""), InlineData(ushort.MaxValue, """{"Prop":65535}"""), + InlineData((ushort)1, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_ushort_JSON_values(ushort? value, string json) => Can_read_and_write_JSON_value(nameof(NullableUInt16Type.UInt16), value, json); @@ -521,11 +428,8 @@ protected class NullableUInt16Type public ushort? UInt16 { get; set; } } - [ConditionalTheory] - [InlineData(uint.MinValue, """{"Prop":0}""")] - [InlineData(uint.MaxValue, """{"Prop":4294967295}""")] - [InlineData((uint)1, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(uint.MinValue, """{"Prop":0}"""), InlineData(uint.MaxValue, """{"Prop":4294967295}"""), + InlineData((uint)1, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_uint_JSON_values(uint? value, string json) => Can_read_and_write_JSON_value(nameof(NullableUInt32Type.UInt32), value, json); @@ -534,11 +438,8 @@ protected class NullableUInt32Type public uint? UInt32 { get; set; } } - [ConditionalTheory] - [InlineData(ulong.MinValue, """{"Prop":0}""")] - [InlineData(ulong.MaxValue, """{"Prop":18446744073709551615}""")] - [InlineData((ulong)1, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(ulong.MinValue, """{"Prop":0}"""), InlineData(ulong.MaxValue, """{"Prop":18446744073709551615}"""), + InlineData((ulong)1, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_ulong_JSON_values(ulong? value, string json) => Can_read_and_write_JSON_value(nameof(NullableUInt64Type.UInt64), value, json); @@ -547,12 +448,8 @@ protected class NullableUInt64Type public ulong? UInt64 { get; set; } } - [ConditionalTheory] - [InlineData(float.MinValue, """{"Prop":-3.4028235E+38}""")] - [InlineData(float.MaxValue, """{"Prop":3.4028235E+38}""")] - [InlineData((float)0.0, """{"Prop":0}""")] - [InlineData((float)1.1, """{"Prop":1.1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(float.MinValue, """{"Prop":-3.4028235E+38}"""), InlineData(float.MaxValue, """{"Prop":3.4028235E+38}"""), + InlineData((float)0.0, """{"Prop":0}"""), InlineData((float)1.1, """{"Prop":1.1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_float_JSON_values(float? value, string json) => Can_read_and_write_JSON_value(nameof(NullableFloatType.Float), value, json); @@ -561,12 +458,9 @@ protected class NullableFloatType public float? Float { get; set; } } - [ConditionalTheory] - [InlineData(double.MinValue, """{"Prop":-1.7976931348623157E+308}""")] - [InlineData(double.MaxValue, """{"Prop":1.7976931348623157E+308}""")] - [InlineData(0.0, """{"Prop":0}""")] - [InlineData(1.1, """{"Prop":1.1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(double.MinValue, """{"Prop":-1.7976931348623157E+308}"""), + InlineData(double.MaxValue, """{"Prop":1.7976931348623157E+308}"""), InlineData(0.0, """{"Prop":0}"""), + InlineData(1.1, """{"Prop":1.1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_double_JSON_values(double? value, string json) => Can_read_and_write_JSON_value(nameof(NullableDoubleType.Double), value, json); @@ -575,12 +469,9 @@ protected class NullableDoubleType public double? Double { get; set; } } - [ConditionalTheory] - [InlineData("-79228162514264337593543950335", """{"Prop":-79228162514264337593543950335}""")] - [InlineData("79228162514264337593543950335", """{"Prop":79228162514264337593543950335}""")] - [InlineData("0.0", """{"Prop":0.0}""")] - [InlineData("1.1", """{"Prop":1.1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("-79228162514264337593543950335", """{"Prop":-79228162514264337593543950335}"""), + InlineData("79228162514264337593543950335", """{"Prop":79228162514264337593543950335}"""), InlineData("0.0", """{"Prop":0.0}"""), + InlineData("1.1", """{"Prop":1.1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_decimal_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullableDecimalType.Decimal), @@ -591,11 +482,8 @@ protected class NullableDecimalType public decimal? Decimal { get; set; } } - [ConditionalTheory] - [InlineData("1/1/0001", """{"Prop":"0001-01-01"}""")] - [InlineData("12/31/9999", """{"Prop":"9999-12-31"}""")] - [InlineData("5/29/2023", """{"Prop":"2023-05-29"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("1/1/0001", """{"Prop":"0001-01-01"}"""), InlineData("12/31/9999", """{"Prop":"9999-12-31"}"""), + InlineData("5/29/2023", """{"Prop":"2023-05-29"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_DateOnly_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullableDateOnlyType.DateOnly), @@ -606,11 +494,9 @@ protected class NullableDateOnlyType public DateOnly? DateOnly { get; set; } } - [ConditionalTheory] - [InlineData("00:00:00.0000000", """{"Prop":"00:00:00.0000000"}""")] - [InlineData("23:59:59.9999999", """{"Prop":"23:59:59.9999999"}""")] - [InlineData("11:05:12.3456789", """{"Prop":"11:05:12.3456789"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("00:00:00.0000000", """{"Prop":"00:00:00.0000000"}"""), + InlineData("23:59:59.9999999", """{"Prop":"23:59:59.9999999"}"""), InlineData("11:05:12.3456789", """{"Prop":"11:05:12.3456789"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_TimeOnly_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullableTimeOnlyType.TimeOnly), @@ -621,11 +507,9 @@ protected class NullableTimeOnlyType public TimeOnly? TimeOnly { get; set; } } - [ConditionalTheory] - [InlineData("0001-01-01T00:00:00.0000000", """{"Prop":"0001-01-01T00:00:00"}""")] - [InlineData("9999-12-31T23:59:59.9999999", """{"Prop":"9999-12-31T23:59:59.9999999"}""")] - [InlineData("2023-05-29T10:52:47.2064353", """{"Prop":"2023-05-29T10:52:47.2064353"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("0001-01-01T00:00:00.0000000", """{"Prop":"0001-01-01T00:00:00"}"""), + InlineData("9999-12-31T23:59:59.9999999", """{"Prop":"9999-12-31T23:59:59.9999999"}"""), + InlineData("2023-05-29T10:52:47.2064353", """{"Prop":"2023-05-29T10:52:47.2064353"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_DateTime_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullableDateTimeType.DateTime), @@ -636,12 +520,11 @@ protected class NullableDateTimeType public DateTime? DateTime { get; set; } } - [ConditionalTheory] - [InlineData("0001-01-01T00:00:00.0000000-01:00", """{"Prop":"0001-01-01T00:00:00-01:00"}""")] - [InlineData("9999-12-31T23:59:59.9999999+02:00", """{"Prop":"9999-12-31T23:59:59.9999999+02:00"}""")] - [InlineData("0001-01-01T00:00:00.0000000-03:00", """{"Prop":"0001-01-01T00:00:00-03:00"}""")] - [InlineData("2023-05-29T11:11:15.5672854+04:00", """{"Prop":"2023-05-29T11:11:15.5672854+04:00"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("0001-01-01T00:00:00.0000000-01:00", """{"Prop":"0001-01-01T00:00:00-01:00"}"""), + InlineData("9999-12-31T23:59:59.9999999+02:00", """{"Prop":"9999-12-31T23:59:59.9999999+02:00"}"""), + InlineData("0001-01-01T00:00:00.0000000-03:00", """{"Prop":"0001-01-01T00:00:00-03:00"}"""), + InlineData("2023-05-29T11:11:15.5672854+04:00", """{"Prop":"2023-05-29T11:11:15.5672854+04:00"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_DateTimeOffset_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullableDateTimeOffsetType.DateTimeOffset), @@ -652,12 +535,9 @@ protected class NullableDateTimeOffsetType public DateTimeOffset? DateTimeOffset { get; set; } } - [ConditionalTheory] - [InlineData("-10675199.02:48:05.4775808", """{"Prop":"-10675199:2:48:05.4775808"}""")] - [InlineData("10675199.02:48:05.4775807", """{"Prop":"10675199:2:48:05.4775807"}""")] - [InlineData("00:00:00", """{"Prop":"0:00:00"}""")] - [InlineData("12:23:23.8018854", """{"Prop":"12:23:23.8018854"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("-10675199.02:48:05.4775808", """{"Prop":"-10675199:2:48:05.4775808"}"""), + InlineData("10675199.02:48:05.4775807", """{"Prop":"10675199:2:48:05.4775807"}"""), InlineData("00:00:00", """{"Prop":"0:00:00"}"""), + InlineData("12:23:23.8018854", """{"Prop":"12:23:23.8018854"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_TimeSpan_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullableTimeSpanType.TimeSpan), @@ -668,10 +548,8 @@ protected class NullableTimeSpanType public TimeSpan? TimeSpan { get; set; } } - [ConditionalTheory] - [InlineData(false, """{"Prop":false}""")] - [InlineData(true, """{"Prop":true}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(false, """{"Prop":false}"""), InlineData(true, """{"Prop":true}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_bool_JSON_values(bool? value, string json) => Can_read_and_write_JSON_value(nameof(NullableBooleanType.Boolean), value, json); @@ -680,12 +558,8 @@ protected class NullableBooleanType public bool? Boolean { get; set; } } - [ConditionalTheory] - [InlineData(char.MinValue, """{"Prop":"\u0000"}""")] - [InlineData(char.MaxValue, """{"Prop":"\uFFFF"}""")] - [InlineData(' ', """{"Prop":" "}""")] - [InlineData('Z', """{"Prop":"Z"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(char.MinValue, """{"Prop":"\u0000"}"""), InlineData(char.MaxValue, """{"Prop":"\uFFFF"}"""), + InlineData(' ', """{"Prop":" "}"""), InlineData('Z', """{"Prop":"Z"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_char_JSON_values(char? value, string json) => Can_read_and_write_JSON_value(nameof(NullableCharacterType.Character), value, json); @@ -694,11 +568,10 @@ protected class NullableCharacterType public char? Character { get; set; } } - [ConditionalTheory] - [InlineData("00000000-0000-0000-0000-000000000000", """{"Prop":"00000000-0000-0000-0000-000000000000"}""")] - [InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF", """{"Prop":"ffffffff-ffff-ffff-ffff-ffffffffffff"}""")] - [InlineData("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD", """{"Prop":"8c44242f-8e3f-4a20-8be8-98c7c1aadebd"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("00000000-0000-0000-0000-000000000000", """{"Prop":"00000000-0000-0000-0000-000000000000"}"""), + InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF", """{"Prop":"ffffffff-ffff-ffff-ffff-ffffffffffff"}"""), + InlineData("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD", """{"Prop":"8c44242f-8e3f-4a20-8be8-98c7c1aadebd"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_GUID_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullableGuidType.Guid), @@ -709,14 +582,11 @@ protected class NullableGuidType public Guid? Guid { get; set; } } - [ConditionalTheory] - [InlineData("MinValue", """{"Prop":"MinValue"}""")] - [InlineData("MaxValue", """{"Prop":"MaxValue"}""")] - [InlineData("", """{"Prop":""}""")] - [InlineData( - "❤❥웃유♋☮✌☏☢☠✔☑♚▲♪฿Ɖ⛏♥❣♂♀☿👍✍✉☣☤✘☒♛▼♫⌘⌛¡♡ღツ☼☁❅♾️✎©®™Σ✪✯☭➳Ⓐ✞℃℉°✿⚡☃☂✄¢€£∞✫★½☯✡☪", - @"{""Prop"":""\u2764\u2765\uC6C3\uC720\u264B\u262E\u270C\u260F\u2622\u2620\u2714\u2611\u265A\u25B2\u266A\u0E3F\u0189\u26CF\u2665\u2763\u2642\u2640\u263F\uD83D\uDC4D\u270D\u2709\u2623\u2624\u2718\u2612\u265B\u25BC\u266B\u2318\u231B\u00A1\u2661\u10E6\u30C4\u263C\u2601\u2745\u267E\uFE0F\u270E\u00A9\u00AE\u2122\u03A3\u272A\u272F\u262D\u27B3\u24B6\u271E\u2103\u2109\u00B0\u273F\u26A1\u2603\u2602\u2704\u00A2\u20AC\u00A3\u221E\u272B\u2605\u00BD\u262F\u2721\u262A""}")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("MinValue", """{"Prop":"MinValue"}"""), InlineData("MaxValue", """{"Prop":"MaxValue"}"""), + InlineData("", """{"Prop":""}"""), InlineData( + "❤❥웃유♋☮✌☏☢☠✔☑♚▲♪฿Ɖ⛏♥❣♂♀☿👍✍✉☣☤✘☒♛▼♫⌘⌛¡♡ღツ☼☁❅♾️✎©®™Σ✪✯☭➳Ⓐ✞℃℉°✿⚡☃☂✄¢€£∞✫★½☯✡☪", + @"{""Prop"":""\u2764\u2765\uC6C3\uC720\u264B\u262E\u270C\u260F\u2622\u2620\u2714\u2611\u265A\u25B2\u266A\u0E3F\u0189\u26CF\u2665\u2763\u2642\u2640\u263F\uD83D\uDC4D\u270D\u2709\u2623\u2624\u2718\u2612\u265B\u25BC\u266B\u2318\u231B\u00A1\u2661\u10E6\u30C4\u263C\u2601\u2745\u267E\uFE0F\u270E\u00A9\u00AE\u2122\u03A3\u272A\u272F\u262D\u27B3\u24B6\u271E\u2103\u2109\u00B0\u273F\u26A1\u2603\u2602\u2704\u00A2\u20AC\u00A3\u221E\u272B\u2605\u00BD\u262F\u2721\u262A""}"), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_value(nameof(NullableStringType.String), value, json); @@ -725,12 +595,8 @@ protected class NullableStringType public string? String { get; set; } } - [ConditionalTheory] - [InlineData("0,0,0,1", """{"Prop":"AAAAAQ=="}""")] - [InlineData("255,255,255,255", """{"Prop":"/////w=="}""")] - [InlineData("", """{"Prop":""}""")] - [InlineData("1,2,3,4", """{"Prop":"AQIDBA=="}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("0,0,0,1", """{"Prop":"AAAAAQ=="}"""), InlineData("255,255,255,255", """{"Prop":"/////w=="}"""), + InlineData("", """{"Prop":""}"""), InlineData("1,2,3,4", """{"Prop":"AQIDBA=="}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_binary_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullableBytesType.Bytes), @@ -745,12 +611,10 @@ protected class NullableBytesType public byte[]? Bytes { get; set; } } - [ConditionalTheory] - [InlineData( - "https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName", - """{"Prop":"https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1\u0026q2=v2#FragmentName"}""")] - [InlineData("file:///C:/test/path/file.txt", """{"Prop":"file:///C:/test/path/file.txt"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData( + "https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName", + """{"Prop":"https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1\u0026q2=v2#FragmentName"}"""), + InlineData("file:///C:/test/path/file.txt", """{"Prop":"file:///C:/test/path/file.txt"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_URI_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullableUriType.Uri), @@ -761,15 +625,11 @@ protected class NullableUriType public Uri? Uri { get; set; } } - [ConditionalTheory] - [InlineData("127.0.0.1", """{"Prop":"127.0.0.1"}""")] - [InlineData("0.0.0.0", """{"Prop":"0.0.0.0"}""")] - [InlineData("255.255.255.255", """{"Prop":"255.255.255.255"}""")] - [InlineData("192.168.1.156", """{"Prop":"192.168.1.156"}""")] - [InlineData("::1", """{"Prop":"::1"}""")] - [InlineData("::", """{"Prop":"::"}""")] - [InlineData("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577", """{"Prop":"2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("127.0.0.1", """{"Prop":"127.0.0.1"}"""), InlineData("0.0.0.0", """{"Prop":"0.0.0.0"}"""), + InlineData("255.255.255.255", """{"Prop":"255.255.255.255"}"""), InlineData("192.168.1.156", """{"Prop":"192.168.1.156"}"""), + InlineData("::1", """{"Prop":"::1"}"""), InlineData("::", """{"Prop":"::"}"""), + InlineData("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577", """{"Prop":"2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_IP_address_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullableIPAddressType.IpAddress), @@ -780,11 +640,9 @@ protected class NullableIPAddressType public IPAddress? IpAddress { get; set; } } - [ConditionalTheory] - [InlineData("001122334455", """{"Prop":"001122334455"}""")] - [InlineData("00-11-22-33-44-55", """{"Prop":"001122334455"}""")] - [InlineData("0011.2233.4455", """{"Prop":"001122334455"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("001122334455", """{"Prop":"001122334455"}"""), + InlineData("00-11-22-33-44-55", """{"Prop":"001122334455"}"""), InlineData("0011.2233.4455", """{"Prop":"001122334455"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_physical_address_JSON_values(string? value, string json) => Can_read_and_write_JSON_value( nameof(NullablePhysicalAddressType.PhysicalAddress), @@ -795,12 +653,9 @@ protected class NullablePhysicalAddressType public PhysicalAddress? PhysicalAddress { get; set; } = null!; } - [ConditionalTheory] - [InlineData((sbyte)Enum8.Min, """{"Prop":-128}""")] - [InlineData((sbyte)Enum8.Max, """{"Prop":127}""")] - [InlineData((sbyte)Enum8.Default, """{"Prop":0}""")] - [InlineData((sbyte)Enum8.One, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((sbyte)Enum8.Min, """{"Prop":-128}"""), InlineData((sbyte)Enum8.Max, """{"Prop":127}"""), + InlineData((sbyte)Enum8.Default, """{"Prop":0}"""), InlineData((sbyte)Enum8.One, """{"Prop":1}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_sbyte_enum_JSON_values(object? value, string json) => Can_read_and_write_JSON_value( nameof(NullableEnum8Type.Enum8), @@ -811,12 +666,9 @@ protected class NullableEnum8Type public Enum8? Enum8 { get; set; } } - [ConditionalTheory] - [InlineData((short)Enum16.Min, """{"Prop":-32768}""")] - [InlineData((short)Enum16.Max, """{"Prop":32767}""")] - [InlineData((short)Enum16.Default, """{"Prop":0}""")] - [InlineData((short)Enum16.One, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((short)Enum16.Min, """{"Prop":-32768}"""), InlineData((short)Enum16.Max, """{"Prop":32767}"""), + InlineData((short)Enum16.Default, """{"Prop":0}"""), InlineData((short)Enum16.One, """{"Prop":1}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_short_enum_JSON_values(object? value, string json) => Can_read_and_write_JSON_value( nameof(NullableEnum16Type.Enum16), @@ -827,12 +679,9 @@ protected class NullableEnum16Type public Enum16? Enum16 { get; set; } } - [ConditionalTheory] - [InlineData((int)Enum32.Min, """{"Prop":-2147483648}""")] - [InlineData((int)Enum32.Max, """{"Prop":2147483647}""")] - [InlineData((int)Enum32.Default, """{"Prop":0}""")] - [InlineData((int)Enum32.One, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((int)Enum32.Min, """{"Prop":-2147483648}"""), InlineData((int)Enum32.Max, """{"Prop":2147483647}"""), + InlineData((int)Enum32.Default, """{"Prop":0}"""), InlineData((int)Enum32.One, """{"Prop":1}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_int_enum_JSON_values(object? value, string json) => Can_read_and_write_JSON_value( nameof(NullableEnum32Type.Enum32), @@ -843,12 +692,9 @@ protected class NullableEnum32Type public Enum32? Enum32 { get; set; } } - [ConditionalTheory] - [InlineData((long)Enum64.Min, """{"Prop":-9223372036854775808}""")] - [InlineData((long)Enum64.Max, """{"Prop":9223372036854775807}""")] - [InlineData((long)Enum64.Default, """{"Prop":0}""")] - [InlineData((long)Enum64.One, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((long)Enum64.Min, """{"Prop":-9223372036854775808}"""), + InlineData((long)Enum64.Max, """{"Prop":9223372036854775807}"""), InlineData((long)Enum64.Default, """{"Prop":0}"""), + InlineData((long)Enum64.One, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_long_enum_JSON_values(object? value, string json) => Can_read_and_write_JSON_value( nameof(NullableEnum64Type.Enum64), @@ -859,11 +705,8 @@ protected class NullableEnum64Type public Enum64? Enum64 { get; set; } } - [ConditionalTheory] - [InlineData((byte)EnumU8.Min, """{"Prop":0}""")] - [InlineData((byte)EnumU8.Max, """{"Prop":255}""")] - [InlineData((byte)EnumU8.One, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((byte)EnumU8.Min, """{"Prop":0}"""), InlineData((byte)EnumU8.Max, """{"Prop":255}"""), + InlineData((byte)EnumU8.One, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_byte_enum_JSON_values(object? value, string json) => Can_read_and_write_JSON_value( nameof(NullableEnumU8Type.EnumU8), @@ -874,11 +717,8 @@ protected class NullableEnumU8Type public EnumU8? EnumU8 { get; set; } } - [ConditionalTheory] - [InlineData((ushort)EnumU16.Min, """{"Prop":0}""")] - [InlineData((ushort)EnumU16.Max, """{"Prop":65535}""")] - [InlineData((ushort)EnumU16.One, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((ushort)EnumU16.Min, """{"Prop":0}"""), InlineData((ushort)EnumU16.Max, """{"Prop":65535}"""), + InlineData((ushort)EnumU16.One, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_ushort_enum_JSON_values(object? value, string json) => Can_read_and_write_JSON_value( nameof(NullableEnumU16Type.EnumU16), @@ -889,11 +729,8 @@ protected class NullableEnumU16Type public EnumU16? EnumU16 { get; set; } } - [ConditionalTheory] - [InlineData((uint)EnumU32.Min, """{"Prop":0}""")] - [InlineData((uint)EnumU32.Max, """{"Prop":4294967295}""")] - [InlineData((uint)EnumU32.One, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((uint)EnumU32.Min, """{"Prop":0}"""), InlineData((uint)EnumU32.Max, """{"Prop":4294967295}"""), + InlineData((uint)EnumU32.One, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_uint_enum_JSON_values(object? value, string json) => Can_read_and_write_JSON_value( nameof(NullableEnumU32Type.EnumU32), @@ -904,11 +741,9 @@ protected class NullableEnumU32Type public EnumU32? EnumU32 { get; set; } } - [ConditionalTheory] - [InlineData((ulong)EnumU64.Min, """{"Prop":0}""")] - [InlineData((ulong)EnumU64.Max, """{"Prop":18446744073709551615}""")] - [InlineData((ulong)EnumU64.One, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((ulong)EnumU64.Min, """{"Prop":0}"""), + InlineData((ulong)EnumU64.Max, """{"Prop":18446744073709551615}"""), InlineData((ulong)EnumU64.One, """{"Prop":1}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_ulong_enum_JSON_values(object? value, string json) => Can_read_and_write_JSON_value( nameof(NullableEnumU64Type.EnumU64), @@ -919,231 +754,169 @@ protected class NullableEnumU64Type public EnumU64? EnumU64 { get; set; } } - [ConditionalTheory] - [InlineData(sbyte.MinValue, """{"Prop":"-128"}""")] - [InlineData(sbyte.MaxValue, """{"Prop":"127"}""")] - [InlineData((sbyte)0, """{"Prop":"0"}""")] - [InlineData((sbyte)1, """{"Prop":"1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(sbyte.MinValue, """{"Prop":"-128"}"""), InlineData(sbyte.MaxValue, """{"Prop":"127"}"""), + InlineData((sbyte)0, """{"Prop":"0"}"""), InlineData((sbyte)1, """{"Prop":"1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_sbyte_as_string_JSON_values(sbyte? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableInt8Type.Int8), value, json); - [ConditionalTheory] - [InlineData(short.MinValue, """{"Prop":"-32768"}""")] - [InlineData(short.MaxValue, """{"Prop":"32767"}""")] - [InlineData((short)0, """{"Prop":"0"}""")] - [InlineData((short)1, """{"Prop":"1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(short.MinValue, """{"Prop":"-32768"}"""), InlineData(short.MaxValue, """{"Prop":"32767"}"""), + InlineData((short)0, """{"Prop":"0"}"""), InlineData((short)1, """{"Prop":"1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_short_as_string_JSON_values(short? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableInt16Type.Int16), value, json); - [ConditionalTheory] - [InlineData(int.MinValue, """{"Prop":"-2147483648"}""")] - [InlineData(int.MaxValue, """{"Prop":"2147483647"}""")] - [InlineData(0, """{"Prop":"0"}""")] - [InlineData(1, """{"Prop":"1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(int.MinValue, """{"Prop":"-2147483648"}"""), InlineData(int.MaxValue, """{"Prop":"2147483647"}"""), + InlineData(0, """{"Prop":"0"}"""), InlineData(1, """{"Prop":"1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_int_as_string_JSON_values(int? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableInt32Type.Int32), value, json); - [ConditionalTheory] - [InlineData(long.MinValue, """{"Prop":"-9223372036854775808"}""")] - [InlineData(long.MaxValue, """{"Prop":"9223372036854775807"}""")] - [InlineData((long)0, """{"Prop":"0"}""")] - [InlineData((long)1, """{"Prop":"1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(long.MinValue, """{"Prop":"-9223372036854775808"}"""), + InlineData(long.MaxValue, """{"Prop":"9223372036854775807"}"""), InlineData((long)0, """{"Prop":"0"}"""), + InlineData((long)1, """{"Prop":"1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_long_as_string_JSON_values(long? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableInt64Type.Int64), value, json); - [ConditionalTheory] - [InlineData(byte.MinValue, """{"Prop":"0"}""")] - [InlineData(byte.MaxValue, """{"Prop":"255"}""")] - [InlineData((byte)1, """{"Prop":"1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(byte.MinValue, """{"Prop":"0"}"""), InlineData(byte.MaxValue, """{"Prop":"255"}"""), + InlineData((byte)1, """{"Prop":"1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_byte_as_string_JSON_values(byte? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableUInt8Type.UInt8), value, json); - [ConditionalTheory] - [InlineData(ushort.MinValue, """{"Prop":"0"}""")] - [InlineData(ushort.MaxValue, """{"Prop":"65535"}""")] - [InlineData((ushort)1, """{"Prop":"1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(ushort.MinValue, """{"Prop":"0"}"""), InlineData(ushort.MaxValue, """{"Prop":"65535"}"""), + InlineData((ushort)1, """{"Prop":"1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_ushort_as_string_JSON_values(ushort? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableUInt16Type.UInt16), value, json); - [ConditionalTheory] - [InlineData(uint.MinValue, """{"Prop":"0"}""")] - [InlineData(uint.MaxValue, """{"Prop":"4294967295"}""")] - [InlineData((uint)1, """{"Prop":"1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(uint.MinValue, """{"Prop":"0"}"""), InlineData(uint.MaxValue, """{"Prop":"4294967295"}"""), + InlineData((uint)1, """{"Prop":"1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_uint_as_string_JSON_values(uint? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableUInt32Type.UInt32), value, json); - [ConditionalTheory] - [InlineData(ulong.MinValue, """{"Prop":"0"}""")] - [InlineData(ulong.MaxValue, """{"Prop":"18446744073709551615"}""")] - [InlineData((ulong)1, """{"Prop":"1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(ulong.MinValue, """{"Prop":"0"}"""), InlineData(ulong.MaxValue, """{"Prop":"18446744073709551615"}"""), + InlineData((ulong)1, """{"Prop":"1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_ulong_as_string_JSON_values(ulong? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableUInt64Type.UInt64), value, json); - [ConditionalTheory] - [InlineData(float.MinValue, """{"Prop":"-3.4028235E\u002B38"}""")] - [InlineData(float.MaxValue, """{"Prop":"3.4028235E\u002B38"}""")] - [InlineData((float)0.0, """{"Prop":"0"}""")] - [InlineData((float)1.1, """{"Prop":"1.1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(float.MinValue, """{"Prop":"-3.4028235E\u002B38"}"""), + InlineData(float.MaxValue, """{"Prop":"3.4028235E\u002B38"}"""), InlineData((float)0.0, """{"Prop":"0"}"""), + InlineData((float)1.1, """{"Prop":"1.1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_float_as_string_JSON_values(float? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableFloatType.Float), value, json); - [ConditionalTheory] - [InlineData(double.MinValue, """{"Prop":"-1.7976931348623157E\u002B308"}""")] - [InlineData(double.MaxValue, """{"Prop":"1.7976931348623157E\u002B308"}""")] - [InlineData(0.0, """{"Prop":"0"}""")] - [InlineData(1.1, """{"Prop":"1.1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(double.MinValue, """{"Prop":"-1.7976931348623157E\u002B308"}"""), + InlineData(double.MaxValue, """{"Prop":"1.7976931348623157E\u002B308"}"""), InlineData(0.0, """{"Prop":"0"}"""), + InlineData(1.1, """{"Prop":"1.1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_double_as_string_JSON_values(double? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableDoubleType.Double), value, json); - [ConditionalTheory] - [InlineData("-79228162514264337593543950335", """{"Prop":"-79228162514264337593543950335"}""")] - [InlineData("79228162514264337593543950335", """{"Prop":"79228162514264337593543950335"}""")] - [InlineData("0.0", """{"Prop":"0.0"}""")] - [InlineData("1.1", """{"Prop":"1.1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("-79228162514264337593543950335", """{"Prop":"-79228162514264337593543950335"}"""), + InlineData("79228162514264337593543950335", """{"Prop":"79228162514264337593543950335"}"""), InlineData("0.0", """{"Prop":"0.0"}"""), + InlineData("1.1", """{"Prop":"1.1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_decimal_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableDecimalType.Decimal), value == null ? default(decimal?) : decimal.Parse(value, CultureInfo.InvariantCulture), json); - [ConditionalTheory] - [InlineData("1/1/0001", """{"Prop":"0001-01-01"}""")] - [InlineData("12/31/9999", """{"Prop":"9999-12-31"}""")] - [InlineData("5/29/2023", """{"Prop":"2023-05-29"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("1/1/0001", """{"Prop":"0001-01-01"}"""), InlineData("12/31/9999", """{"Prop":"9999-12-31"}"""), + InlineData("5/29/2023", """{"Prop":"2023-05-29"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_DateOnly_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableDateOnlyType.DateOnly), value == null ? default(DateOnly?) : DateOnly.Parse(value, CultureInfo.InvariantCulture), json); - [ConditionalTheory] - [InlineData("00:00:00.0000000", """{"Prop":"00:00:00"}""")] - [InlineData("23:59:59.9999999", """{"Prop":"23:59:59.9999999"}""")] - [InlineData("11:05:12.3456789", """{"Prop":"11:05:12.3456789"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("00:00:00.0000000", """{"Prop":"00:00:00"}"""), + InlineData("23:59:59.9999999", """{"Prop":"23:59:59.9999999"}"""), InlineData("11:05:12.3456789", """{"Prop":"11:05:12.3456789"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_TimeOnly_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableTimeOnlyType.TimeOnly), value == null ? default(TimeOnly?) : TimeOnly.Parse(value, CultureInfo.InvariantCulture), json); - [ConditionalTheory] - [InlineData("0001-01-01T00:00:00.0000000", """{"Prop":"0001-01-01 00:00:00"}""")] - [InlineData("9999-12-31T23:59:59.9999999", """{"Prop":"9999-12-31 23:59:59.9999999"}""")] - [InlineData("2023-05-29T10:52:47.2064353", """{"Prop":"2023-05-29 10:52:47.2064353"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("0001-01-01T00:00:00.0000000", """{"Prop":"0001-01-01 00:00:00"}"""), + InlineData("9999-12-31T23:59:59.9999999", """{"Prop":"9999-12-31 23:59:59.9999999"}"""), + InlineData("2023-05-29T10:52:47.2064353", """{"Prop":"2023-05-29 10:52:47.2064353"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_DateTime_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableDateTimeType.DateTime), value == null ? default(DateTime?) : DateTime.Parse(value, CultureInfo.InvariantCulture), json); - [ConditionalTheory] - [InlineData("0001-01-01T00:00:00.0000000-01:00", """{"Prop":"0001-01-01 00:00:00-01:00"}""")] - [InlineData("9999-12-31T23:59:59.9999999+02:00", """{"Prop":"9999-12-31 23:59:59.9999999\u002B02:00"}""")] - [InlineData("0001-01-01T00:00:00.0000000-03:00", """{"Prop":"0001-01-01 00:00:00-03:00"}""")] - [InlineData("2023-05-29T11:11:15.5672854+04:00", """{"Prop":"2023-05-29 11:11:15.5672854\u002B04:00"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("0001-01-01T00:00:00.0000000-01:00", """{"Prop":"0001-01-01 00:00:00-01:00"}"""), + InlineData("9999-12-31T23:59:59.9999999+02:00", """{"Prop":"9999-12-31 23:59:59.9999999\u002B02:00"}"""), + InlineData("0001-01-01T00:00:00.0000000-03:00", """{"Prop":"0001-01-01 00:00:00-03:00"}"""), + InlineData("2023-05-29T11:11:15.5672854+04:00", """{"Prop":"2023-05-29 11:11:15.5672854\u002B04:00"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_DateTimeOffset_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableDateTimeOffsetType.DateTimeOffset), value == null ? default(DateTimeOffset?) : DateTimeOffset.Parse(value, CultureInfo.InvariantCulture), json); - [ConditionalTheory] - [InlineData("-10675199.02:48:05.4775808", """{"Prop":"-10675199.02:48:05.4775808"}""")] - [InlineData("10675199.02:48:05.4775807", """{"Prop":"10675199.02:48:05.4775807"}""")] - [InlineData("00:00:00", """{"Prop":"00:00:00"}""")] - [InlineData("12:23:23.8018854", """{"Prop":"12:23:23.8018854"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("-10675199.02:48:05.4775808", """{"Prop":"-10675199.02:48:05.4775808"}"""), + InlineData("10675199.02:48:05.4775807", """{"Prop":"10675199.02:48:05.4775807"}"""), InlineData("00:00:00", """{"Prop":"00:00:00"}"""), + InlineData("12:23:23.8018854", """{"Prop":"12:23:23.8018854"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_TimeSpan_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableTimeSpanType.TimeSpan), value == null ? default(TimeSpan?) : TimeSpan.Parse(value), json); - [ConditionalTheory] - [InlineData(false, """{"Prop":"0"}""")] - [InlineData(true, """{"Prop":"1"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(false, """{"Prop":"0"}"""), InlineData(true, """{"Prop":"1"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_bool_as_string_JSON_values(bool? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableBooleanType.Boolean), value, json); - [ConditionalTheory] - [InlineData(char.MinValue, """{"Prop":"\u0000"}""")] - [InlineData(char.MaxValue, """{"Prop":"\uFFFF"}""")] - [InlineData(' ', """{"Prop":" "}""")] - [InlineData('Z', """{"Prop":"Z"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(char.MinValue, """{"Prop":"\u0000"}"""), InlineData(char.MaxValue, """{"Prop":"\uFFFF"}"""), + InlineData(' ', """{"Prop":" "}"""), InlineData('Z', """{"Prop":"Z"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_char_as_string_JSON_values(char? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableCharacterType.Character), value, json); - [ConditionalTheory] - [InlineData("00000000-0000-0000-0000-000000000000", """{"Prop":"00000000-0000-0000-0000-000000000000"}""")] - [InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF", """{"Prop":"ffffffff-ffff-ffff-ffff-ffffffffffff"}""")] - [InlineData("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD", """{"Prop":"8c44242f-8e3f-4a20-8be8-98c7c1aadebd"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("00000000-0000-0000-0000-000000000000", """{"Prop":"00000000-0000-0000-0000-000000000000"}"""), + InlineData("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF", """{"Prop":"ffffffff-ffff-ffff-ffff-ffffffffffff"}"""), + InlineData("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD", """{"Prop":"8c44242f-8e3f-4a20-8be8-98c7c1aadebd"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_as_string_GUID_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableGuidType.Guid), value == null ? default(Guid?) : Guid.Parse(value, CultureInfo.InvariantCulture), json); - [ConditionalTheory] - [InlineData("MinValue", """{"Prop":"MinValue"}""")] - [InlineData("MaxValue", """{"Prop":"MaxValue"}""")] - [InlineData("", """{"Prop":""}""")] - [InlineData( - "❤❥웃유♋☮✌☏☢☠✔☑♚▲♪฿Ɖ⛏♥❣♂♀☿👍✍✉☣☤✘☒♛▼♫⌘⌛¡♡ღツ☼☁❅♾️✎©®™Σ✪✯☭➳Ⓐ✞℃℉°✿⚡☃☂✄¢€£∞✫★½☯✡☪", - @"{""Prop"":""\u2764\u2765\uC6C3\uC720\u264B\u262E\u270C\u260F\u2622\u2620\u2714\u2611\u265A\u25B2\u266A\u0E3F\u0189\u26CF\u2665\u2763\u2642\u2640\u263F\uD83D\uDC4D\u270D\u2709\u2623\u2624\u2718\u2612\u265B\u25BC\u266B\u2318\u231B\u00A1\u2661\u10E6\u30C4\u263C\u2601\u2745\u267E\uFE0F\u270E\u00A9\u00AE\u2122\u03A3\u272A\u272F\u262D\u27B3\u24B6\u271E\u2103\u2109\u00B0\u273F\u26A1\u2603\u2602\u2704\u00A2\u20AC\u00A3\u221E\u272B\u2605\u00BD\u262F\u2721\u262A""}")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("MinValue", """{"Prop":"MinValue"}"""), InlineData("MaxValue", """{"Prop":"MaxValue"}"""), + InlineData("", """{"Prop":""}"""), InlineData( + "❤❥웃유♋☮✌☏☢☠✔☑♚▲♪฿Ɖ⛏♥❣♂♀☿👍✍✉☣☤✘☒♛▼♫⌘⌛¡♡ღツ☼☁❅♾️✎©®™Σ✪✯☭➳Ⓐ✞℃℉°✿⚡☃☂✄¢€£∞✫★½☯✡☪", + @"{""Prop"":""\u2764\u2765\uC6C3\uC720\u264B\u262E\u270C\u260F\u2622\u2620\u2714\u2611\u265A\u25B2\u266A\u0E3F\u0189\u26CF\u2665\u2763\u2642\u2640\u263F\uD83D\uDC4D\u270D\u2709\u2623\u2624\u2718\u2612\u265B\u25BC\u266B\u2318\u231B\u00A1\u2661\u10E6\u30C4\u263C\u2601\u2745\u267E\uFE0F\u270E\u00A9\u00AE\u2122\u03A3\u272A\u272F\u262D\u27B3\u24B6\u271E\u2103\u2109\u00B0\u273F\u26A1\u2603\u2602\u2704\u00A2\u20AC\u00A3\u221E\u272B\u2605\u00BD\u262F\u2721\u262A""}"), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_string_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableStringType.String), value, json); - [ConditionalTheory] - [InlineData("0,0,0,1", """{"Prop":"AAAAAQ=="}""")] - [InlineData("255,255,255,255", """{"Prop":"/////w=="}""")] - [InlineData("", """{"Prop":""}""")] - [InlineData("1,2,3,4", """{"Prop":"AQIDBA=="}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("0,0,0,1", """{"Prop":"AAAAAQ=="}"""), InlineData("255,255,255,255", """{"Prop":"/////w=="}"""), + InlineData("", """{"Prop":""}"""), InlineData("1,2,3,4", """{"Prop":"AQIDBA=="}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_binary_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), @@ -1154,138 +927,100 @@ public virtual Task Can_read_write_nullable_binary_as_string_JSON_values(string? ? [] : value.Split(',').Select(e => byte.Parse(e)).ToArray(), json); - [ConditionalTheory] - [InlineData( - "https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName", - """{"Prop":"https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1\u0026q2=v2#FragmentName"}""")] - [InlineData("file:///C:/test/path/file.txt", """{"Prop":"file:///C:/test/path/file.txt"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData( + "https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName", + """{"Prop":"https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1\u0026q2=v2#FragmentName"}"""), + InlineData("file:///C:/test/path/file.txt", """{"Prop":"file:///C:/test/path/file.txt"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_URI_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableUriType.Uri), value == null ? default : new Uri(value), json); - [ConditionalTheory] - [InlineData("127.0.0.1", """{"Prop":"127.0.0.1"}""")] - [InlineData("0.0.0.0", """{"Prop":"0.0.0.0"}""")] - [InlineData("255.255.255.255", """{"Prop":"255.255.255.255"}""")] - [InlineData("192.168.1.156", """{"Prop":"192.168.1.156"}""")] - [InlineData("::1", """{"Prop":"::1"}""")] - [InlineData("::", """{"Prop":"::"}""")] - [InlineData("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577", """{"Prop":"2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("127.0.0.1", """{"Prop":"127.0.0.1"}"""), InlineData("0.0.0.0", """{"Prop":"0.0.0.0"}"""), + InlineData("255.255.255.255", """{"Prop":"255.255.255.255"}"""), InlineData("192.168.1.156", """{"Prop":"192.168.1.156"}"""), + InlineData("::1", """{"Prop":"::1"}"""), InlineData("::", """{"Prop":"::"}"""), + InlineData("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577", """{"Prop":"2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_IP_address_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableIPAddressType.IpAddress), value == null ? default : IPAddress.Parse(value), json); - [ConditionalTheory] - [InlineData("001122334455", """{"Prop":"001122334455"}""")] - [InlineData("00-11-22-33-44-55", """{"Prop":"001122334455"}""")] - [InlineData("0011.2233.4455", """{"Prop":"001122334455"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData("001122334455", """{"Prop":"001122334455"}"""), + InlineData("00-11-22-33-44-55", """{"Prop":"001122334455"}"""), InlineData("0011.2233.4455", """{"Prop":"001122334455"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_physical_address_as_string_JSON_values(string? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullablePhysicalAddressType.PhysicalAddress), value == null ? default : PhysicalAddress.Parse(value), json); - [ConditionalTheory] - [InlineData((sbyte)Enum8.Min, """{"Prop":"Min"}""")] - [InlineData((sbyte)Enum8.Max, """{"Prop":"Max"}""")] - [InlineData((sbyte)Enum8.Default, """{"Prop":"Default"}""")] - [InlineData((sbyte)Enum8.One, """{"Prop":"One"}""")] - [InlineData((sbyte)77, """{"Prop":"77"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((sbyte)Enum8.Min, """{"Prop":"Min"}"""), InlineData((sbyte)Enum8.Max, """{"Prop":"Max"}"""), + InlineData((sbyte)Enum8.Default, """{"Prop":"Default"}"""), InlineData((sbyte)Enum8.One, """{"Prop":"One"}"""), + InlineData((sbyte)77, """{"Prop":"77"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_sbyte_enum_as_string_JSON_values(object? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableEnum8Type.Enum8), value == null ? default(Enum8?) : (Enum8)value, json); - [ConditionalTheory] - [InlineData((short)Enum16.Min, """{"Prop":"Min"}""")] - [InlineData((short)Enum16.Max, """{"Prop":"Max"}""")] - [InlineData((short)Enum16.Default, """{"Prop":"Default"}""")] - [InlineData((short)Enum16.One, """{"Prop":"One"}""")] - [InlineData((short)77, """{"Prop":"77"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((short)Enum16.Min, """{"Prop":"Min"}"""), InlineData((short)Enum16.Max, """{"Prop":"Max"}"""), + InlineData((short)Enum16.Default, """{"Prop":"Default"}"""), InlineData((short)Enum16.One, """{"Prop":"One"}"""), + InlineData((short)77, """{"Prop":"77"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_short_enum_as_string_JSON_values(object? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableEnum16Type.Enum16), value == null ? default(Enum16?) : (Enum16)value, json); - [ConditionalTheory] - [InlineData((int)Enum32.Min, """{"Prop":"Min"}""")] - [InlineData((int)Enum32.Max, """{"Prop":"Max"}""")] - [InlineData((int)Enum32.Default, """{"Prop":"Default"}""")] - [InlineData((int)Enum32.One, """{"Prop":"One"}""")] - [InlineData(77, """{"Prop":"77"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((int)Enum32.Min, """{"Prop":"Min"}"""), InlineData((int)Enum32.Max, """{"Prop":"Max"}"""), + InlineData((int)Enum32.Default, """{"Prop":"Default"}"""), InlineData((int)Enum32.One, """{"Prop":"One"}"""), + InlineData(77, """{"Prop":"77"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_int_enum_as_string_JSON_values(object? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableEnum32Type.Enum32), value == null ? default(Enum32?) : (Enum32)value, json); - [ConditionalTheory] - [InlineData((long)Enum64.Min, """{"Prop":"Min"}""")] - [InlineData((long)Enum64.Max, """{"Prop":"Max"}""")] - [InlineData((long)Enum64.Default, """{"Prop":"Default"}""")] - [InlineData((long)Enum64.One, """{"Prop":"One"}""")] - [InlineData((long)77, """{"Prop":"77"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((long)Enum64.Min, """{"Prop":"Min"}"""), InlineData((long)Enum64.Max, """{"Prop":"Max"}"""), + InlineData((long)Enum64.Default, """{"Prop":"Default"}"""), InlineData((long)Enum64.One, """{"Prop":"One"}"""), + InlineData((long)77, """{"Prop":"77"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_long_enum_as_string_JSON_values(object? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableEnum64Type.Enum64), value == null ? default(Enum64?) : (Enum64)value, json); - [ConditionalTheory] - [InlineData((byte)EnumU8.Min, """{"Prop":"Min"}""")] - [InlineData((byte)EnumU8.Max, """{"Prop":"Max"}""")] - [InlineData((byte)EnumU8.One, """{"Prop":"One"}""")] - [InlineData((byte)77, """{"Prop":"77"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((byte)EnumU8.Min, """{"Prop":"Min"}"""), InlineData((byte)EnumU8.Max, """{"Prop":"Max"}"""), + InlineData((byte)EnumU8.One, """{"Prop":"One"}"""), InlineData((byte)77, """{"Prop":"77"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_byte_enum_as_string_JSON_values(object? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableEnumU8Type.EnumU8), value == null ? default(EnumU8?) : (EnumU8)value, json); - [ConditionalTheory] - [InlineData((ushort)EnumU16.Min, """{"Prop":"Min"}""")] - [InlineData((ushort)EnumU16.Max, """{"Prop":"Max"}""")] - [InlineData((ushort)EnumU16.One, """{"Prop":"One"}""")] - [InlineData((ushort)77, """{"Prop":"77"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((ushort)EnumU16.Min, """{"Prop":"Min"}"""), InlineData((ushort)EnumU16.Max, """{"Prop":"Max"}"""), + InlineData((ushort)EnumU16.One, """{"Prop":"One"}"""), InlineData((ushort)77, """{"Prop":"77"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_ushort_enum_as_string_JSON_values(object? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableEnumU16Type.EnumU16), value == null ? default(EnumU16?) : (EnumU16)value, json); - [ConditionalTheory] - [InlineData((uint)EnumU32.Min, """{"Prop":"Min"}""")] - [InlineData((uint)EnumU32.Max, """{"Prop":"Max"}""")] - [InlineData((uint)EnumU32.One, """{"Prop":"One"}""")] - [InlineData((uint)77, """{"Prop":"77"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((uint)EnumU32.Min, """{"Prop":"Min"}"""), InlineData((uint)EnumU32.Max, """{"Prop":"Max"}"""), + InlineData((uint)EnumU32.One, """{"Prop":"One"}"""), InlineData((uint)77, """{"Prop":"77"}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_uint_enum_as_string_JSON_values(object? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), nameof(NullableEnumU32Type.EnumU32), value == null ? default(EnumU32?) : (EnumU32)value, json); - [ConditionalTheory] - [InlineData((ulong)EnumU64.Min, """{"Prop":"Min"}""")] - [InlineData((ulong)EnumU64.Max, """{"Prop":"Max"}""")] - [InlineData((ulong)EnumU64.One, """{"Prop":"One"}""")] - [InlineData((ulong)77, """{"Prop":"77"}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData((ulong)EnumU64.Min, """{"Prop":"Min"}"""), InlineData((ulong)EnumU64.Max, """{"Prop":"Max"}"""), + InlineData((ulong)EnumU64.One, """{"Prop":"One"}"""), InlineData((ulong)77, """{"Prop":"77"}"""), + InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_ulong_enum_as_string_JSON_values(object? value, string json) => Can_read_and_write_JSON_property_value( b => b.HasConversion(), @@ -1628,11 +1363,8 @@ public virtual Task Can_read_write_polygon_typed_as_nullable_geometry_as_GeoJson null, """{"Prop":null}"""); - [ConditionalTheory] - [InlineData(int.MinValue, """{"Prop":-2147483648}""")] - [InlineData(int.MaxValue, """{"Prop":2147483647}""")] - [InlineData(0, """{"Prop":0}""")] - [InlineData(1, """{"Prop":1}""")] + [ConditionalTheory, InlineData(int.MinValue, """{"Prop":-2147483648}"""), InlineData(int.MaxValue, """{"Prop":2147483647}"""), + InlineData(0, """{"Prop":0}"""), InlineData(1, """{"Prop":1}""")] public virtual Task Can_read_write_converted_type_JSON_values(int value, string json) => Can_read_and_write_JSON_value( b => b.Entity().HasNoKey().Property(e => e.DddId), @@ -1645,12 +1377,8 @@ protected class DddIdType public DddId DddId { get; set; } } - [ConditionalTheory] - [InlineData(int.MinValue, """{"Prop":-2147483648}""")] - [InlineData(int.MaxValue, """{"Prop":2147483647}""")] - [InlineData(0, """{"Prop":0}""")] - [InlineData(1, """{"Prop":1}""")] - [InlineData(null, """{"Prop":null}""")] + [ConditionalTheory, InlineData(int.MinValue, """{"Prop":-2147483648}"""), InlineData(int.MaxValue, """{"Prop":2147483647}"""), + InlineData(0, """{"Prop":0}"""), InlineData(1, """{"Prop":1}"""), InlineData(null, """{"Prop":null}""")] public virtual Task Can_read_write_nullable_converted_type_JSON_values(int? value, string json) => Can_read_and_write_JSON_value( b => b.Entity().HasNoKey().Property(e => e.DddId), @@ -1663,9 +1391,7 @@ protected class NullableDddIdType public DddId? DddId { get; set; } } - [ConditionalTheory] - [InlineData(EnumProperty.FieldA, """{"Prop":"A"}""")] - [InlineData(EnumProperty.FieldB, """{"Prop":"B"}""")] + [ConditionalTheory, InlineData(EnumProperty.FieldA, """{"Prop":"A"}"""), InlineData(EnumProperty.FieldB, """{"Prop":"B"}""")] public virtual Task Can_read_write_enum_char_converted_type_JSON_values(int value, string json) => Can_read_and_write_JSON_value( b => b.Entity().HasNoKey().Property(e => e.EnumProperty), @@ -1690,14 +1416,10 @@ protected enum EnumProperty FieldC = 'C', } - [ConditionalTheory] - [InlineData("127.0.0.1", """{"Prop":"127.0.0.1"}""")] - [InlineData("0.0.0.0", """{"Prop":"0.0.0.0"}""")] - [InlineData("255.255.255.255", """{"Prop":"255.255.255.255"}""")] - [InlineData("192.168.1.156", """{"Prop":"192.168.1.156"}""")] - [InlineData("::1", """{"Prop":"::1"}""")] - [InlineData("::", """{"Prop":"::"}""")] - [InlineData("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577", """{"Prop":"2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"}""")] + [ConditionalTheory, InlineData("127.0.0.1", """{"Prop":"127.0.0.1"}"""), InlineData("0.0.0.0", """{"Prop":"0.0.0.0"}"""), + InlineData("255.255.255.255", """{"Prop":"255.255.255.255"}"""), InlineData("192.168.1.156", """{"Prop":"192.168.1.156"}"""), + InlineData("::1", """{"Prop":"::1"}"""), InlineData("::", """{"Prop":"::"}"""), + InlineData("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577", """{"Prop":"2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"}""")] public virtual Task Can_read_write_custom_converted_type_JSON_values(string value, string json) => Can_read_and_write_JSON_value( b => b.Entity().HasNoKey().Property(e => e.Address), @@ -1901,8 +1623,7 @@ protected class DoubleCollectionType public double[] Double { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":[-79228162514264337593543950335,0,79228162514264337593543950335]}""")] + [ConditionalTheory, InlineData("""{"Prop":[-79228162514264337593543950335,0,79228162514264337593543950335]}""")] public virtual Task Can_read_write_collection_of_decimal_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(DecimalCollectionType.Decimal), @@ -1954,8 +1675,7 @@ protected class TimeOnlyCollectionType public IReadOnlyCollection TimeOnly { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":["0001-01-01T00:00:00","2023-05-29T10:52:47","9999-12-31T23:59:59.9999999"]}""")] + [ConditionalTheory, InlineData("""{"Prop":["0001-01-01T00:00:00","2023-05-29T10:52:47","9999-12-31T23:59:59.9999999"]}""")] public virtual Task Can_read_write_collection_of_DateTime_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(DateTimeCollectionType.DateTime), @@ -1972,9 +1692,8 @@ protected class DateTimeCollectionType public IList DateTime { get; set; } = null!; } - [ConditionalTheory] - [InlineData( - """{"Prop":["0001-01-01T00:00:00+00:00","2023-05-29T10:52:47-02:00","2023-05-29T10:52:47+00:00","2023-05-29T10:52:47+02:00","9999-12-31T23:59:59.9999999+00:00"]}""")] + [ConditionalTheory, InlineData( + """{"Prop":["0001-01-01T00:00:00+00:00","2023-05-29T10:52:47-02:00","2023-05-29T10:52:47+00:00","2023-05-29T10:52:47+02:00","9999-12-31T23:59:59.9999999+00:00"]}""")] public virtual Task Can_read_write_collection_of_DateTimeOffset_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(DateTimeOffsetCollectionType.DateTimeOffset), @@ -2040,9 +1759,8 @@ protected class CharacterCollectionType public IList Character { get; set; } = null!; } - [ConditionalTheory] - [InlineData( - """{"Prop":["00000000-0000-0000-0000-000000000000","8c44242f-8e3f-4a20-8be8-98c7c1aadebd","ffffffff-ffff-ffff-ffff-ffffffffffff"]}""")] + [ConditionalTheory, InlineData( + """{"Prop":["00000000-0000-0000-0000-000000000000","8c44242f-8e3f-4a20-8be8-98c7c1aadebd","ffffffff-ffff-ffff-ffff-ffffffffffff"]}""")] public virtual Task Can_read_write_collection_of_GUID_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(GuidCollectionType.Guid), @@ -2076,8 +1794,7 @@ protected class StringCollectionType public IReadOnlyCollection String { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":["AAAAAQ==","/////w==","","AQIDBA=="]}""")] + [ConditionalTheory, InlineData("""{"Prop":["AAAAAQ==","/////w==","","AQIDBA=="]}""")] public virtual Task Can_read_write_collection_of_binary_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(BytesCollectionType.Bytes), @@ -2485,8 +2202,7 @@ protected class NullableDoubleCollectionType public double?[] Double { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":[-79228162514264337593543950335,0,null,79228162514264337593543950335]}""")] + [ConditionalTheory, InlineData("""{"Prop":[-79228162514264337593543950335,0,null,79228162514264337593543950335]}""")] public virtual Task Can_read_write_collection_of_nullable_decimal_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(NullableDecimalCollectionType.Decimal), @@ -2540,8 +2256,7 @@ protected class NullableTimeOnlyCollectionType public IReadOnlyList TimeOnly { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":["0001-01-01T00:00:00",null,"2023-05-29T10:52:47","9999-12-31T23:59:59.9999999"]}""")] + [ConditionalTheory, InlineData("""{"Prop":["0001-01-01T00:00:00",null,"2023-05-29T10:52:47","9999-12-31T23:59:59.9999999"]}""")] public virtual Task Can_read_write_collection_of_nullable_DateTime_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(NullableDateTimeCollectionType.DateTime), @@ -2559,9 +2274,8 @@ protected class NullableDateTimeCollectionType public IList DateTime { get; set; } = null!; } - [ConditionalTheory] - [InlineData( - """{"Prop":["0001-01-01T00:00:00+00:00","2023-05-29T10:52:47-02:00","2023-05-29T10:52:47+00:00",null,"2023-05-29T10:52:47+02:00","9999-12-31T23:59:59.9999999+00:00"]}""")] + [ConditionalTheory, InlineData( + """{"Prop":["0001-01-01T00:00:00+00:00","2023-05-29T10:52:47-02:00","2023-05-29T10:52:47+00:00",null,"2023-05-29T10:52:47+02:00","9999-12-31T23:59:59.9999999+00:00"]}""")] public virtual Task Can_read_write_collection_of_nullable_DateTimeOffset_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(NullableDateTimeOffsetCollectionType.DateTimeOffset), @@ -2635,9 +2349,8 @@ protected class NullableCharacterCollectionType public IList Character { get; set; } = null!; } - [ConditionalTheory] - [InlineData( - """{"Prop":["00000000-0000-0000-0000-000000000000",null,"8c44242f-8e3f-4a20-8be8-98c7c1aadebd","ffffffff-ffff-ffff-ffff-ffffffffffff"]}""")] + [ConditionalTheory, InlineData( + """{"Prop":["00000000-0000-0000-0000-000000000000",null,"8c44242f-8e3f-4a20-8be8-98c7c1aadebd","ffffffff-ffff-ffff-ffff-ffffffffffff"]}""")] public virtual Task Can_read_write_collection_of_nullable_GUID_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(NullableGuidCollectionType.Guid), @@ -2673,8 +2386,7 @@ protected class NullableStringCollectionType public IList String { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":["AAAAAQ==",null,"/////w==","","AQIDBA=="]}""")] + [ConditionalTheory, InlineData("""{"Prop":["AAAAAQ==",null,"/////w==","","AQIDBA=="]}""")] public virtual Task Can_read_write_collection_of_nullable_binary_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(NullableBytesCollectionType.Bytes), @@ -3189,7 +2901,7 @@ public virtual Task Can_read_write_collection_of_nullable_DateOnly_values_with_c new List { DateOnly.MinValue, - new(2023, 5, 29), + new DateOnly(2023, 5, 29), DateOnly.MaxValue, null }, @@ -3211,7 +2923,7 @@ public virtual Task Can_read_write_collection_of_nullable_DateTime_values_with_c { DateTime.MinValue, null, - new(2023, 5, 29, 10, 52, 47), + new DateTime(2023, 5, 29, 10, 52, 47), DateTime.MaxValue }, """{"Prop":"[\u00220001-01-01T00:00:00\u0022,null,\u00222023-05-29T10:52:47\u0022,\u00229999-12-31T23:59:59.9999999\u0022]"}"""); @@ -3342,12 +3054,11 @@ protected class NullableEnumU64ConvertedType [ConditionalFact] public virtual Task Can_read_write_collection_of_int_with_converter_JSON_values() => Can_read_and_write_JSON_collection_value>( - b => b.ElementType( - b => - { - b.HasConversion(); - b.IsRequired(); - }), + b => b.ElementType(b => + { + b.HasConversion(); + b.IsRequired(); + }), nameof(DddIdCollectionType.DddId), [ new DddId { Id = int.MinValue }, @@ -3395,8 +3106,7 @@ protected class BinaryAsJsonType public byte[] BinaryAsJson { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":[-79228162514264337593543950335,0,79228162514264337593543950335]}""")] + [ConditionalTheory, InlineData("""{"Prop":[-79228162514264337593543950335,0,79228162514264337593543950335]}""")] public virtual Task Can_read_write_collection_of_decimal_with_precision_and_scale_JSON_values(string expected) => Can_read_and_write_JSON_collection_value>( b => b.ElementType().HasPrecision(12, 6), @@ -3409,8 +3119,7 @@ public virtual Task Can_read_write_collection_of_decimal_with_precision_and_scal expected, facets: new Dictionary { { CoreAnnotationNames.Precision, 12 }, { CoreAnnotationNames.Scale, 6 } }); - [ConditionalTheory] - [InlineData("""{"Prop":["AAAAAAAAAAAAAAAAAAAAAA==","LyREjD+OIEqL6JjHwarevQ==","/////////////////////w=="]}""")] + [ConditionalTheory, InlineData("""{"Prop":["AAAAAAAAAAAAAAAAAAAAAA==","LyREjD+OIEqL6JjHwarevQ==","/////////////////////w=="]}""")] public virtual Task Can_read_write_collection_of_Guid_converted_to_bytes_JSON_values(string expected) => Can_read_and_write_JSON_collection_value>( b => b.ElementType().HasConversion(), @@ -3427,13 +3136,12 @@ public virtual Task Can_read_write_collection_of_Guid_converted_to_bytes_JSON_va public virtual Task Can_read_write_list_of_array_of_int_JSON_values() => Can_read_and_write_JSON_value>( nameof(Int32ArrayListType.Prop), - new List - { + [ new[] { int.MinValue, 0, int.MaxValue }, Array.Empty(), null, new[] { 77 } - }, + ], """{"Prop":[[-2147483648,0,2147483647],[],null,[77]]}""", mappedCollection: true); @@ -3446,13 +3154,12 @@ protected class Int32ArrayListType public virtual Task Can_read_write_list_of_array_of_nullable_int_JSON_values() => Can_read_and_write_JSON_value>( nameof(NullableInt32ArrayListType.Prop), - new List - { + [ new int?[] { int.MinValue, null, int.MaxValue }, Array.Empty(), null, new int?[] { 77 } - }, + ], """{"Prop":[[-2147483648,null,2147483647],[],null,[77]]}""", mappedCollection: true); @@ -3465,12 +3172,11 @@ protected class NullableInt32ArrayListType public virtual Task Can_read_write_list_of_array_of_string_JSON_values() => Can_read_and_write_JSON_value>( nameof(StringArrayListType.Prop), - new List - { + [ new[] { "X", "Y", "" }, Array.Empty(), new[] { "77" } - }, + ], """{"Prop":[["X","Y",""],[],["77"]]}""", mappedCollection: true); @@ -3483,12 +3189,11 @@ protected class StringArrayListType public virtual Task Can_read_write_list_of_array_of_IPAddress_JSON_values() => Can_read_and_write_JSON_value>( nameof(IpAddressArrayListType.Prop), - new ObservableCollection - { + [ new[] { IPAddress.Parse("127.0.0.1"), IPAddress.Parse("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577") }, Array.Empty(), new[] { new IPAddress(0) } - }, + ], """{"Prop":[["127.0.0.1","2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"],[],["0.0.0.0"]]}""", mappedCollection: true); @@ -3501,12 +3206,11 @@ protected class IpAddressArrayListType public virtual Task Can_read_write_list_of_array_of_ulong_JSON_values() => Can_read_and_write_JSON_value>( nameof(ULongArrayListType.Prop), - new List - { + [ new[] { ulong.MinValue, 1UL, ulong.MaxValue }, Array.Empty(), new[] { 77UL } - }, + ], """{"Prop":[[0,1,18446744073709551615],[],[77]]}""", mappedCollection: true); @@ -3519,12 +3223,11 @@ protected class ULongArrayListType public virtual Task Can_read_write_list_of_array_of_nullable_ulong_JSON_values() => Can_read_and_write_JSON_value>( nameof(NullableULongArrayListType.Prop), - new List - { + [ new ulong?[] { ulong.MinValue, null, ulong.MaxValue }, Array.Empty(), new ulong?[] { 77UL } - }, + ], """{"Prop":[[0,null,18446744073709551615],[],[77]]}""", mappedCollection: true); @@ -3533,8 +3236,7 @@ protected class NullableULongArrayListType public List Prop { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":[["AAEC","AQ==","TQ=="],[],["Tg=="]]}""")] + [ConditionalTheory, InlineData("""{"Prop":[["AAEC","AQ==","TQ=="],[],["Tg=="]]}""")] public virtual Task Can_read_write_list_of_array_of_binary_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(BinaryArrayListType.Prop), @@ -3552,18 +3254,16 @@ protected class BinaryArrayListType public IEnumerable Prop { get; set; } = null!; } - [ConditionalTheory] - [InlineData( - """{"Prop":[["00000000-0000-0000-0000-000000000000","8c44242f-8e3f-4a20-8be8-98c7c1aadebd"],[],["ffffffff-ffff-ffff-ffff-ffffffffffff"]]}""")] + [ConditionalTheory, InlineData( + """{"Prop":[["00000000-0000-0000-0000-000000000000","8c44242f-8e3f-4a20-8be8-98c7c1aadebd"],[],["ffffffff-ffff-ffff-ffff-ffffffffffff"]]}""")] public virtual Task Can_read_write_list_of_array_of_GUID_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(GuidArrayListType.Prop), - new List - { + [ new[] { new Guid("00000000-0000-0000-0000-000000000000"), new Guid("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD") }, Array.Empty(), new[] { new Guid("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF") } - }, + ], expected, mappedCollection: true); @@ -3572,21 +3272,17 @@ protected class GuidArrayListType public List Prop { get; set; } = null!; } - [ConditionalTheory] - [InlineData( - """{"Prop":[["00000000-0000-0000-0000-000000000000",null,"8c44242f-8e3f-4a20-8be8-98c7c1aadebd"],[],["ffffffff-ffff-ffff-ffff-ffffffffffff"]]}""")] + [ConditionalTheory, InlineData( + """{"Prop":[["00000000-0000-0000-0000-000000000000",null,"8c44242f-8e3f-4a20-8be8-98c7c1aadebd"],[],["ffffffff-ffff-ffff-ffff-ffffffffffff"]]}""")] public virtual Task Can_read_write_list_of_array_of_nullable_GUID_JSON_values(string expected) => Can_read_and_write_JSON_value>( nameof(NullableGuidArrayListType.Prop), - new List - { - new Guid?[] - { - new Guid("00000000-0000-0000-0000-000000000000"), null, new Guid("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD") - }, + [ + new Guid?[] { new Guid("00000000-0000-0000-0000-000000000000"), null, new Guid("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD") }, + Array.Empty(), new Guid?[] { new Guid("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF") } - }, + ], expected, mappedCollection: true); @@ -3601,14 +3297,13 @@ public virtual Task Can_read_write_array_of_list_of_int_JSON_values() nameof(Int32ListArrayType.Prop), new List[] { - new() - { + [ int.MinValue, 0, int.MaxValue - }, - new(), - new() { 77 } + ], + [], + [77] }, """{"Prop":[[-2147483648,0,2147483647],[],[77]]}""", mappedCollection: true); @@ -3622,17 +3317,15 @@ protected class Int32ListArrayType public virtual Task Can_read_write_array_of_list_of_string_JSON_values() => Can_read_and_write_JSON_value[]>( nameof(StringListArrayType.Prop), - new List[] - { - new() - { + [ + [ "X", "Y", "" - }, - new(), - new() { "77" } - }, + ], + [], + ["77"] + ], """{"Prop":[["X","Y",""],[],["77"]]}""", mappedCollection: true); @@ -3645,12 +3338,11 @@ protected class StringListArrayType public virtual Task Can_read_write_array_of_list_of_IPAddress_JSON_values() => Can_read_and_write_JSON_value[]>( nameof(IpAddressListArrayType.Prop), - new Collection[] - { - new() { IPAddress.Parse("127.0.0.1"), IPAddress.Parse("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577") }, - new(), - new() { new IPAddress(0) } - }, + [ + [IPAddress.Parse("127.0.0.1"), IPAddress.Parse("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577")], + [], + [new IPAddress(0)] + ], """{"Prop":[["127.0.0.1","2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"],[],["0.0.0.0"]]}""", mappedCollection: true); @@ -3663,17 +3355,15 @@ protected class IpAddressListArrayType public virtual Task Can_read_write_array_of_list_of_ulong_JSON_values() => Can_read_and_write_JSON_value[]>( nameof(ULongListArrayType.Prop), - new List[] - { - new() - { + [ + [ ulong.MinValue, 1UL, ulong.MaxValue - }, - new(), - new() { 77UL } - }, + ], + [], + [77UL] + ], """{"Prop":[[0,1,18446744073709551615],[],[77]]}""", mappedCollection: true); @@ -3682,22 +3372,19 @@ protected class ULongListArrayType public List[] Prop { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":[["AAEC","AQ==","TQ=="],[],["Tg=="]]}""")] + [ConditionalTheory, InlineData("""{"Prop":[["AAEC","AQ==","TQ=="],[],["Tg=="]]}""")] public virtual Task Can_read_write_array_of_list_of_binary_JSON_values(string expected) => Can_read_and_write_JSON_value[]>( nameof(BinaryListArrayType.Prop), - new List[] - { - new() - { + [ + [ new byte[] { 0, 1, 2 }, new byte[] { 1 }, new byte[] { 77 } - }, - new(), - new() { new byte[] { 78 } } - }, + ], + [], + [new byte[] { 78 }] + ], expected, mappedCollection: true); @@ -3706,17 +3393,16 @@ protected class BinaryListArrayType public List[] Prop { get; set; } = null!; } - [ConditionalTheory] - [InlineData( - """{"Prop":[["00000000-0000-0000-0000-000000000000","8c44242f-8e3f-4a20-8be8-98c7c1aadebd"],[],["ffffffff-ffff-ffff-ffff-ffffffffffff"]]}""")] + [ConditionalTheory, InlineData( + """{"Prop":[["00000000-0000-0000-0000-000000000000","8c44242f-8e3f-4a20-8be8-98c7c1aadebd"],[],["ffffffff-ffff-ffff-ffff-ffffffffffff"]]}""")] public virtual Task Can_read_write_array_of_list_of_GUID_JSON_values(string expected) => Can_read_and_write_JSON_value[]>( nameof(GuidListArrayType.Prop), new List[] { - new() { new Guid("00000000-0000-0000-0000-000000000000"), new Guid("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD") }, - new(), - new() { new Guid("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF") } + [new Guid("00000000-0000-0000-0000-000000000000"), new Guid("8C44242F-8E3F-4A20-8BE8-98C7C1AADEBD")], + [], + [new Guid("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")] }, expected, mappedCollection: true); @@ -3730,8 +3416,7 @@ protected class GuidListArrayType public virtual Task Can_read_write_list_of_list_of_list_of_int_JSON_values() => Can_read_and_write_JSON_value>>>( nameof(Int32ListListListType.Prop), - new List>> - { + [ new() { new List @@ -3742,6 +3427,7 @@ public virtual Task Can_read_write_list_of_list_of_list_of_int_JSON_values() }, new List { 77 } }, + new(), new() { @@ -3749,7 +3435,7 @@ public virtual Task Can_read_write_list_of_list_of_list_of_int_JSON_values() new List(), new List { 78, 79 } } - }, + ], """{"Prop":[[[-2147483648,0,2147483647],[77]],[],[[1,2],[],[78,79]]]}""", mappedCollection: true); @@ -3765,7 +3451,7 @@ public virtual Task Can_read_write_array_of_array_of_array_of_int_JSON_values() [ [[int.MinValue, 0, int.MaxValue], [77]], [], - [[1, 2], Array.Empty(), [78, 79]] + [[1, 2], [], [78, 79]] ], """{"Prop":[[[-2147483648,0,2147483647],[77]],[],[[1,2],[],[78,79]]]}""", mappedCollection: true); @@ -3779,21 +3465,20 @@ protected class Int32ArrayArrayArrayType public virtual Task Can_read_write_list_of_array_of_list_of_string_JSON_values() => Can_read_and_write_JSON_value[]>>( nameof(StringListArrayListType.Prop), - new List[]> - { + [ new List[] { - new() - { + [ "int.MinValue", "", "int.MaxValue" - }, - new() { "77" } + ], + ["77"] }, + Array.Empty>(), - new List[] { new() { "1", "2" }, new(), new() { "78", "79" } } - }, + new List[] { ["1", "2"], [], ["78", "79"] } + ], """{"Prop":[[["int.MinValue","","int.MaxValue"],["77"]],[],[["1","2"],[],["78","79"]]]}""", mappedCollection: true); @@ -3806,17 +3491,15 @@ protected class StringListArrayListType public virtual Task Can_read_write_array_of_list_of_array_of_string_JSON_values() => Can_read_and_write_JSON_value[]>( nameof(StringArrayListArrayType.Prop), - new List[] - { - new() { new[] { "int.MinValue", "", "int.MaxValue" }, new[] { "77" } }, - new(), - new() - { + [ + [new[] { "int.MinValue", "", "int.MaxValue" }, new[] { "77" }], + [], + [ new[] { "1", "2" }, Array.Empty(), new[] { "78", "79" } - } - }, + ] + ], """{"Prop":[[["int.MinValue","","int.MaxValue"],["77"]],[],[["1","2"],[],["78","79"]]]}""", mappedCollection: true); @@ -3829,12 +3512,11 @@ protected class StringArrayListArrayType public virtual Task Can_read_write_array_of_list_of_array_of_IPAddress_JSON_values() => Can_read_and_write_JSON_value[]>( nameof(IpAddressArrayListArrayType.Prop), - new List[] - { - new() { new[] { IPAddress.Parse("127.0.0.1"), IPAddress.Parse("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577") } }, - new(), - new() { new[] { new IPAddress(0) } } - }, + [ + [new[] { IPAddress.Parse("127.0.0.1"), IPAddress.Parse("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577") }], + [], + [new[] { new IPAddress(0) }] + ], """{"Prop":[[["127.0.0.1","2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"]],[],[["0.0.0.0"]]]}""", mappedCollection: true); @@ -3847,15 +3529,15 @@ protected class IpAddressArrayListArrayType public virtual Task Can_read_write_list_of_array_of_list_of_IPAddress_JSON_values() => Can_read_and_write_JSON_value[]>>( nameof(IpAddressListArrayListType.Prop), - new List[]> - { + [ new List[] { - new() { IPAddress.Parse("127.0.0.1"), IPAddress.Parse("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577") } + [IPAddress.Parse("127.0.0.1"), IPAddress.Parse("2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577")] }, + Array.Empty>(), - new List[] { new() { new IPAddress(0) } } - }, + new List[] { [new IPAddress(0)] } + ], """{"Prop":[[["127.0.0.1","2a00:23c7:c60f:4f01:ba43:6d5a:e648:7577"]],[],[["0.0.0.0"]]]}""", mappedCollection: true); @@ -3868,12 +3550,11 @@ protected class IpAddressListArrayListType public virtual Task Can_read_write_list_of_array_of_list_of_ulong_JSON_values() => Can_read_and_write_JSON_value>>( nameof(ULongListArrayListType.Prop), - new List> - { + [ new() { new[] { ulong.MinValue, 1UL, ulong.MaxValue } }, new(), new() { new[] { 77UL } } - }, + ], """{"Prop":[[[0,1,18446744073709551615]],[],[[77]]]}""", mappedCollection: true); @@ -3882,20 +3563,20 @@ protected class ULongListArrayListType public List> Prop { get; set; } = null!; } - [ConditionalTheory] - [InlineData("""{"Prop":[[[["AAEC","AQ==","TQ=="]],[],[[],[]]],[],[[[]],[["AAEC","AQ==","TQ=="]]]]}""")] + [ConditionalTheory, InlineData("""{"Prop":[[[["AAEC","AQ==","TQ=="]],[],[[],[]]],[],[[[]],[["AAEC","AQ==","TQ=="]]]]}""")] public virtual Task Can_read_write_list_of_array_of_list_of_array_of_binary_JSON_values(string expected) => Can_read_and_write_JSON_value[]>>( nameof(BinaryListArrayArrayListType.Prop), - new List[]> - { + [ new List[] { - new() { new[] { new byte[] { 0, 1, 2 }, [1], [77] } }, new(), new() { new byte[][] { }, Array.Empty() } + [new[] { new byte[] { 0, 1, 2 }, [1], [77] }], [], [new byte[][] { }, Array.Empty()] }, + Array.Empty>(), - new List[] { new() { new byte[][] { } }, new() { new[] { new byte[] { 0, 1, 2 }, [1], [77] } } }, - }, + new List[] { [new byte[][] { }], [new[] { new byte[] { 0, 1, 2 }, [1], [77] }] } + + ], expected, mappedCollection: true); diff --git a/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs b/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs index 90a6b92c44b..4fae48c791b 100644 --- a/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs +++ b/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs @@ -687,13 +687,13 @@ await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableIntStruct [ await context.Set() .FirstOrDefaultAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 111 })), - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new GenericComparableIntStructKey { Id = oneTwelve })), + await context.Set() + .FirstOrDefaultAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = oneTwelve })), await context.Set().FirstOrDefaultAsync(e => e.Id.Equals(oneThirteen)), await context.Set() .FirstOrDefaultAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 114 })), - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new GenericComparableIntStructKey { Id = oneFifteeen })), + await context.Set() + .FirstOrDefaultAsync(e => e.Id.Equals(new GenericComparableIntStructKey { Id = oneFifteeen })), await context.Set().FirstOrDefaultAsync(e => e.Id.Equals(oneSixteen)) ]; @@ -1358,8 +1358,8 @@ IQueryable principalQuery await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 1 } })), await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey(two))), await principalQuery.SingleAsync(e => e.Id.Equals(three)), - await principalQuery.SingleAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) + await principalQuery.SingleAsync(e + => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) ]; if (!Fixture.UseInclude) @@ -1377,15 +1377,15 @@ await principalQuery.SingleAsync( dependents = [ - await context.Set().SingleAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 101 } })), - await context.Set().SingleAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey(oneOhTwo))), + await context.Set().SingleAsync(e + => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 101 } })), + await context.Set() + .SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey(oneOhTwo))), await context.Set().SingleAsync(e => e.Id.Equals(oneOhThree)), - await context.Set().SingleAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 104 } })), - await context.Set().SingleAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey(oneOhFive))), + await context.Set().SingleAsync(e + => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 104 } })), + await context.Set() + .SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey(oneOhFive))), await context.Set().SingleAsync(e => e.Id.Equals(oneOhSix)) ]; @@ -1506,13 +1506,13 @@ await principalQuery.SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey(t dependents = [ - await context.Set().SingleAsync( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 101 } })), + await context.Set() + .SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 101 } })), await context.Set() .SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey(oneOhTwo))), await context.Set().SingleAsync(e => e.Id.Equals(oneOhThree)), - await context.Set().SingleAsync( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 104 } })), + await context.Set() + .SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 104 } })), await context.Set() .SingleAsync(e => e.Id.Equals(new ComparableBytesStructKey(oneOhFive))), await context.Set().SingleAsync(e => e.Id.Equals(oneOhSix)) @@ -1630,15 +1630,15 @@ await principalQuery.SingleAsync(e => e.Id.Equals(three)), dependents = [ - await context.Set().SingleAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 101 } })), - await context.Set().SingleAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey(oneOhTwo))), + await context.Set().SingleAsync(e + => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 101 } })), + await context.Set() + .SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey(oneOhTwo))), await context.Set().SingleAsync(e => e.Id.Equals(oneOhThree)), - await context.Set().SingleAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 104 } })), - await context.Set().SingleAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey(oneOhFive))), + await context.Set().SingleAsync(e + => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 104 } })), + await context.Set() + .SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey(oneOhFive))), await context.Set().SingleAsync(e => e.Id.Equals(oneOhSix)) ]; @@ -1875,13 +1875,13 @@ await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), dependents = [ - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 111 } })), + await context.Set() + .FirstOrDefaultAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 111 } })), await context.Set() .FirstOrDefaultAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = oneTwelve })), await context.Set().FirstOrDefaultAsync(e => e.Id.Equals(oneThirteen)), - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 114 } })), + await context.Set() + .FirstOrDefaultAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 114 } })), await context.Set() .FirstOrDefaultAsync(e => e.Id.Equals(new ComparableBytesStructKey { Id = oneFifteeen })), await context.Set().FirstOrDefaultAsync(e => e.Id.Equals(oneSixteen)) @@ -1986,8 +1986,8 @@ IQueryable principalQuery await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 11 } })), await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = twelve })), await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), - await principalQuery.SingleAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) + await principalQuery.SingleAsync(e + => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; if (!Fixture.UseInclude) @@ -2005,15 +2005,15 @@ await principalQuery.SingleAsync( dependents = [ - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 111 } })), - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneTwelve })), + await context.Set().FirstOrDefaultAsync(e + => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 111 } })), + await context.Set() + .FirstOrDefaultAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneTwelve })), await context.Set().FirstOrDefaultAsync(e => e.Id.Equals(oneThirteen)), - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 114 } })), - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneFifteeen })), + await context.Set().FirstOrDefaultAsync(e + => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 114 } })), + await context.Set() + .FirstOrDefaultAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneFifteeen })), await context.Set().FirstOrDefaultAsync(e => e.Id.Equals(oneSixteen)) ]; @@ -2116,8 +2116,8 @@ async Task RunQueries(DbContext context) await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 11 } })), await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = twelve })), await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), - await principalQuery.SingleAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) + await principalQuery.SingleAsync(e + => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; if (!Fixture.UseInclude) @@ -2135,15 +2135,15 @@ await principalQuery.SingleAsync( dependents = [ - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 111 } })), - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = oneTwelve })), + await context.Set().FirstOrDefaultAsync(e + => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 111 } })), + await context.Set() + .FirstOrDefaultAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = oneTwelve })), await context.Set().FirstOrDefaultAsync(e => e.Id.Equals(oneThirteen)), - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 114 } })), - await context.Set().FirstOrDefaultAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = oneFifteeen })), + await context.Set().FirstOrDefaultAsync(e + => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 114 } })), + await context.Set() + .FirstOrDefaultAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = oneFifteeen })), await context.Set().FirstOrDefaultAsync(e => e.Id.Equals(oneSixteen)) ]; @@ -2399,8 +2399,8 @@ public virtual async Task Can_query_and_update_owned_entity_with_structural_gene using (var context = CreateContext()) { - var owner = await context.Set().SingleAsync( - o => o.Id.Equals(new StructuralComparableBytesStructKey(new byte[] { 1, 5, 7, 1 }))); + var owner = await context.Set() + .SingleAsync(o => o.Id.Equals(new StructuralComparableBytesStructKey(new byte[] { 1, 5, 7, 1 }))); Assert.Equal(77, owner.Owned.Position); owner.Owned = new OwnedStructuralComparableBytesStructKey(88); @@ -4308,8 +4308,8 @@ IQueryable principalQuery await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 1 } })), await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey(two))), (await principalQuery.Where(e => e.Id.Equals(three)).ToListAsync()).Single(), - await principalQuery.SingleAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) + await principalQuery.SingleAsync(e + => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } })) ]; if (!Fixture.UseInclude) @@ -5263,8 +5263,8 @@ IQueryable principalQuery await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 11 } })), await principalQuery.SingleAsync(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = twelve })), await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), - await principalQuery.SingleAsync( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) + await principalQuery.SingleAsync(e + => e.Id.Equals(new StructuralComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; if (!Fixture.UseInclude) @@ -5469,8 +5469,8 @@ IQueryable principalQuery await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 11 } })), await principalQuery.SingleAsync(e => e.Id.Equals(new GenericComparableBytesStructKey { Id = twelve })), await principalQuery.SingleAsync(e => e.Id.Equals(thirteen)), - await principalQuery.SingleAsync( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) + await principalQuery.SingleAsync(e + => e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } })) ]; if (!Fixture.UseInclude) @@ -7288,402 +7288,423 @@ public virtual bool UseInclude protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(IntStructKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(IntStructKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(IntStructKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(IntStructKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(IntClassKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(IntClassKey.Converter); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(IntClassKey.Converter); + b.Property(e => e.PrincipalId).HasConversion(IntClassKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(IntClassKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(IntClassKey.Converter); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(IntClassKey.Converter); + b.Property(e => e.PrincipalId).HasConversion(IntClassKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(EnumerableClassKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(EnumerableClassKey.Converter); }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(EnumerableClassKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(EnumerableClassKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(EnumerableClassKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(EnumerableClassKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); - b.Property(e => e.PrincipalId).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); + b.Property(e => e.PrincipalId).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); - b.Property(e => e.PrincipalId).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); + b.Property(e => e.PrincipalId).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntStructKey.Converter); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); + b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntStructKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntStructKey.Converter); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); + b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(BytesStructKey.Converter); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); + b.Property(e => e.PrincipalId).HasConversion(BytesStructKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(BytesStructKey.Converter); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); + b.Property(e => e.PrincipalId).HasConversion(BytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(GenericComparableBytesStructKey.Converter); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); + b.Property(e => e.PrincipalId).HasConversion(GenericComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(GenericComparableBytesStructKey.Converter); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); + b.Property(e => e.PrincipalId).HasConversion(GenericComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); - b.Property(e => e.PrincipalId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); + b.Property(e => e.PrincipalId); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntClassKey.Converter); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); + b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntClassKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); - b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntClassKey.Converter); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); + b.Property(e => e.PrincipalId).HasConversion(GenericComparableIntClassKey.Converter); + }); - modelBuilder.Entity( - entity => - { - entity.HasKey(e => e.Name); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Name); - entity.Property(p => p.Name) - .HasConversion( - p => p.Value, - p => new Key(p), - new ValueComparer( - (l, r) => (l == null && r == null) || (l != null && r != null && l.Value == r.Value), - v => v == null ? 0 : v.Value.GetHashCode())); + entity.Property(p => p.Name) + .HasConversion( + p => p.Value, + p => new Key(p), + new ValueComparer( + (l, r) => (l == null && r == null) || (l != null && r != null && l.Value == r.Value), + v => v == null ? 0 : v.Value.GetHashCode())); - entity.OwnsOne(p => p.Text); - entity.Navigation(p => p.Text).IsRequired(); - }); + entity.OwnsOne(p => p.Text); + entity.Navigation(p => p.Text).IsRequired(); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(IntStructKey.Converter); }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(IntClassKey.Converter); }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); }); + modelBuilder.Entity(b => { b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); + }); - modelBuilder.Entity( - b => { b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(IntStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(IntStructKey.Converter); + b.OwnsOne(e => e.Owned); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BytesStructKey.Converter); + b.OwnsOne(e => e.Owned); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntStructKey.Converter); + b.OwnsOne(e => e.Owned); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableBytesStructKey.Converter); + b.OwnsOne(e => e.Owned); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntStructKey.Converter); + b.OwnsOne(e => e.Owned); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableBytesStructKey.Converter); + b.OwnsOne(e => e.Owned); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(StructuralComparableBytesStructKey.Converter); + b.OwnsOne(e => e.Owned); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(IntClassKey.Converter); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(IntClassKey.Converter); + b.OwnsOne(e => e.Owned); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(BareIntClassKey.Converter, BareIntClassKey.Comparer); + b.OwnsOne(e => e.Owned); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(ComparableIntClassKey.Converter); + b.OwnsOne(e => e.Owned); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); - b.OwnsOne(e => e.Owned); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion(GenericComparableIntClassKey.Converter); + b.OwnsOne(e => e.Owned); + }); } } } diff --git a/test/EFCore.Specification.Tests/LazyLoadProxyTestBase.cs b/test/EFCore.Specification.Tests/LazyLoadProxyTestBase.cs index 7409f555a8a..b026df26036 100644 --- a/test/EFCore.Specification.Tests/LazyLoadProxyTestBase.cs +++ b/test/EFCore.Specification.Tests/LazyLoadProxyTestBase.cs @@ -17,9 +17,7 @@ public abstract class LazyLoadProxyTestBase(TFixture fixture) : IClass { protected TFixture Fixture { get; } = fixture; - [ConditionalTheory] // Issue #32390 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #32390 public virtual void Can_use_proxies_from_multiple_threads_when_navigations_already_loaded(bool noTracking) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -95,12 +93,8 @@ public virtual void Detected_dependent_reference_navigation_changes_are_detected Assert.True(context.Entry(single).Reference(e => e.Parent).IsLoaded); } - [ConditionalTheory] // Issue #13138 - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] // Issue #13138 public virtual void Lazy_load_one_to_one_reference_with_recursive_property(EntityState state) { using (var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached)) @@ -136,13 +130,9 @@ public virtual void Lazy_load_one_to_one_reference_with_recursive_property(Entit } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Added, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false), InlineData(EntityState.Modified, false), + InlineData(EntityState.Added, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, true), + InlineData(EntityState.Added, true)] public virtual void Attached_references_to_principal_are_marked_as_loaded(EntityState state, bool lazy) { using var context = CreateContext(lazy); @@ -193,13 +183,9 @@ public virtual void Attached_references_to_principal_are_marked_as_loaded(Entity Assert.True(context.Entry(parent).Reference(e => e.SingleCompositeKey).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Added, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false), InlineData(EntityState.Modified, false), + InlineData(EntityState.Added, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, true), + InlineData(EntityState.Added, true)] public virtual void Attached_references_to_dependents_are_marked_as_loaded(EntityState state, bool lazy) { using var context = CreateContext(lazy); @@ -250,13 +236,9 @@ public virtual void Attached_references_to_dependents_are_marked_as_loaded(Entit Assert.True(context.Entry(parent.SingleCompositeKey).Reference(e => e.Parent).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Added, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false), InlineData(EntityState.Modified, false), + InlineData(EntityState.Added, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, true), + InlineData(EntityState.Added, true)] public virtual void Attached_collections_are_not_marked_as_loaded(EntityState state, bool lazy) { using var context = CreateContext(lazy); @@ -313,22 +295,13 @@ public virtual void Attached_collections_are_not_marked_as_loaded(EntityState st Assert.False(context.Entry(parent).Collection(e => e.ChildrenCompositeKey!).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false, false)] - [InlineData(EntityState.Added, false, false)] - [InlineData(EntityState.Modified, false, false)] - [InlineData(EntityState.Deleted, false, false)] - [InlineData(EntityState.Detached, false, false)] - [InlineData(EntityState.Unchanged, true, false)] - [InlineData(EntityState.Added, true, false)] - [InlineData(EntityState.Modified, true, false)] - [InlineData(EntityState.Deleted, true, false)] - [InlineData(EntityState.Detached, true, false)] - [InlineData(EntityState.Unchanged, true, true)] - [InlineData(EntityState.Added, true, true)] - [InlineData(EntityState.Modified, true, true)] - [InlineData(EntityState.Deleted, true, true)] - [InlineData(EntityState.Detached, true, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false, false), InlineData(EntityState.Added, false, false), + InlineData(EntityState.Modified, false, false), InlineData(EntityState.Deleted, false, false), + InlineData(EntityState.Detached, false, false), InlineData(EntityState.Unchanged, true, false), + InlineData(EntityState.Added, true, false), InlineData(EntityState.Modified, true, false), + InlineData(EntityState.Deleted, true, false), InlineData(EntityState.Detached, true, false), + InlineData(EntityState.Unchanged, true, true), InlineData(EntityState.Added, true, true), InlineData(EntityState.Modified, true, true), + InlineData(EntityState.Deleted, true, true), InlineData(EntityState.Detached, true, true)] public virtual void Lazy_load_collection(EntityState state, bool useAttach, bool useDetach) { Parent? parent = null; @@ -397,22 +370,13 @@ public virtual void Lazy_load_collection(EntityState state, bool useAttach, bool } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false, false)] - [InlineData(EntityState.Added, false, false)] - [InlineData(EntityState.Modified, false, false)] - [InlineData(EntityState.Deleted, false, false)] - [InlineData(EntityState.Detached, false, false)] - [InlineData(EntityState.Unchanged, true, false)] - [InlineData(EntityState.Added, true, false)] - [InlineData(EntityState.Modified, true, false)] - [InlineData(EntityState.Deleted, true, false)] - [InlineData(EntityState.Detached, true, false)] - [InlineData(EntityState.Unchanged, true, true)] - [InlineData(EntityState.Added, true, true)] - [InlineData(EntityState.Modified, true, true)] - [InlineData(EntityState.Deleted, true, true)] - [InlineData(EntityState.Detached, true, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false, false), InlineData(EntityState.Added, false, false), + InlineData(EntityState.Modified, false, false), InlineData(EntityState.Deleted, false, false), + InlineData(EntityState.Detached, false, false), InlineData(EntityState.Unchanged, true, false), + InlineData(EntityState.Added, true, false), InlineData(EntityState.Modified, true, false), + InlineData(EntityState.Deleted, true, false), InlineData(EntityState.Detached, true, false), + InlineData(EntityState.Unchanged, true, true), InlineData(EntityState.Added, true, true), InlineData(EntityState.Modified, true, true), + InlineData(EntityState.Deleted, true, true), InlineData(EntityState.Detached, true, true)] public virtual void Lazy_load_many_to_one_reference_to_principal(EntityState state, bool useAttach, bool useDetach) { Child? child = null; @@ -506,22 +470,13 @@ public virtual void Lazy_load_many_to_one_reference_to_principal(EntityState sta } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false, false)] - [InlineData(EntityState.Added, false, false)] - [InlineData(EntityState.Modified, false, false)] - [InlineData(EntityState.Deleted, false, false)] - [InlineData(EntityState.Detached, false, false)] - [InlineData(EntityState.Unchanged, true, false)] - [InlineData(EntityState.Added, true, false)] - [InlineData(EntityState.Modified, true, false)] - [InlineData(EntityState.Deleted, true, false)] - [InlineData(EntityState.Detached, true, false)] - [InlineData(EntityState.Unchanged, true, true)] - [InlineData(EntityState.Added, true, true)] - [InlineData(EntityState.Modified, true, true)] - [InlineData(EntityState.Deleted, true, true)] - [InlineData(EntityState.Detached, true, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false, false), InlineData(EntityState.Added, false, false), + InlineData(EntityState.Modified, false, false), InlineData(EntityState.Deleted, false, false), + InlineData(EntityState.Detached, false, false), InlineData(EntityState.Unchanged, true, false), + InlineData(EntityState.Added, true, false), InlineData(EntityState.Modified, true, false), + InlineData(EntityState.Deleted, true, false), InlineData(EntityState.Detached, true, false), + InlineData(EntityState.Unchanged, true, true), InlineData(EntityState.Added, true, true), InlineData(EntityState.Modified, true, true), + InlineData(EntityState.Deleted, true, true), InlineData(EntityState.Detached, true, true)] public virtual void Lazy_load_one_to_one_reference_to_principal(EntityState state, bool useAttach, bool useDetach) { Single? single = null; @@ -615,22 +570,13 @@ public virtual void Lazy_load_one_to_one_reference_to_principal(EntityState stat } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false, false)] - [InlineData(EntityState.Added, false, false)] - [InlineData(EntityState.Modified, false, false)] - [InlineData(EntityState.Deleted, false, false)] - [InlineData(EntityState.Detached, false, false)] - [InlineData(EntityState.Unchanged, true, false)] - [InlineData(EntityState.Added, true, false)] - [InlineData(EntityState.Modified, true, false)] - [InlineData(EntityState.Deleted, true, false)] - [InlineData(EntityState.Detached, true, false)] - [InlineData(EntityState.Unchanged, true, true)] - [InlineData(EntityState.Added, true, true)] - [InlineData(EntityState.Modified, true, true)] - [InlineData(EntityState.Deleted, true, true)] - [InlineData(EntityState.Detached, true, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false, false), InlineData(EntityState.Added, false, false), + InlineData(EntityState.Modified, false, false), InlineData(EntityState.Deleted, false, false), + InlineData(EntityState.Detached, false, false), InlineData(EntityState.Unchanged, true, false), + InlineData(EntityState.Added, true, false), InlineData(EntityState.Modified, true, false), + InlineData(EntityState.Deleted, true, false), InlineData(EntityState.Detached, true, false), + InlineData(EntityState.Unchanged, true, true), InlineData(EntityState.Added, true, true), InlineData(EntityState.Modified, true, true), + InlineData(EntityState.Deleted, true, true), InlineData(EntityState.Detached, true, true)] public virtual void Lazy_load_one_to_one_reference_to_dependent(EntityState state, bool useAttach, bool useDetach) { Parent? parent = null; @@ -705,12 +651,8 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent(EntityState stat } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_principal(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -771,12 +713,8 @@ public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_principal(EntityS } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1004,12 +942,8 @@ public virtual void Non_virtual_collection_is_not_lazy_loaded() Assert.Empty(parent.Children); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1046,12 +980,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK(EntityS Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1089,12 +1019,8 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK(EntitySt Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_many_to_one_reference_to_principal_changed_non_found_FK(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1176,12 +1102,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_changed_non_fou } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_many_to_one_reference_to_principal_changed_found_FK(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1261,12 +1183,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_changed_found_F } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_collection_not_found(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1304,12 +1222,8 @@ public virtual void Lazy_load_collection_not_found(EntityState state) Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_many_to_one_reference_to_principal_not_found(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1347,12 +1261,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_not_found(Entit Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_principal_not_found(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1391,12 +1301,8 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_not_found(Entity Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_dependent_not_found(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1435,22 +1341,14 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_not_found(Entity Assert.Null(parent.Single); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate)] - [InlineData(EntityState.Added, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, CascadeTiming.Never)] - [InlineData(EntityState.Added, CascadeTiming.Never)] - [InlineData(EntityState.Modified, CascadeTiming.Never)] - [InlineData(EntityState.Deleted, CascadeTiming.Never)] - [InlineData(EntityState.Detached, CascadeTiming.Never)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges), InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges), InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate), InlineData(EntityState.Added, CascadeTiming.Immediate), + InlineData(EntityState.Modified, CascadeTiming.Immediate), InlineData(EntityState.Deleted, CascadeTiming.Immediate), + InlineData(EntityState.Detached, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, CascadeTiming.Never), + InlineData(EntityState.Added, CascadeTiming.Never), InlineData(EntityState.Modified, CascadeTiming.Never), + InlineData(EntityState.Deleted, CascadeTiming.Never), InlineData(EntityState.Detached, CascadeTiming.Never)] public virtual void Lazy_load_collection_already_loaded(EntityState state, CascadeTiming cascadeDeleteTiming) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1497,12 +1395,8 @@ public virtual void Lazy_load_collection_already_loaded(EntityState state, Casca Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_collection_already_partially_loaded(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -1547,9 +1441,7 @@ public virtual void Lazy_load_collection_already_partially_loaded(EntityState st Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(QueryTrackingBehavior.NoTracking)] - [InlineData(QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(QueryTrackingBehavior.NoTracking), InlineData(QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_already_partially_loaded_no_tracking(QueryTrackingBehavior queryTrackingBehavior) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -1592,19 +1484,13 @@ public virtual void Lazy_load_collection_already_partially_loaded_no_tracking(Qu Assert.Empty(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate)] - [InlineData(EntityState.Added, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, CascadeTiming.Never)] - [InlineData(EntityState.Added, CascadeTiming.Never)] - [InlineData(EntityState.Modified, CascadeTiming.Never)] - [InlineData(EntityState.Deleted, CascadeTiming.Never)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges), InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges), InlineData(EntityState.Unchanged, CascadeTiming.Immediate), + InlineData(EntityState.Added, CascadeTiming.Immediate), InlineData(EntityState.Modified, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, CascadeTiming.Never), + InlineData(EntityState.Added, CascadeTiming.Never), InlineData(EntityState.Modified, CascadeTiming.Never), + InlineData(EntityState.Deleted, CascadeTiming.Never)] public virtual void Lazy_load_many_to_one_reference_to_principal_already_loaded( EntityState state, CascadeTiming cascadeDeleteTiming) @@ -1654,12 +1540,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_already_loaded( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_principal_already_loaded(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1705,19 +1587,13 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_already_loaded(E } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate)] - [InlineData(EntityState.Added, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, CascadeTiming.Never)] - [InlineData(EntityState.Added, CascadeTiming.Never)] - [InlineData(EntityState.Modified, CascadeTiming.Never)] - [InlineData(EntityState.Deleted, CascadeTiming.Never)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges), InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges), InlineData(EntityState.Unchanged, CascadeTiming.Immediate), + InlineData(EntityState.Added, CascadeTiming.Immediate), InlineData(EntityState.Modified, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, CascadeTiming.Never), + InlineData(EntityState.Added, CascadeTiming.Never), InlineData(EntityState.Modified, CascadeTiming.Never), + InlineData(EntityState.Deleted, CascadeTiming.Never)] public virtual void Lazy_load_one_to_one_reference_to_dependent_already_loaded( EntityState state, CascadeTiming cascadeDeleteTiming) @@ -1777,12 +1653,8 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_already_loaded( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_principal_already_loaded(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1828,12 +1700,8 @@ public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_principal_already } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent_already_loaded(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1879,12 +1747,8 @@ public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent_already } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_many_to_one_reference_to_principal_alternate_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1939,12 +1803,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_alternate_key(E } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_principal_alternate_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -1999,12 +1859,8 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_alternate_key(En } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_dependent_alternate_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2044,12 +1900,8 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_alternate_key(En } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_alternate_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2080,12 +1932,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_alterna Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_alternate_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2117,12 +1965,8 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_alternat Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_collection_shadow_fk(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2152,12 +1996,8 @@ public virtual void Lazy_load_collection_shadow_fk(EntityState state) Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_many_to_one_reference_to_principal_shadow_fk(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2215,12 +2055,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_shadow_fk(Entit } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_principal_shadow_fk(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2278,12 +2114,8 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_shadow_fk(Entity } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_dependent_shadow_fk(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2323,12 +2155,8 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_shadow_fk(Entity } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_shadow_fk(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2360,12 +2188,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_shadow_ Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_shadow_fk(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2398,12 +2222,8 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_shadow_f Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_collection_composite_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2433,12 +2253,8 @@ public virtual void Lazy_load_collection_composite_key(EntityState state) Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_many_to_one_reference_to_principal_composite_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2493,12 +2309,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_composite_key(E } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_principal_composite_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2553,12 +2365,8 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_composite_key(En } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_dependent_composite_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2598,12 +2406,8 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_composite_key(En } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_composite_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2635,12 +2439,8 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_composi Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Added)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] - [InlineData(EntityState.Detached)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Added), InlineData(EntityState.Modified), + InlineData(EntityState.Deleted), InlineData(EntityState.Detached)] public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_composite_key(EntityState state) { using var context = CreateContext(lazyLoadingEnabled: true, tracking: state != EntityState.Detached); @@ -2745,15 +2545,9 @@ public virtual void Lazy_load_reference_to_dependent_for_no_tracking_does_not_th Assert.Null(parent.Single); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false), InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection(EntityState state, bool async) { using var context = CreateContext(tracking: state != EntityState.Detached); @@ -4372,21 +4166,21 @@ public virtual void Lazy_loading_shares_service_property_on_derived_types() Assert.Equal(2, parson.ParsonNoses!.Count); Assert.Equal( - new[] { "Large", "Medium" }, + ["Large", "Medium"], parson.ParsonNoses.Select(b => b.Size).OrderBy(h => h)); var company = context.Set().Single(); Assert.Equal(2, company.CompanyNoses!.Count); Assert.Equal( - new[] { "Large", "Small" }, + ["Large", "Small"], company.CompanyNoses.Select(b => b.Size).OrderBy(h => h)); - var entity = context.Set().ToList().Except(new Entity[] { parson, company }).Single(); + var entity = context.Set().ToList().Except([parson, company]).Single(); Assert.Equal(3, entity.BaseNoses!.Count); Assert.Equal( - new[] { "Large", "Medium", "Small" }, + ["Large", "Medium", "Small"], entity.BaseNoses.Select(b => b.Size).OrderBy(h => h)); } @@ -4437,9 +4231,7 @@ orderby p.Id Assert.NotNull(((dynamic)query!).Single); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Entity_equality_with_proxy_parameter(bool async) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -5055,133 +4847,124 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity() .Property("ParentId"); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId).ValueGeneratedOnAdd(); - - b.HasMany(e => e.Children) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - - b.HasOne(e => e.SinglePkToPk) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.Id) - .IsRequired(); - - b.HasOne(e => e.Single) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - - b.HasMany(e => e.ChildrenAk) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId); - - b.HasOne(e => e.SingleAk) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId); - - b.HasMany(e => e.ChildrenShadowFk) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.Id) - .HasForeignKey("ParentId"); - - b.HasOne(e => e.SingleShadowFk) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.Id) - .HasForeignKey("ParentId"); - - b.HasMany(e => e.ChildrenCompositeKey) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.AlternateId, e.Id }) - .HasForeignKey( - e => new { e.ParentAlternateId, e.ParentId }); - - b.HasOne(e => e.SingleCompositeKey) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.AlternateId, e.Id }) - .HasForeignKey( - e => new { e.ParentAlternateId, e.ParentId }); - - b.HasMany(e => e.ManyChildren).WithMany(e => e.ManyParents); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId).ValueGeneratedOnAdd(); + + b.HasMany(e => e.Children) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + + b.HasOne(e => e.SinglePkToPk) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.Id) + .IsRequired(); + + b.HasOne(e => e.Single) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + + b.HasMany(e => e.ChildrenAk) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId); + + b.HasOne(e => e.SingleAk) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId); + + b.HasMany(e => e.ChildrenShadowFk) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.Id) + .HasForeignKey("ParentId"); + + b.HasOne(e => e.SingleShadowFk) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.Id) + .HasForeignKey("ParentId"); + + b.HasMany(e => e.ChildrenCompositeKey) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.AlternateId, e.Id }) + .HasForeignKey(e => new { e.ParentAlternateId, e.ParentId }); + + b.HasOne(e => e.SingleCompositeKey) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.AlternateId, e.Id }) + .HasForeignKey(e => new { e.ParentAlternateId, e.ParentId }); + + b.HasMany(e => e.ManyChildren).WithMany(e => e.ManyParents); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - e => - { - e.OwnsOne(x => x.Writer); - e.OwnsOne(x => x.Reader); - e.OwnsOne(x => x.Host); - }); - - modelBuilder.Entity
( - builder => - { - builder.HasKey(prop => prop.AddressId); + modelBuilder.Entity(e => + { + e.OwnsOne(x => x.Writer); + e.OwnsOne(x => x.Reader); + e.OwnsOne(x => x.Host); + }); - builder.Property(prop => prop.Line1) - .IsRequired() - .HasMaxLength(50); + modelBuilder.Entity
(builder => + { + builder.HasKey(prop => prop.AddressId); - builder.Property(prop => prop.Line2) - .IsRequired(false) - .HasMaxLength(50); - }); + builder.Property(prop => prop.Line1) + .IsRequired() + .HasMaxLength(50); - modelBuilder.Entity( - builder => - { - builder.HasKey(prop => prop.ApplicantId); + builder.Property(prop => prop.Line2) + .IsRequired(false) + .HasMaxLength(50); + }); - builder.OwnsOne( - prop => prop.Name, name => - { - name - .OwnsOne(prop => prop.FirstName) - .Property("_value") - .HasMaxLength(50) - .IsRequired(); - - name - .OwnsOne(prop => prop.LastName) - .Property("_value") - .HasMaxLength(50) - .IsRequired(); - }); - }); + modelBuilder.Entity(builder => + { + builder.HasKey(prop => prop.ApplicantId); - modelBuilder.Entity( - builder => - { - builder.HasKey(prop => prop.PyrsonId); + builder.OwnsOne( + prop => prop.Name, name => + { + name + .OwnsOne(prop => prop.FirstName) + .Property("_value") + .HasMaxLength(50) + .IsRequired(); + + name + .OwnsOne(prop => prop.LastName) + .Property("_value") + .HasMaxLength(50) + .IsRequired(); + }); + }); + + modelBuilder.Entity(builder => + { + builder.HasKey(prop => prop.PyrsonId); - builder.OwnsOne( - prop => prop.Name, name => - { - name - .OwnsOne(prop => prop.FirstName) - .Property("_value") - .HasMaxLength(50) - .IsRequired(); - - name - .OwnsOne(prop => prop.LastName) - .Property("_value") - .HasMaxLength(50) - .IsRequired(); - }); - - builder.HasOne(prop => prop.Address) - .WithOne() - .HasForeignKey
(prop => prop.PyrsonId); - }); + builder.OwnsOne( + prop => prop.Name, name => + { + name + .OwnsOne(prop => prop.FirstName) + .Property("_value") + .HasMaxLength(50) + .IsRequired(); + + name + .OwnsOne(prop => prop.LastName) + .Property("_value") + .HasMaxLength(50) + .IsRequired(); + }); + + builder.HasOne(prop => prop.Address) + .WithOne() + .HasForeignKey
(prop => prop.PyrsonId); + }); modelBuilder.Entity(); modelBuilder.Entity(); @@ -5197,12 +4980,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity() .OwnsMany(o => o.Addresses, a => a.HasKey("Id")); - modelBuilder.Entity( - b => - { - b.HasOne(e => e.Child).WithOne(e => e.SingleParent).HasPrincipalKey(); - b.HasMany(e => e.Children).WithOne(e => e.CollectionParent); - }); + modelBuilder.Entity(b => + { + b.HasOne(e => e.Child).WithOne(e => e.SingleParent).HasPrincipalKey(); + b.HasMany(e => e.Children).WithOne(e => e.CollectionParent); + }); } protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) @@ -5506,7 +5288,7 @@ protected override Task SeedAsync(DbContext context) new NonVirtualOneToManyOwner { Id = 300, - Addresses = new List { new() { Street = "4 Privet Drive", PostalCode = "SURREY" } }, + Addresses = [new() { Street = "4 Privet Drive", PostalCode = "SURREY" }], Culture = CreateCulture(), Milk = CreateMilk() }); @@ -5515,12 +5297,12 @@ protected override Task SeedAsync(DbContext context) new VirtualOneToManyOwner { Id = 400, - Addresses = new List - { + Addresses = + [ new() { Street = "The Ministry", PostalCode = "MAG1C" }, new() { Street = "Diagon Alley", PostalCode = "WC2H 0AW" }, new() { Street = "Shell Cottage", PostalCode = "THE SEA" } - }, + ], Culture = CreateCulture(), Milk = CreateMilk() }); @@ -5553,15 +5335,15 @@ protected override Task SeedAsync(DbContext context) Culture = CreateCulture(), Milk = CreateMilk() }, - Children = new List - { + Children = + [ new() { Id = 101, Culture = CreateCulture(), Milk = CreateMilk() } - }, + ], Culture = CreateCulture(), Milk = CreateMilk() }); diff --git a/test/EFCore.Specification.Tests/LazyLoadTestBase.cs b/test/EFCore.Specification.Tests/LazyLoadTestBase.cs index 952482988aa..d53710d4cef 100644 --- a/test/EFCore.Specification.Tests/LazyLoadTestBase.cs +++ b/test/EFCore.Specification.Tests/LazyLoadTestBase.cs @@ -9,37 +9,36 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class LoadTestBase { - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_collection(EntityState state, QueryTrackingBehavior queryTrackingBehavior, bool async) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -81,37 +80,36 @@ public virtual async Task Lazy_load_collection(EntityState state, QueryTrackingB } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_many_to_one_reference_to_principal( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -188,37 +186,36 @@ public virtual async Task Lazy_load_many_to_one_reference_to_principal( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_principal( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -295,37 +292,36 @@ public virtual async Task Lazy_load_one_to_one_reference_to_principal( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_dependent( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -387,22 +383,17 @@ public virtual async Task Lazy_load_one_to_one_reference_to_dependent( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_principal(EntityState state, QueryTrackingBehavior queryTrackingBehavior) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -476,22 +467,17 @@ public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_principal(EntityS } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent(EntityState state, QueryTrackingBehavior queryTrackingBehavior) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -547,37 +533,36 @@ public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent(EntityS } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_many_to_one_reference_to_principal_null_FK( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -620,37 +605,36 @@ public virtual async Task Lazy_load_many_to_one_reference_to_principal_null_FK( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_principal_null_FK( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -694,37 +678,36 @@ public virtual async Task Lazy_load_one_to_one_reference_to_principal_null_FK( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_collection_not_found(EntityState state, QueryTrackingBehavior queryTrackingBehavior, bool async) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -768,37 +751,36 @@ public virtual async Task Lazy_load_collection_not_found(EntityState state, Quer } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_many_to_one_reference_to_principal_not_found( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -841,37 +823,36 @@ public virtual async Task Lazy_load_many_to_one_reference_to_principal_not_found } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_principal_not_found( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -915,37 +896,36 @@ public virtual async Task Lazy_load_one_to_one_reference_to_principal_not_found( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_dependent_not_found( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -989,67 +969,66 @@ public virtual async Task Lazy_load_one_to_one_reference_to_dependent_not_found( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_collection_already_loaded( EntityState state, CascadeTiming deleteOrphansTiming, @@ -1097,31 +1076,30 @@ public virtual async Task Lazy_load_collection_already_loaded( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_collection_already_partially_loaded( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -1184,37 +1162,36 @@ public virtual async Task Lazy_load_collection_already_partially_loaded( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_many_to_one_reference_to_principal_already_loaded( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -1267,37 +1244,36 @@ public virtual async Task Lazy_load_many_to_one_reference_to_principal_already_l } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_principal_already_loaded( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -1350,67 +1326,66 @@ public virtual async Task Lazy_load_one_to_one_reference_to_principal_already_lo } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_dependent_already_loaded( EntityState state, CascadeTiming deleteOrphansTiming, @@ -1462,22 +1437,17 @@ public virtual async Task Lazy_load_one_to_one_reference_to_dependent_already_lo } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_principal_already_loaded( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -1521,22 +1491,17 @@ public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_principal_already } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent_already_loaded( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -1580,22 +1545,17 @@ public virtual void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent_already } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_alternate_key( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -1665,22 +1625,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_alternate_key( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_alternate_key( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -1750,22 +1705,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_alternate_key( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_alternate_key( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -1817,22 +1767,17 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_alternate_key( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_alternate_key( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -1868,22 +1813,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_alterna } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_alternate_key( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -1920,22 +1860,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_alternat } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_shadow_fk(EntityState state, QueryTrackingBehavior queryTrackingBehavior) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -1978,22 +1913,17 @@ public virtual void Lazy_load_collection_shadow_fk(EntityState state, QueryTrack } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_shadow_fk( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -2067,22 +1997,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_shadow_fk( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_shadow_fk( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -2156,22 +2081,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_shadow_fk( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_shadow_fk( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -2223,22 +2143,17 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_shadow_fk( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_shadow_fk( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -2293,22 +2208,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_shadow_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_shadow_fk( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -2364,22 +2274,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_shadow_f } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_composite_key(EntityState state, QueryTrackingBehavior queryTrackingBehavior) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -2422,22 +2327,17 @@ public virtual void Lazy_load_collection_composite_key(EntityState state, QueryT } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_composite_key( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -2507,22 +2407,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_composite_key( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_composite_key( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -2592,22 +2487,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_composite_key( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_composite_key( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -2659,22 +2549,17 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_composite_key( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_composite_key( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -2710,22 +2595,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_composi } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_composite_key( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -2762,37 +2642,36 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_composit } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_collection_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -2845,37 +2724,36 @@ public virtual async Task Lazy_load_collection_full_loader_constructor_injection } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_many_to_one_reference_to_principal_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -2952,37 +2830,36 @@ public virtual async Task Lazy_load_many_to_one_reference_to_principal_full_load } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_principal_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -3059,37 +2936,36 @@ public virtual async Task Lazy_load_one_to_one_reference_to_principal_full_loade } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_dependent_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -3151,37 +3027,36 @@ public virtual async Task Lazy_load_one_to_one_reference_to_dependent_full_loade } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_many_to_one_reference_to_principal_null_FK_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -3224,37 +3099,36 @@ public virtual async Task Lazy_load_many_to_one_reference_to_principal_null_FK_f } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_principal_null_FK_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -3298,37 +3172,36 @@ public virtual async Task Lazy_load_one_to_one_reference_to_principal_null_FK_fu } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_collection_not_found_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -3375,37 +3248,36 @@ public virtual async Task Lazy_load_collection_not_found_full_loader_constructor } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_many_to_one_reference_to_principal_not_found_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -3448,37 +3320,36 @@ public virtual async Task Lazy_load_many_to_one_reference_to_principal_not_found } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_principal_not_found_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -3522,37 +3393,36 @@ public virtual async Task Lazy_load_one_to_one_reference_to_principal_not_found_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_dependent_not_found_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -3596,67 +3466,66 @@ public virtual async Task Lazy_load_one_to_one_reference_to_dependent_not_found_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_collection_already_loaded_full_loader_constructor_injection( EntityState state, CascadeTiming deleteOrphansTiming, @@ -3704,37 +3573,36 @@ public virtual async Task Lazy_load_collection_already_loaded_full_loader_constr } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_many_to_one_reference_to_principal_already_loaded_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -3787,37 +3655,36 @@ public virtual async Task Lazy_load_many_to_one_reference_to_principal_already_l } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] public virtual async Task Lazy_load_one_to_one_reference_to_principal_already_loaded_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior, @@ -3870,67 +3737,66 @@ public virtual async Task Lazy_load_one_to_one_reference_to_principal_already_lo } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] public virtual async Task Lazy_load_one_to_one_reference_to_dependent_already_loaded_full_loader_constructor_injection( EntityState state, CascadeTiming deleteOrphansTiming, @@ -3982,19 +3848,15 @@ public virtual async Task Lazy_load_one_to_one_reference_to_dependent_already_lo } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_already_partially_loaded_full_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4064,22 +3926,17 @@ public virtual void Lazy_load_collection_already_partially_loaded_full_loader_co } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4124,22 +3981,17 @@ public virtual void Lazy_load_collection_delegate_loader_constructor_injection( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4208,22 +4060,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_delegate_loader } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4292,22 +4139,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_delegate_loader_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4361,22 +4203,17 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_delegate_loader_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4410,22 +4247,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_delegat Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4460,22 +4292,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_delegate Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_not_found_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4507,22 +4334,17 @@ public virtual void Lazy_load_collection_not_found_delegate_loader_constructor_i Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_not_found_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4556,22 +4378,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_not_found_deleg Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_not_found_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4606,22 +4423,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_not_found_delega Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_not_found_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4656,37 +4468,36 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_not_found_delega Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_already_loaded_delegate_loader_constructor_injection( EntityState state, CascadeTiming deleteOrphansTiming, @@ -4746,22 +4557,17 @@ public virtual void Lazy_load_collection_already_loaded_delegate_loader_construc } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_already_loaded_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4815,22 +4621,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_already_loaded_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_already_loaded_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -4882,37 +4683,36 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_already_loaded_d } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_already_loaded_delegate_loader_constructor_injection( EntityState state, CascadeTiming deleteOrphansTiming, @@ -4963,19 +4763,15 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_already_loaded_d } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_already_partially_loaded_delegate_loader_constructor_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5035,22 +4831,17 @@ public virtual void Lazy_load_collection_already_partially_loaded_delegate_loade } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5102,22 +4893,17 @@ public virtual void Lazy_load_collection_delegate_loader_property_injection( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5193,22 +4979,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_delegate_loader } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5284,22 +5065,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_delegate_loader_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5360,22 +5136,17 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_delegate_loader_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5417,22 +5188,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_delegat } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5475,22 +5241,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_delegate } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_not_found_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5536,22 +5297,17 @@ public virtual void Lazy_load_collection_not_found_delegate_loader_property_inje } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_not_found_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5593,22 +5349,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_not_found_deleg } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_not_found_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5651,22 +5402,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_not_found_delega } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_not_found_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5709,37 +5455,36 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_not_found_delega } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_already_loaded_delegate_loader_property_injection( EntityState state, CascadeTiming deleteOrphansTiming, @@ -5808,22 +5553,17 @@ public virtual void Lazy_load_collection_already_loaded_delegate_loader_property } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_already_loaded_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5875,22 +5615,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_already_loaded_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_already_loaded_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -5942,37 +5677,36 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_already_loaded_d } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_already_loaded_delegate_loader_property_injection( EntityState state, CascadeTiming deleteOrphansTiming, @@ -6023,19 +5757,15 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_already_loaded_d } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_already_partially_loaded_delegate_loader_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6097,22 +5827,17 @@ public virtual void Lazy_load_collection_already_partially_loaded_delegate_loade } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6164,22 +5889,17 @@ public virtual void Lazy_load_collection_delegate_loader_with_state_property_inj } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6255,22 +5975,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_delegate_loader } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6346,22 +6061,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_delegate_loader_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6422,22 +6132,17 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_delegate_loader_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6479,22 +6184,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_null_FK_delegat } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6537,22 +6237,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_null_FK_delegate } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_not_found_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6598,22 +6293,17 @@ public virtual void Lazy_load_collection_not_found_delegate_loader_with_state_pr } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_not_found_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6655,22 +6345,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_not_found_deleg } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_not_found_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6713,22 +6398,17 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_not_found_delega } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_not_found_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6771,37 +6451,36 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_not_found_delega } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_already_loaded_delegate_loader_with_state_property_injection( EntityState state, CascadeTiming deleteOrphansTiming, @@ -6848,22 +6527,17 @@ public virtual void Lazy_load_collection_already_loaded_delegate_loader_with_sta } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_many_to_one_reference_to_principal_already_loaded_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6915,22 +6589,17 @@ public virtual void Lazy_load_many_to_one_reference_to_principal_already_loaded_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_principal_already_loaded_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) @@ -6982,37 +6651,36 @@ public virtual void Lazy_load_one_to_one_reference_to_principal_already_loaded_d } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.Immediate, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Unchanged, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Deleted, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, CascadeTiming.OnSaveChanges, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_one_to_one_reference_to_dependent_already_loaded_delegate_loader_with_state_property_injection( EntityState state, CascadeTiming deleteOrphansTiming, @@ -7063,19 +6731,15 @@ public virtual void Lazy_load_one_to_one_reference_to_dependent_already_loaded_d } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll), InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking), InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Lazy_load_collection_already_partially_loaded_delegate_loader_with_state_property_injection( EntityState state, QueryTrackingBehavior queryTrackingBehavior) diff --git a/test/EFCore.Specification.Tests/LoadTestBase.cs b/test/EFCore.Specification.Tests/LoadTestBase.cs index 109dd169a2a..7a417993ce3 100644 --- a/test/EFCore.Specification.Tests/LoadTestBase.cs +++ b/test/EFCore.Specification.Tests/LoadTestBase.cs @@ -15,13 +15,9 @@ public abstract partial class LoadTestBase(TFixture fixture) : IClassF { protected TFixture Fixture { get; } = fixture; - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Added, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false), InlineData(EntityState.Modified, false), + InlineData(EntityState.Added, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, true), + InlineData(EntityState.Added, true)] public virtual void Attached_references_to_principal_are_marked_as_loaded(EntityState state, bool lazy) { using var context = CreateContext(lazy); @@ -60,13 +56,9 @@ public virtual void Attached_references_to_principal_are_marked_as_loaded(Entity Assert.True(context.Entry(parent).Reference(e => e.SingleCompositeKey).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Added, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false), InlineData(EntityState.Modified, false), + InlineData(EntityState.Added, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, true), + InlineData(EntityState.Added, true)] public virtual void Attached_references_to_dependents_are_marked_as_loaded(EntityState state, bool lazy) { using var context = CreateContext(lazy); @@ -107,13 +99,9 @@ public virtual void Attached_references_to_dependents_are_marked_as_loaded(Entit Assert.True(context.Entry(parent.SingleCompositeKey).Reference(e => e.Parent).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Added, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false), InlineData(EntityState.Modified, false), + InlineData(EntityState.Added, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, true), + InlineData(EntityState.Added, true)] public virtual void Attached_collections_are_not_marked_as_loaded(EntityState state, bool lazy) { using var context = CreateContext(lazy); @@ -152,37 +140,36 @@ public virtual void Attached_collections_are_not_marked_as_loaded(EntityState st Assert.False(context.Entry(parent).Collection(e => e.ChildrenCompositeKey).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] public virtual async Task Load_collection(EntityState state, QueryTrackingBehavior queryTrackingBehavior, bool async) { using var context = CreateContext(); @@ -218,17 +205,10 @@ public virtual async Task Load_collection(EntityState state, QueryTrackingBehavi Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal(EntityState state, bool async) { using var context = CreateContext(); @@ -279,17 +259,10 @@ public virtual async Task Load_many_to_one_reference_to_principal(EntityState st } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal(EntityState state, bool async) { using var context = CreateContext(); @@ -340,17 +313,10 @@ public virtual async Task Load_one_to_one_reference_to_principal(EntityState sta } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_when_NoTracking_behavior(EntityState state, bool async) { using var context = CreateContext(); @@ -403,17 +369,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_when_NoTracking } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent(EntityState state, bool async) { using var context = CreateContext(); @@ -453,17 +412,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent(EntityState sta } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal(EntityState state, bool async) { using var context = CreateContext(); @@ -509,17 +461,10 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal(Entity } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent(EntityState state, bool async) { using var context = CreateContext(); @@ -557,17 +502,10 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent(Entity } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -606,17 +544,10 @@ public virtual async Task Load_collection_using_Query(EntityState state, bool as } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -657,17 +588,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query(En } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -708,17 +632,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query(Ent } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -751,17 +668,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query(Ent } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -802,17 +712,10 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_using_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_using_Query(EntityState state, bool async) { using var context = CreateContext(); @@ -845,17 +748,10 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_using_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_null_FK(EntityState state, bool async) { using var context = CreateContext(); @@ -886,17 +782,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_null_FK(Entity Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_null_FK(EntityState state, bool async) { using var context = CreateContext(); @@ -928,17 +817,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_null_FK(EntityS Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_null_FK(EntityState state, bool async) { using var context = CreateContext(); @@ -966,17 +848,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_nu Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_null_FK(EntityState state, bool async) { using var context = CreateContext(); @@ -1004,17 +879,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_nul Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1045,17 +913,10 @@ public virtual async Task Load_collection_not_found(EntityState state, bool asyn Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1086,17 +947,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_not_found(Enti Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1128,17 +982,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_not_found(Entit Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1170,17 +1017,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_not_found(Entit Assert.Null(parent.Single); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1208,17 +1048,10 @@ public virtual async Task Load_collection_using_Query_not_found(EntityState stat Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1246,17 +1079,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_no Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1284,17 +1110,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_not Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_not_found(EntityState state, bool async) { using var context = CreateContext(); @@ -1322,23 +1141,18 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_not Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_already_loaded(EntityState state, bool async, CascadeTiming deleteOrphansTiming) { using var context = CreateContext(); @@ -1378,17 +1192,10 @@ public virtual async Task Load_collection_already_loaded(EntityState state, bool Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1427,23 +1234,18 @@ public virtual async Task Load_many_to_one_reference_to_principal_already_loaded } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_one_to_one_reference_to_principal_already_loaded( EntityState state, bool async, @@ -1487,23 +1289,18 @@ public virtual async Task Load_one_to_one_reference_to_principal_already_loaded( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_one_to_one_reference_to_dependent_already_loaded( EntityState state, bool async, @@ -1547,17 +1344,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_already_loaded( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1596,17 +1386,10 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_alread } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1645,23 +1428,18 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_alread } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_using_Query_already_loaded( EntityState state, bool async, @@ -1711,17 +1489,10 @@ public virtual async Task Load_collection_using_Query_already_loaded( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1758,17 +1529,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_al } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1805,23 +1569,18 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_alr Assert.Equal(state == EntityState.Detached ? 0 : 2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_already_loaded( EntityState state, bool async, @@ -1861,17 +1620,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_alr } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_using_Query_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1905,17 +1657,10 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_principal_using_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_using_Query_already_loaded(EntityState state, bool async) { using var context = CreateContext(); @@ -1949,15 +1694,9 @@ public virtual async Task Load_one_to_one_PK_to_PK_reference_to_dependent_using_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -1990,17 +1729,10 @@ public virtual async Task Load_collection_untyped(EntityState state, bool async) Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2051,17 +1783,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_untyped(Entity } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2107,17 +1832,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_untyped(EntityS } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2155,17 +1873,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_untyped(EntityS } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2205,17 +1916,10 @@ public virtual async Task Load_collection_using_Query_untyped(EntityState state, } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2257,17 +1961,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_un } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2309,17 +2006,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_unt } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2353,17 +2043,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_unt } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2394,17 +2077,10 @@ public virtual async Task Load_collection_not_found_untyped(EntityState state, b Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2435,17 +2111,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_not_found_unty Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2477,17 +2146,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_not_found_untyp Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2519,17 +2181,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_not_found_untyp Assert.Null(parent.Single); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2558,17 +2213,10 @@ public virtual async Task Load_collection_using_Query_not_found_untyped(EntitySt Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2597,17 +2245,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_no Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2636,17 +2277,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_not Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_not_found_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2675,23 +2309,18 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_not Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_already_loaded_untyped(EntityState state, bool async, CascadeTiming deleteOrphansTiming) { using var context = CreateContext(); @@ -2731,17 +2360,10 @@ public virtual async Task Load_collection_already_loaded_untyped(EntityState sta Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_already_loaded_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2780,17 +2402,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_already_loaded } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_already_loaded_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -2829,23 +2444,18 @@ public virtual async Task Load_one_to_one_reference_to_principal_already_loaded_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_one_to_one_reference_to_dependent_already_loaded_untyped( EntityState state, bool async, @@ -2889,23 +2499,18 @@ public virtual async Task Load_one_to_one_reference_to_dependent_already_loaded_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_using_Query_already_loaded_untyped( EntityState state, bool async, @@ -2956,17 +2561,10 @@ public virtual async Task Load_collection_using_Query_already_loaded_untyped( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_already_loaded_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -3004,17 +2602,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_al } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_already_loaded_untyped(EntityState state, bool async) { using var context = CreateContext(); @@ -3052,23 +2643,18 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_alr Assert.Equal(state == EntityState.Detached ? 0 : 2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_already_loaded_untyped( EntityState state, bool async, @@ -3114,17 +2700,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_alr } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3157,17 +2736,10 @@ public virtual async Task Load_collection_alternate_key(EntityState state, bool Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3213,17 +2785,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_alternate_key( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3269,17 +2834,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_alternate_key(E } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3317,17 +2875,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_alternate_key(E } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3366,17 +2917,10 @@ public virtual async Task Load_collection_using_Query_alternate_key(EntityState } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3417,17 +2961,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_al } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3468,17 +3005,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_alt } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3511,17 +3041,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_alt } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_null_FK_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3552,17 +3075,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_null_FK_altern Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_null_FK_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3594,17 +3110,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_null_FK_alterna Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_null_FK_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3632,17 +3141,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_nu Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_null_FK_alternate_key(EntityState state, bool async) { using var context = CreateContext(); @@ -3670,17 +3172,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_nul Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3713,17 +3208,10 @@ public virtual async Task Load_collection_shadow_fk(EntityState state, bool asyn Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3784,17 +3272,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_shadow_fk(Enti } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3812,18 +3293,17 @@ public virtual async Task Load_one_to_one_reference_to_principal_shadow_fk(Entit { Assert.Equal( CoreStrings.CannotLoadDetachedShadow("Parent", "SingleShadowFk"), - (await Assert.ThrowsAsync( - async () => + (await Assert.ThrowsAsync(async () => + { + if (async) + { + await referenceEntry.LoadAsync(); + } + else { - if (async) - { - await referenceEntry.LoadAsync(); - } - else - { - referenceEntry.Load(); - } - })).Message); + referenceEntry.Load(); + } + })).Message); } else { @@ -3857,17 +3337,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_shadow_fk(Entit } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3905,17 +3378,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_shadow_fk(Entit } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3954,17 +3420,10 @@ public virtual async Task Load_collection_using_Query_shadow_fk(EntityState stat } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -3982,13 +3441,12 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_sh { Assert.Equal( CoreStrings.CannotLoadDetachedShadow("Parent", "ChildShadowFk"), - (await Assert.ThrowsAsync( - async () => - { - _ = async - ? await referenceEntry.Query().SingleOrDefaultAsync() - : referenceEntry.Query().SingleOrDefault(); - })).Message); + (await Assert.ThrowsAsync(async () => + { + _ = async + ? await referenceEntry.Query().SingleOrDefaultAsync() + : referenceEntry.Query().SingleOrDefault(); + })).Message); } else { @@ -4017,17 +3475,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_sh } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -4045,13 +3496,12 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_sha { Assert.Equal( CoreStrings.CannotLoadDetachedShadow("Parent", "SingleShadowFk"), - (await Assert.ThrowsAsync( - async () => - { - _ = async - ? await referenceEntry.Query().SingleAsync() - : referenceEntry.Query().Single(); - })).Message); + (await Assert.ThrowsAsync(async () => + { + _ = async + ? await referenceEntry.Query().SingleAsync() + : referenceEntry.Query().Single(); + })).Message); } else { @@ -4080,17 +3530,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_sha } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -4123,17 +3566,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_sha } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_null_FK_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -4183,17 +3619,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_null_FK_shadow } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_null_FK_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -4212,18 +3641,17 @@ public virtual async Task Load_one_to_one_reference_to_principal_null_FK_shadow_ { Assert.Equal( CoreStrings.CannotLoadDetachedShadow("Parent", "SingleShadowFk"), - (await Assert.ThrowsAsync( - async () => + (await Assert.ThrowsAsync(async () => + { + if (async) + { + await referenceEntry.LoadAsync(); + } + else { - if (async) - { - await referenceEntry.LoadAsync(); - } - else - { - referenceEntry.Load(); - } - })).Message); + referenceEntry.Load(); + } + })).Message); } else { @@ -4246,17 +3674,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_null_FK_shadow_ } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_null_FK_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -4275,13 +3696,12 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_nu { Assert.Equal( CoreStrings.CannotLoadDetachedShadow("Parent", "ChildShadowFk"), - (await Assert.ThrowsAsync( - async () => - { - _ = async - ? await referenceEntry.Query().SingleOrDefaultAsync() - : referenceEntry.Query().SingleOrDefault(); - })).Message); + (await Assert.ThrowsAsync(async () => + { + _ = async + ? await referenceEntry.Query().SingleOrDefaultAsync() + : referenceEntry.Query().SingleOrDefault(); + })).Message); } else { @@ -4300,17 +3720,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_nu } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_null_FK_shadow_fk(EntityState state, bool async) { using var context = CreateContext(); @@ -4329,13 +3742,12 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_nul { Assert.Equal( CoreStrings.CannotLoadDetachedShadow("Parent", "SingleShadowFk"), - (await Assert.ThrowsAsync( - async () => - { - _ = async - ? await referenceEntry.Query().SingleOrDefaultAsync() - : referenceEntry.Query().SingleOrDefault(); - })).Message); + (await Assert.ThrowsAsync(async () => + { + _ = async + ? await referenceEntry.Query().SingleOrDefaultAsync() + : referenceEntry.Query().SingleOrDefault(); + })).Message); } else { @@ -4354,17 +3766,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_nul } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4397,17 +3802,10 @@ public virtual async Task Load_collection_composite_key(EntityState state, bool Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4453,17 +3851,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_composite_key( } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4509,17 +3900,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_composite_key(E } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4557,17 +3941,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_composite_key(E } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4606,17 +3983,10 @@ public virtual async Task Load_collection_using_Query_composite_key(EntityState } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4657,17 +4027,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_co } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4708,17 +4071,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_using_Query_com } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4751,17 +4107,10 @@ public virtual async Task Load_one_to_one_reference_to_dependent_using_Query_com } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_null_FK_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4792,17 +4141,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_null_FK_compos Assert.Null(child.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_null_FK_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4834,17 +4176,10 @@ public virtual async Task Load_one_to_one_reference_to_principal_null_FK_composi Assert.Null(single.Parent); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_many_to_one_reference_to_principal_using_Query_null_FK_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4872,17 +4207,10 @@ public virtual async Task Load_many_to_one_reference_to_principal_using_Query_nu Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_one_to_one_reference_to_principal_using_Query_null_FK_composite_key(EntityState state, bool async) { using var context = CreateContext(); @@ -4975,7 +4303,7 @@ public virtual void Can_change_IsLoaded_flag_for_reference_only_if_null() Assert.True(referenceEntry.IsLoaded); Assert.Equal( - CoreStrings.ReferenceMustBeLoaded("Parent", typeof(Child).Name), + CoreStrings.ReferenceMustBeLoaded("Parent", nameof(Child)), Assert.Throws(() => referenceEntry.IsLoaded = false).Message); } @@ -5035,11 +4363,7 @@ public virtual void Setting_navigation_to_null_is_detected_by_local_DetectChange Assert.Equal(EntityState.Deleted, childEntry.State); } - [ConditionalTheory] // Issue #35528 - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(true, false), InlineData(false, true), InlineData(true, true)] // Issue #35528 public virtual async Task Lazy_loading_is_thread_safe(bool noTracking, bool async) { using var context = CreateContext(lazyLoadingEnabled: true); @@ -5087,52 +4411,55 @@ public virtual async Task Lazy_loading_is_thread_safe(bool noTracking, bool asyn var parent2 = query2.Single(); - var parallelOptions = new ParallelOptions - { - MaxDegreeOfParallelism = Environment.ProcessorCount * 500 - }; + var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount * 500 }; - await Parallel.ForAsync(0, 10000, parallelOptions, async (i, ct) => - { - await Task.WhenAll( - AssertEqual( - (children, async () => (await parent2.LazyLoadChildren(async))?.Select(x => x.Id).OrderBy(x => x).ToList()), - (childrenInvert, async () => (await parent2.LazyLoadChildren(!async))?.Select(x => x.Id).OrderBy(x => x).ToList()) - ), - AssertEqual( - (singlePkToPk, async () => (await parent2.LazyLoadSinglePkToPk(async))?.Id), - (singlePkToPkInvert, async () => (await parent2.LazyLoadSinglePkToPk(!async))?.Id) - ), - AssertEqual( - (single, async () => (await parent2.LazyLoadSingle(async))?.Id), - (singleInvert, async () => (await parent2.LazyLoadSingle(!async))?.Id) - ), - AssertEqual( - (childrenAk, async () => (await parent2.LazyLoadChildrenAk(async))?.Select(x => x.Id).OrderBy(x => x).ToList()), - (childrenAkInvert, async () => (await parent2.LazyLoadChildrenAk(!async))?.Select(x => x.Id).OrderBy(x => x).ToList()) - ), - AssertEqual( - (singleAk, async () => (await parent2.LazyLoadSingleAk(async))?.Id), - (singleAkInvert, async () => (await parent2.LazyLoadSingleAk(!async))?.Id) - ), - AssertEqual( - (childrenShadowFk, async () => (await parent2.LazyLoadChildrenShadowFk(async))?.Select(x => x.Id).OrderBy(x => x).ToList()), - (childrenShadowFkInvert, async () => (await parent2.LazyLoadChildrenShadowFk(!async))?.Select(x => x.Id).OrderBy(x => x).ToList()) - ), - AssertEqual( - (singleShadowFk, async () => (await parent2.LazyLoadSingleShadowFk(async))?.Id), - (singleShadowFkInvert, async () => (await parent2.LazyLoadSingleShadowFk(!async))?.Id) - ), - AssertEqual( - (childrenCompositeKey, async () => (await parent2.LazyLoadChildrenCompositeKey(async))?.Select(x => x.Id).OrderBy(x => x).ToList()), - (childrenCompositeKeyInvert, async () => (await parent2.LazyLoadChildrenCompositeKey(!async))?.Select(x => x.Id).OrderBy(x => x).ToList()) - ), - AssertEqual( - (singleCompositeKey, async () => (await parent2.LazyLoadSingleCompositeKey(async))?.Id), - (singleCompositeKeyInvert, async () => (await parent2.LazyLoadSingleCompositeKey(!async))?.Id) - ) - ); - }); + await Parallel.ForAsync( + 0, 10000, parallelOptions, async (i, ct) => + { + await Task.WhenAll( + AssertEqual( + (children, async () => (await parent2.LazyLoadChildren(async))?.Select(x => x.Id).OrderBy(x => x).ToList()), + (childrenInvert, async () => (await parent2.LazyLoadChildren(!async))?.Select(x => x.Id).OrderBy(x => x).ToList()) + ), + AssertEqual( + (singlePkToPk, async () => (await parent2.LazyLoadSinglePkToPk(async))?.Id), + (singlePkToPkInvert, async () => (await parent2.LazyLoadSinglePkToPk(!async))?.Id) + ), + AssertEqual( + (single, async () => (await parent2.LazyLoadSingle(async))?.Id), + (singleInvert, async () => (await parent2.LazyLoadSingle(!async))?.Id) + ), + AssertEqual( + (childrenAk, async () => (await parent2.LazyLoadChildrenAk(async))?.Select(x => x.Id).OrderBy(x => x).ToList()), + (childrenAkInvert, + async () => (await parent2.LazyLoadChildrenAk(!async))?.Select(x => x.Id).OrderBy(x => x).ToList()) + ), + AssertEqual( + (singleAk, async () => (await parent2.LazyLoadSingleAk(async))?.Id), + (singleAkInvert, async () => (await parent2.LazyLoadSingleAk(!async))?.Id) + ), + AssertEqual( + (childrenShadowFk, + async () => (await parent2.LazyLoadChildrenShadowFk(async))?.Select(x => x.Id).OrderBy(x => x).ToList()), + (childrenShadowFkInvert, + async () => (await parent2.LazyLoadChildrenShadowFk(!async))?.Select(x => x.Id).OrderBy(x => x).ToList()) + ), + AssertEqual( + (singleShadowFk, async () => (await parent2.LazyLoadSingleShadowFk(async))?.Id), + (singleShadowFkInvert, async () => (await parent2.LazyLoadSingleShadowFk(!async))?.Id) + ), + AssertEqual( + (childrenCompositeKey, + async () => (await parent2.LazyLoadChildrenCompositeKey(async))?.Select(x => x.Id).OrderBy(x => x).ToList()), + (childrenCompositeKeyInvert, + async () => (await parent2.LazyLoadChildrenCompositeKey(!async))?.Select(x => x.Id).OrderBy(x => x).ToList()) + ), + AssertEqual( + (singleCompositeKey, async () => (await parent2.LazyLoadSingleCompositeKey(async))?.Id), + (singleCompositeKeyInvert, async () => (await parent2.LazyLoadSingleCompositeKey(!async))?.Id) + ) + ); + }); static async Task AssertEqual((T Data, Func> Expected) data, (T Data, Func> Expected) dataInvert) { @@ -5266,10 +4593,10 @@ public async Task LazyLoadSingleAk(bool async) await Loader.LoadAsync(this, default, nameof(SingleAk)); return _singleAk; } - + return SingleAk; } - + public IEnumerable ChildrenShadowFk { get => Loader.Load(this, ref _childrenShadowFk); @@ -6077,142 +5404,131 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity() .Property("ParentId"); - modelBuilder.Entity( - b => - { - b.Property(e => e.AlternateId).ValueGeneratedOnAdd(); - - b.HasMany(nameof(Parent.Children)) - .WithOne(nameof(Child.Parent)) - .HasForeignKey(e => e.ParentId); - - b.HasOne(nameof(Parent.SinglePkToPk)) - .WithOne(nameof(SinglePkToPk.Parent)) - .HasForeignKey(e => e.Id) - .IsRequired(); - - b.HasOne(nameof(Parent.Single)) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - - b.HasOne(nameof(Parent.RequiredSingle)) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - - b.HasMany(nameof(Parent.ChildrenAk)) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId); - - b.HasOne(nameof(Parent.SingleAk)) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.AlternateId) - .HasForeignKey(e => e.ParentId); - - b.HasMany(e => e.ChildrenShadowFk) - .WithOne(nameof(ChildShadowFk.Parent)) - .HasPrincipalKey(e => e.Id) - .HasForeignKey("ParentId"); - - b.HasOne(nameof(Parent.SingleShadowFk)) - .WithOne(e => e.Parent) - .HasPrincipalKey(e => e.Id) - .HasForeignKey("ParentId"); - - b.HasMany(e => e.ChildrenCompositeKey) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.AlternateId, e.Id }) - .HasForeignKey( - e => new { e.ParentAlternateId, e.ParentId }); - - b.HasOne(nameof(Parent.SingleCompositeKey)) - .WithOne(e => e.Parent) - .HasPrincipalKey( - e => new { e.AlternateId, e.Id }) - .HasForeignKey( - e => new { e.ParentAlternateId, e.ParentId }); - }); - - modelBuilder.Entity( - b => - { - b.HasMany(nameof(ParentFullLoaderByConstructor.Children)) - .WithOne(nameof(ChildFullLoaderByConstructor.Parent)) - .HasForeignKey(e => e.ParentId); - - b.HasOne(nameof(ParentFullLoaderByConstructor.Single)) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.AlternateId).ValueGeneratedOnAdd(); + + b.HasMany(nameof(Parent.Children)) + .WithOne(nameof(Child.Parent)) + .HasForeignKey(e => e.ParentId); + + b.HasOne(nameof(Parent.SinglePkToPk)) + .WithOne(nameof(SinglePkToPk.Parent)) + .HasForeignKey(e => e.Id) + .IsRequired(); + + b.HasOne(nameof(Parent.Single)) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + + b.HasOne(nameof(Parent.RequiredSingle)) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + + b.HasMany(nameof(Parent.ChildrenAk)) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId); + + b.HasOne(nameof(Parent.SingleAk)) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.AlternateId) + .HasForeignKey(e => e.ParentId); + + b.HasMany(e => e.ChildrenShadowFk) + .WithOne(nameof(ChildShadowFk.Parent)) + .HasPrincipalKey(e => e.Id) + .HasForeignKey("ParentId"); + + b.HasOne(nameof(Parent.SingleShadowFk)) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => e.Id) + .HasForeignKey("ParentId"); + + b.HasMany(e => e.ChildrenCompositeKey) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.AlternateId, e.Id }) + .HasForeignKey(e => new { e.ParentAlternateId, e.ParentId }); + + b.HasOne(nameof(Parent.SingleCompositeKey)) + .WithOne(e => e.Parent) + .HasPrincipalKey(e => new { e.AlternateId, e.Id }) + .HasForeignKey(e => new { e.ParentAlternateId, e.ParentId }); + }); + + modelBuilder.Entity(b => + { + b.HasMany(nameof(ParentFullLoaderByConstructor.Children)) + .WithOne(nameof(ChildFullLoaderByConstructor.Parent)) + .HasForeignKey(e => e.ParentId); - modelBuilder.Entity( - b => - { - b.HasMany(nameof(ParentDelegateLoaderByConstructor.Children)) - .WithOne(nameof(ChildDelegateLoaderByConstructor.Parent)) - .HasForeignKey(e => e.ParentId); + b.HasOne(nameof(ParentFullLoaderByConstructor.Single)) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + }); - b.HasOne(nameof(ParentDelegateLoaderByConstructor.Single)) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - }); + modelBuilder.Entity(b => + { + b.HasMany(nameof(ParentDelegateLoaderByConstructor.Children)) + .WithOne(nameof(ChildDelegateLoaderByConstructor.Parent)) + .HasForeignKey(e => e.ParentId); - modelBuilder.Entity( - b => - { - b.HasMany(nameof(ParentDelegateLoaderByProperty.Children)) - .WithOne(nameof(ChildDelegateLoaderByProperty.Parent)) - .HasForeignKey(e => e.ParentId); + b.HasOne(nameof(ParentDelegateLoaderByConstructor.Single)) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + }); - b.HasOne(nameof(ParentDelegateLoaderByProperty.Single)) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - }); - - modelBuilder.Entity( - b => - { - var serviceProperty = (ServiceProperty)b.Metadata.AddServiceProperty( - typeof(ChildDelegateLoaderWithStateByProperty).GetAnyProperty("LazyLoaderState")!, - typeof(ILazyLoader)); + modelBuilder.Entity(b => + { + b.HasMany(nameof(ParentDelegateLoaderByProperty.Children)) + .WithOne(nameof(ChildDelegateLoaderByProperty.Parent)) + .HasForeignKey(e => e.ParentId); - serviceProperty.SetParameterBinding( - new DependencyInjectionParameterBinding(typeof(object), typeof(ILazyLoader), serviceProperty), - ConfigurationSource.Explicit); - }); + b.HasOne(nameof(ParentDelegateLoaderByProperty.Single)) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + }); - modelBuilder.Entity( - b => - { - var serviceProperty = (ServiceProperty)b.Metadata.AddServiceProperty( - typeof(SingleDelegateLoaderWithStateByProperty).GetAnyProperty("LazyLoaderState")!, - typeof(ILazyLoader)); - - serviceProperty.SetParameterBinding( - new DependencyInjectionParameterBinding(typeof(object), typeof(ILazyLoader), serviceProperty), - ConfigurationSource.Explicit); - }); + modelBuilder.Entity(b => + { + var serviceProperty = (ServiceProperty)b.Metadata.AddServiceProperty( + typeof(ChildDelegateLoaderWithStateByProperty).GetAnyProperty("LazyLoaderState")!, + typeof(ILazyLoader)); - modelBuilder.Entity( - b => - { - var serviceProperty = (ServiceProperty)b.Metadata.AddServiceProperty( - typeof(ParentDelegateLoaderWithStateByProperty).GetAnyProperty("LazyLoaderState")!, - typeof(ILazyLoader)); + serviceProperty.SetParameterBinding( + new DependencyInjectionParameterBinding(typeof(object), typeof(ILazyLoader), serviceProperty), + ConfigurationSource.Explicit); + }); - serviceProperty.SetParameterBinding( - new DependencyInjectionParameterBinding(typeof(object), typeof(ILazyLoader), serviceProperty), - ConfigurationSource.Explicit); + modelBuilder.Entity(b => + { + var serviceProperty = (ServiceProperty)b.Metadata.AddServiceProperty( + typeof(SingleDelegateLoaderWithStateByProperty).GetAnyProperty("LazyLoaderState")!, + typeof(ILazyLoader)); - b.HasMany(nameof(ParentDelegateLoaderWithStateByProperty.Children)) - .WithOne(nameof(ChildDelegateLoaderWithStateByProperty.Parent)) - .HasForeignKey(e => e.ParentId); + serviceProperty.SetParameterBinding( + new DependencyInjectionParameterBinding(typeof(object), typeof(ILazyLoader), serviceProperty), + ConfigurationSource.Explicit); + }); - b.HasOne(nameof(ParentDelegateLoaderWithStateByProperty.Single)) - .WithOne(e => e.Parent) - .HasForeignKey(e => e.ParentId); - }); + modelBuilder.Entity(b => + { + var serviceProperty = (ServiceProperty)b.Metadata.AddServiceProperty( + typeof(ParentDelegateLoaderWithStateByProperty).GetAnyProperty("LazyLoaderState")!, + typeof(ILazyLoader)); + + serviceProperty.SetParameterBinding( + new DependencyInjectionParameterBinding(typeof(object), typeof(ILazyLoader), serviceProperty), + ConfigurationSource.Explicit); + + b.HasMany(nameof(ParentDelegateLoaderWithStateByProperty.Children)) + .WithOne(nameof(ChildDelegateLoaderWithStateByProperty.Parent)) + .HasForeignKey(e => e.ParentId); + + b.HasOne(nameof(ParentDelegateLoaderWithStateByProperty.Single)) + .WithOne(e => e.Parent) + .HasForeignKey(e => e.ParentId); + }); modelBuilder.Entity(); modelBuilder.Entity(); diff --git a/test/EFCore.Specification.Tests/LoggingTestBase.cs b/test/EFCore.Specification.Tests/LoggingTestBase.cs index 56aed273d7c..77f1841f2a7 100644 --- a/test/EFCore.Specification.Tests/LoggingTestBase.cs +++ b/test/EFCore.Specification.Tests/LoggingTestBase.cs @@ -45,8 +45,7 @@ public virtual void InvalidIncludePathError_throws_by_default() CoreResources.LogInvalidIncludePath(CreateTestLogger()) .GenerateMessage("Wheels", "Wheels"), "CoreEventId.InvalidIncludePathError"), - Assert.Throws( - () => context.Set().Include("Wheels").Load()).Message); + Assert.Throws(() => context.Set().Include("Wheels").Load()).Message); } protected class InvalidIncludePathErrorContext(DbContextOptionsBuilder optionsBuilder) : DbContext(optionsBuilder.Options) diff --git a/test/EFCore.Specification.Tests/ManyToManyFieldsLoadTestBase.cs b/test/EFCore.Specification.Tests/ManyToManyFieldsLoadTestBase.cs index c085ea17a1f..7ac1be206d7 100644 --- a/test/EFCore.Specification.Tests/ManyToManyFieldsLoadTestBase.cs +++ b/test/EFCore.Specification.Tests/ManyToManyFieldsLoadTestBase.cs @@ -10,25 +10,24 @@ namespace Microsoft.EntityFrameworkCore; public abstract class ManyToManyFieldsLoadTestBase(TFixture fixture) : IClassFixture where TFixture : ManyToManyFieldsLoadTestBase.ManyToManyFieldsLoadFixtureBase { - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] public virtual async Task Load_collection(EntityState state, QueryTrackingBehavior queryTrackingBehavior, bool async) { using var context = Fixture.CreateContext(); @@ -71,13 +70,9 @@ public virtual async Task Load_collection(EntityState state, QueryTrackingBehavi Assert.Equal(1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -115,10 +110,7 @@ public virtual async Task Load_collection_using_Query(EntityState state, bool as Assert.Equal(1 + 3 + 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged)] - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Added)] + [ConditionalTheory, InlineData(EntityState.Unchanged), InlineData(EntityState.Modified), InlineData(EntityState.Added)] public virtual void Attached_collections_are_not_marked_as_loaded(EntityState state) { using var context = Fixture.CreateContext(); @@ -163,13 +155,9 @@ public virtual void Attached_collections_are_not_marked_as_loaded(EntityState st Assert.False(context.Entry(left).Collection(e => e.ThreeSkipPayloadFullShared).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_already_loaded(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -210,13 +198,9 @@ public virtual async Task Load_collection_already_loaded(EntityState state, bool Assert.Equal(1 + 4 + 4, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_already_loaded(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -254,13 +238,9 @@ public virtual async Task Load_collection_using_Query_already_loaded(EntityState Assert.Equal(1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_untyped(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -301,13 +281,9 @@ public virtual async Task Load_collection_untyped(EntityState state, bool async) Assert.Equal(1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_untyped(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -345,13 +321,9 @@ public virtual async Task Load_collection_using_Query_untyped(EntityState state, Assert.Equal(1 + 3 + 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_not_found_untyped(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -383,13 +355,9 @@ public virtual async Task Load_collection_not_found_untyped(EntityState state, b Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_not_found_untyped(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -418,19 +386,15 @@ public virtual async Task Load_collection_using_Query_not_found_untyped(EntitySt Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_already_loaded_untyped(EntityState state, bool async, CascadeTiming deleteOrphansTiming) { using var context = Fixture.CreateContext(); @@ -473,19 +437,15 @@ public virtual async Task Load_collection_already_loaded_untyped(EntityState sta Assert.Equal(1 + 4 + 4, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_using_Query_already_loaded_untyped( EntityState state, bool async, @@ -529,13 +489,9 @@ public virtual async Task Load_collection_using_Query_already_loaded_untyped( Assert.Equal(1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_composite_key(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -576,13 +532,9 @@ public virtual async Task Load_collection_composite_key(EntityState state, bool Assert.Equal(1 + 2 + 2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_composite_key(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -620,13 +572,9 @@ public virtual async Task Load_collection_using_Query_composite_key(EntityState Assert.Equal(1 + 2 + 2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true, QueryTrackingBehavior.NoTracking)] - [InlineData(true, QueryTrackingBehavior.TrackAll)] - [InlineData(true, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(false, QueryTrackingBehavior.NoTracking)] - [InlineData(false, QueryTrackingBehavior.TrackAll)] - [InlineData(false, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(true, QueryTrackingBehavior.NoTracking), InlineData(true, QueryTrackingBehavior.TrackAll), + InlineData(true, QueryTrackingBehavior.NoTrackingWithIdentityResolution), InlineData(false, QueryTrackingBehavior.NoTracking), + InlineData(false, QueryTrackingBehavior.TrackAll), InlineData(false, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual async Task Load_collection_for_detached_throws(bool async, QueryTrackingBehavior queryTrackingBehavior) { using var context = Fixture.CreateContext(); @@ -650,10 +598,8 @@ public virtual async Task Load_collection_for_detached_throws(bool async, QueryT } } - [ConditionalTheory] - [InlineData(QueryTrackingBehavior.NoTracking)] - [InlineData(QueryTrackingBehavior.TrackAll)] - [InlineData(QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(QueryTrackingBehavior.NoTracking), InlineData(QueryTrackingBehavior.TrackAll), + InlineData(QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Query_collection_for_detached_throws(QueryTrackingBehavior queryTrackingBehavior) { using var context = Fixture.CreateContext(); @@ -670,9 +616,7 @@ public virtual void Query_collection_for_detached_throws(QueryTrackingBehavior q var query = collectionEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_Include(bool async) { using var context = Fixture.CreateContext(); @@ -718,9 +662,7 @@ public virtual async Task Load_collection_using_Query_with_Include(bool async) Assert.Equal(21, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_Include_for_inverse(bool async) { using var context = Fixture.CreateContext(); @@ -756,9 +698,7 @@ public virtual async Task Load_collection_using_Query_with_Include_for_inverse(b Assert.Equal(7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_Include_for_same_collection(bool async) { using var context = Fixture.CreateContext(); @@ -794,9 +734,7 @@ public virtual async Task Load_collection_using_Query_with_Include_for_same_coll Assert.Equal(7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_filtered_Include(bool async) { using var context = Fixture.CreateContext(); @@ -843,9 +781,7 @@ public virtual async Task Load_collection_using_Query_with_filtered_Include(bool Assert.Equal(9, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_filtered_Include_and_projection(bool async) { using var context = Fixture.CreateContext(); @@ -862,14 +798,13 @@ public virtual async Task Load_collection_using_Query_with_filtered_Include_and_ .Query() .Include(e => e.ThreeSkipFull.Where(e => e.Id == 13 || e.Id == 11)) .OrderBy(e => e.Id) - .Select( - e => new - { - e.Id, - e.Name, - Count1 = e.OneSkipShared.Count, - Count3 = e.ThreeSkipFull.Count - }); + .Select(e => new + { + e.Id, + e.Name, + Count1 = e.OneSkipShared.Count, + Count3 = e.ThreeSkipFull.Count + }); var projected = async ? await queryable.ToListAsync() @@ -898,9 +833,7 @@ public virtual async Task Load_collection_using_Query_with_filtered_Include_and_ Assert.Equal(2, projected[2].Count3); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_join(bool async) { using var context = Fixture.CreateContext(); @@ -935,9 +868,7 @@ on t.Id equals s.Id } } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Query_with_Include_marks_only_left_as_loaded(bool async) { using var context = Fixture.CreateContext(); @@ -957,9 +888,7 @@ public virtual async Task Query_with_Include_marks_only_left_as_loaded(bool asyn } } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Query_with_filtered_Include_marks_only_left_as_loaded(bool async) { using var context = Fixture.CreateContext(); @@ -995,9 +924,8 @@ protected override string StoreName => "ManyToManyFieldsLoadTest"; public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - c => c - .Log(CoreEventId.ShadowForeignKeyPropertyCreated)) + => base.AddOptions(builder).ConfigureWarnings(c => c + .Log(CoreEventId.ShadowForeignKeyPropertyCreated)) .EnableDetailedErrors(); } } diff --git a/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs b/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs index ad48488840c..e686dfb091b 100644 --- a/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs +++ b/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs @@ -9,37 +9,36 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class ManyToManyLoadTestBase(TFixture fixture) : IClassFixture where TFixture : ManyToManyLoadTestBase.ManyToManyLoadFixtureBase { - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Added, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Added, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Detached, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] public virtual async Task Load_collection(EntityState state, QueryTrackingBehavior queryTrackingBehavior, bool async) { using var context = Fixture.CreateContext(); @@ -101,17 +100,10 @@ public virtual async Task Load_collection(EntityState state, QueryTrackingBehavi Assert.Equal(state == EntityState.Detached ? 0 : 1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -153,13 +145,9 @@ public virtual async Task Load_collection_using_Query(EntityState state, bool as } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Added, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false), InlineData(EntityState.Modified, false), + InlineData(EntityState.Added, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, true), + InlineData(EntityState.Added, true)] public virtual void Attached_collections_are_not_marked_as_loaded(EntityState state, bool lazy) { using var context = Fixture.CreateContext(); @@ -167,18 +155,17 @@ public virtual void Attached_collections_are_not_marked_as_loaded(EntityState st context.ChangeTracker.LazyLoadingEnabled = false; var left = ExpectLazyLoading - ? context.CreateProxy( - b => - { - b.Id = 7776; - b.TwoSkip = new ObservableCollection { new() { Id = 7777 } }; - b.TwoSkipShared = new ObservableCollection { new() { Id = 7778 } }; - b.SelfSkipPayloadLeft = new ObservableCollection { new() { Id = 7779 } }; - b.SelfSkipPayloadRight = new ObservableCollection { new() { Id = 7780 } }; - b.BranchSkip = new ObservableCollection { new() { Id = 7781 } }; - b.ThreeSkipPayloadFull = new ObservableCollection { new() { Id = 7782 } }; - b.ThreeSkipPayloadFullShared = new ObservableCollection { new() { Id = 7783 } }; - }) + ? context.CreateProxy(b => + { + b.Id = 7776; + b.TwoSkip = new ObservableCollection { new() { Id = 7777 } }; + b.TwoSkipShared = new ObservableCollection { new() { Id = 7778 } }; + b.SelfSkipPayloadLeft = new ObservableCollection { new() { Id = 7779 } }; + b.SelfSkipPayloadRight = new ObservableCollection { new() { Id = 7780 } }; + b.BranchSkip = new ObservableCollection { new() { Id = 7781 } }; + b.ThreeSkipPayloadFull = new ObservableCollection { new() { Id = 7782 } }; + b.ThreeSkipPayloadFullShared = new ObservableCollection { new() { Id = 7783 } }; + }) : new EntityOne { Id = 7776, @@ -221,17 +208,10 @@ public virtual void Attached_collections_are_not_marked_as_loaded(EntityState st Assert.False(context.Entry(left).Collection(e => e.ThreeSkipPayloadFullShared).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_already_loaded(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -286,17 +266,10 @@ public virtual async Task Load_collection_already_loaded(EntityState state, bool Assert.Equal(state == EntityState.Detached ? 0 : 1 + 4 + 4, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query_already_loaded(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -347,27 +320,15 @@ public virtual async Task Load_collection_using_Query_already_loaded(EntityState Assert.Equal(state == EntityState.Detached ? 0 : 1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false, true)] - [InlineData(EntityState.Unchanged, false, false)] - [InlineData(EntityState.Added, false, true)] - [InlineData(EntityState.Added, false, false)] - [InlineData(EntityState.Modified, false, true)] - [InlineData(EntityState.Modified, false, false)] - [InlineData(EntityState.Deleted, false, true)] - [InlineData(EntityState.Deleted, false, false)] - [InlineData(EntityState.Detached, false, true)] - [InlineData(EntityState.Detached, false, false)] - [InlineData(EntityState.Unchanged, true, true)] - [InlineData(EntityState.Unchanged, true, false)] - [InlineData(EntityState.Added, true, true)] - [InlineData(EntityState.Added, true, false)] - [InlineData(EntityState.Modified, true, true)] - [InlineData(EntityState.Modified, true, false)] - [InlineData(EntityState.Deleted, true, true)] - [InlineData(EntityState.Deleted, true, false)] - [InlineData(EntityState.Detached, true, true)] - [InlineData(EntityState.Detached, true, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false, true), InlineData(EntityState.Unchanged, false, false), + InlineData(EntityState.Added, false, true), InlineData(EntityState.Added, false, false), InlineData(EntityState.Modified, false, true), + InlineData(EntityState.Modified, false, false), InlineData(EntityState.Deleted, false, true), + InlineData(EntityState.Deleted, false, false), InlineData(EntityState.Detached, false, true), + InlineData(EntityState.Detached, false, false), InlineData(EntityState.Unchanged, true, true), + InlineData(EntityState.Unchanged, true, false), InlineData(EntityState.Added, true, true), InlineData(EntityState.Added, true, false), + InlineData(EntityState.Modified, true, true), InlineData(EntityState.Modified, true, false), + InlineData(EntityState.Deleted, true, true), InlineData(EntityState.Deleted, true, false), + InlineData(EntityState.Detached, true, true), InlineData(EntityState.Detached, true, false)] public virtual async Task Load_collection_partially_loaded(EntityState state, bool forceIdentityResolution, bool async) { using var context = Fixture.CreateContext(); @@ -444,27 +405,15 @@ public virtual async Task Load_collection_partially_loaded(EntityState state, bo } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false, true)] - [InlineData(EntityState.Unchanged, false, false)] - [InlineData(EntityState.Added, false, true)] - [InlineData(EntityState.Added, false, false)] - [InlineData(EntityState.Modified, false, true)] - [InlineData(EntityState.Modified, false, false)] - [InlineData(EntityState.Deleted, false, true)] - [InlineData(EntityState.Deleted, false, false)] - [InlineData(EntityState.Detached, false, true)] - [InlineData(EntityState.Detached, false, false)] - [InlineData(EntityState.Unchanged, true, true)] - [InlineData(EntityState.Unchanged, true, false)] - [InlineData(EntityState.Added, true, true)] - [InlineData(EntityState.Added, true, false)] - [InlineData(EntityState.Modified, true, true)] - [InlineData(EntityState.Modified, true, false)] - [InlineData(EntityState.Deleted, true, true)] - [InlineData(EntityState.Deleted, true, false)] - [InlineData(EntityState.Detached, true, true)] - [InlineData(EntityState.Detached, true, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false, true), InlineData(EntityState.Unchanged, false, false), + InlineData(EntityState.Added, false, true), InlineData(EntityState.Added, false, false), InlineData(EntityState.Modified, false, true), + InlineData(EntityState.Modified, false, false), InlineData(EntityState.Deleted, false, true), + InlineData(EntityState.Deleted, false, false), InlineData(EntityState.Detached, false, true), + InlineData(EntityState.Detached, false, false), InlineData(EntityState.Unchanged, true, true), + InlineData(EntityState.Unchanged, true, false), InlineData(EntityState.Added, true, true), InlineData(EntityState.Added, true, false), + InlineData(EntityState.Modified, true, true), InlineData(EntityState.Modified, true, false), + InlineData(EntityState.Deleted, true, true), InlineData(EntityState.Deleted, true, false), + InlineData(EntityState.Detached, true, true), InlineData(EntityState.Detached, true, false)] public virtual async Task Load_collection_partially_loaded_no_explicit_join(EntityState state, bool forceIdentityResolution, bool async) { using var context = Fixture.CreateContext(); @@ -541,9 +490,7 @@ public virtual async Task Load_collection_partially_loaded_no_explicit_join(Enti } } - [ConditionalTheory] - [InlineData(QueryTrackingBehavior.NoTracking)] - [InlineData(QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(QueryTrackingBehavior.NoTracking), InlineData(QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Load_collection_partially_loaded_no_tracking(QueryTrackingBehavior queryTrackingBehavior) { using var context = Fixture.CreateContext(); @@ -593,17 +540,10 @@ public virtual void Load_collection_partially_loaded_no_tracking(QueryTrackingBe Assert.Empty(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_untyped(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -660,17 +600,10 @@ public virtual async Task Load_collection_untyped(EntityState state, bool async) Assert.Equal(state == EntityState.Detached ? 0 : 1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query_untyped(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -712,17 +645,10 @@ public virtual async Task Load_collection_using_Query_untyped(EntityState state, } } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_not_found_untyped(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -774,17 +700,10 @@ public virtual async Task Load_collection_not_found_untyped(EntityState state, b Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query_not_found_untyped(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -817,27 +736,20 @@ public virtual async Task Load_collection_using_Query_not_found_untyped(EntitySt Assert.Equal(state == EntityState.Detached ? 0 : 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Added, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Added, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Added, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Added, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Added, true, CascadeTiming.Immediate), + InlineData(EntityState.Added, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Added, true, CascadeTiming.OnSaveChanges), InlineData(EntityState.Added, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_already_loaded_untyped(EntityState state, bool async, CascadeTiming deleteOrphansTiming) { using var context = Fixture.CreateContext(); @@ -894,27 +806,20 @@ public virtual async Task Load_collection_already_loaded_untyped(EntityState sta Assert.Equal(state == EntityState.Detached ? 0 : 1 + 4 + 4, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Added, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Added, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Detached, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Added, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Added, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Added, true, CascadeTiming.Immediate), + InlineData(EntityState.Added, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Detached, true, CascadeTiming.Immediate), + InlineData(EntityState.Detached, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Added, true, CascadeTiming.OnSaveChanges), InlineData(EntityState.Added, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Detached, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_using_Query_already_loaded_untyped( EntityState state, bool async, @@ -971,17 +876,10 @@ public virtual async Task Load_collection_using_Query_already_loaded_untyped( Assert.Equal(state == EntityState.Detached ? 0 : 1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_composite_key(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -1038,17 +936,10 @@ public virtual async Task Load_collection_composite_key(EntityState state, bool Assert.Equal(state == EntityState.Detached ? 0 : 1 + 2 + 2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Added, true), InlineData(EntityState.Added, false), InlineData(EntityState.Modified, true), + InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Load_collection_using_Query_composite_key(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -1090,13 +981,9 @@ public virtual async Task Load_collection_using_Query_composite_key(EntityState } } - [ConditionalTheory] - [InlineData(true, QueryTrackingBehavior.NoTracking)] - [InlineData(true, QueryTrackingBehavior.TrackAll)] - [InlineData(true, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(false, QueryTrackingBehavior.NoTracking)] - [InlineData(false, QueryTrackingBehavior.TrackAll)] - [InlineData(false, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(true, QueryTrackingBehavior.NoTracking), InlineData(true, QueryTrackingBehavior.TrackAll), + InlineData(true, QueryTrackingBehavior.NoTrackingWithIdentityResolution), InlineData(false, QueryTrackingBehavior.NoTracking), + InlineData(false, QueryTrackingBehavior.TrackAll), InlineData(false, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual async Task Load_collection_for_detached_throws(bool async, QueryTrackingBehavior queryTrackingBehavior) { using var context = Fixture.CreateContext(); @@ -1120,10 +1007,8 @@ public virtual async Task Load_collection_for_detached_throws(bool async, QueryT } } - [ConditionalTheory] - [InlineData(QueryTrackingBehavior.NoTracking)] - [InlineData(QueryTrackingBehavior.TrackAll)] - [InlineData(QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(QueryTrackingBehavior.NoTracking), InlineData(QueryTrackingBehavior.TrackAll), + InlineData(QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Query_collection_for_detached_throws(QueryTrackingBehavior queryTrackingBehavior) { using var context = Fixture.CreateContext(); @@ -1140,9 +1025,7 @@ public virtual void Query_collection_for_detached_throws(QueryTrackingBehavior q var query = collectionEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_Include(bool async) { using var context = Fixture.CreateContext(); @@ -1189,9 +1072,7 @@ public virtual async Task Load_collection_using_Query_with_Include(bool async) Assert.Equal(21, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_Include_for_inverse(bool async) { using var context = Fixture.CreateContext(); @@ -1228,9 +1109,7 @@ public virtual async Task Load_collection_using_Query_with_Include_for_inverse(b Assert.Equal(7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_Include_for_same_collection(bool async) { using var context = Fixture.CreateContext(); @@ -1267,9 +1146,7 @@ public virtual async Task Load_collection_using_Query_with_Include_for_same_coll Assert.Equal(7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_filtered_Include(bool async) { using var context = Fixture.CreateContext(); @@ -1317,9 +1194,7 @@ public virtual async Task Load_collection_using_Query_with_filtered_Include(bool Assert.Equal(9, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_filtered_Include_and_projection(bool async) { using var context = Fixture.CreateContext(); @@ -1336,14 +1211,13 @@ public virtual async Task Load_collection_using_Query_with_filtered_Include_and_ .Query() .Include(e => e.ThreeSkipFull.Where(e => e.Id == 13 || e.Id == 11)) .OrderBy(e => e.Id) - .Select( - e => new - { - e.Id, - e.Name, - Count1 = e.OneSkipShared.Count, - Count3 = e.ThreeSkipFull.Count - }); + .Select(e => new + { + e.Id, + e.Name, + Count1 = e.OneSkipShared.Count, + Count3 = e.ThreeSkipFull.Count + }); var projected = async ? await queryable.ToListAsync() @@ -1373,9 +1247,7 @@ public virtual async Task Load_collection_using_Query_with_filtered_Include_and_ Assert.Equal(2, projected[2].Count3); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_join(bool async) { using var context = Fixture.CreateContext(); @@ -1411,9 +1283,7 @@ on t.Id equals s.Id } } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Query_with_Include_marks_only_left_as_loaded(bool async) { using var context = Fixture.CreateContext(); @@ -1435,9 +1305,7 @@ public virtual async Task Query_with_Include_marks_only_left_as_loaded(bool asyn } } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Query_with_filtered_Include_marks_only_left_as_loaded(bool async) { using var context = Fixture.CreateContext(); diff --git a/test/EFCore.Specification.Tests/ManyToManyTrackingTestBase.cs b/test/EFCore.Specification.Tests/ManyToManyTrackingTestBase.cs index 4c008887538..82d622b3482 100644 --- a/test/EFCore.Specification.Tests/ManyToManyTrackingTestBase.cs +++ b/test/EFCore.Specification.Tests/ManyToManyTrackingTestBase.cs @@ -12,9 +12,7 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class ManyToManyTrackingTestBase(TFixture fixture) : IClassFixture where TFixture : ManyToManyTrackingTestBase.ManyToManyTrackingFixtureBase { - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_composite_with_navs(bool async) { List keys = null; @@ -24,27 +22,24 @@ await ExecuteWithStrategyInTransactionAsync( { var leftEntities = new[] { - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Key2 = "7711"; - e.Key3 = new DateTime(7711, 1, 1); - }), - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Key2 = "7712"; - e.Key3 = new DateTime(7712, 1, 1); - }), - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Key2 = "7713"; - e.Key3 = new DateTime(7713, 1, 1); - }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Key2 = "7711"; + e.Key3 = new DateTime(7711, 1, 1); + }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Key2 = "7712"; + e.Key3 = new DateTime(7712, 1, 1); + }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Key2 = "7713"; + e.Key3 = new DateTime(7713, 1, 1); + }), }; var rightEntities = new[] { @@ -149,77 +144,69 @@ public virtual Task Can_update_many_to_many_composite_with_navs() var rightEntities = await context.Set().Include(e => e.CompositeKeySkipFull).OrderBy(e => e.Name).ToListAsync(); leftEntities[0].LeafSkipFull.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + })); leftEntities[0].LeafSkipFull.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + })); leftEntities[0].LeafSkipFull.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + })); rightEntities[0].CompositeKeySkipFull.Add( - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Key2 = "7711"; - e.Key3 = new DateTime(7711, 1, 1); - e.Name = "Z7711"; - })); + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Key2 = "7711"; + e.Key3 = new DateTime(7711, 1, 1); + e.Name = "Z7711"; + })); rightEntities[0].CompositeKeySkipFull.Add( - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Key2 = "7712"; - e.Key3 = new DateTime(7712, 1, 1); - e.Name = "Z7712"; - })); + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Key2 = "7712"; + e.Key3 = new DateTime(7712, 1, 1); + e.Name = "Z7712"; + })); rightEntities[0].CompositeKeySkipFull.Add( - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Key2 = "7713"; - e.Key3 = new DateTime(7713, 1, 1); - e.Name = "Z7713"; - })); + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Key2 = "7713"; + e.Key3 = new DateTime(7713, 1, 1); + e.Name = "Z7713"; + })); leftEntities[0].LeafSkipFull.Remove(leftEntities[0].LeafSkipFull.Single(e => e.Name == "Leaf 1")); rightEntities[1].CompositeKeySkipFull.Remove(rightEntities[1].CompositeKeySkipFull.Single(e => e.Key2 == "3_1")); leftEntities[2].LeafSkipFull.Remove(leftEntities[2].LeafSkipFull.Single(e => e.Name == "Leaf 3")); leftEntities[2].LeafSkipFull.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + })); rightEntities[2].CompositeKeySkipFull.Remove(rightEntities[2].CompositeKeySkipFull.Single(e => e.Key2 == "8_3")); rightEntities[2].CompositeKeySkipFull.Add( - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Key2 = "7714"; - e.Key3 = new DateTime(7714, 1, 1); - e.Name = "Z7714"; - })); + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Key2 = "7714"; + e.Key3 = new DateTime(7714, 1, 1); + e.Name = "Z7714"; + })); if (RequiresDetectChanges) { @@ -472,9 +459,7 @@ static void ValidateJoinNavigations(DbContext context) } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_composite_shared_with_navs(bool async) { List keys = null; @@ -484,27 +469,24 @@ await ExecuteWithStrategyInTransactionAsync( { var leftEntities = new[] { - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Key2 = "7711"; - e.Key3 = new DateTime(7711, 1, 1); - }), - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Key2 = "7712"; - e.Key3 = new DateTime(7712, 1, 1); - }), - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Key2 = "7713"; - e.Key3 = new DateTime(7713, 1, 1); - }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Key2 = "7711"; + e.Key3 = new DateTime(7711, 1, 1); + }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Key2 = "7712"; + e.Key3 = new DateTime(7712, 1, 1); + }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Key2 = "7713"; + e.Key3 = new DateTime(7713, 1, 1); + }), }; var rightEntities = new[] { @@ -601,31 +583,27 @@ public virtual Task Can_update_many_to_many_composite_shared_with_navs() var roots = new[] { - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.Set().CreateInstance( - (e, p) => - { - Assert.True(e != null, nameof(e) + " != null"); - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - }) + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.Set().CreateInstance((e, p) => + { + Assert.True(e != null, nameof(e) + " != null"); + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + }) }; leftEntities[0].RootSkipShared.Add(roots[0]); @@ -633,29 +611,26 @@ public virtual Task Can_update_many_to_many_composite_shared_with_navs() leftEntities[0].RootSkipShared.Add(roots[2]); rightEntities[0].CompositeKeySkipShared.Add( - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Key2 = "Z7711"; - e.Key3 = new DateTime(7711, 1, 1); - })); + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Key2 = "Z7711"; + e.Key3 = new DateTime(7711, 1, 1); + })); rightEntities[0].CompositeKeySkipShared.Add( - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Key2 = "Z7712"; - e.Key3 = new DateTime(7712, 1, 1); - })); + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Key2 = "Z7712"; + e.Key3 = new DateTime(7712, 1, 1); + })); rightEntities[0].CompositeKeySkipShared.Add( - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Key2 = "Z7713"; - e.Key3 = new DateTime(7713, 1, 1); - })); + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Key2 = "Z7713"; + e.Key3 = new DateTime(7713, 1, 1); + })); leftEntities[0].RootSkipShared.Remove(leftEntities[0].RootSkipShared.Single(e => e.Name == "Root 9")); rightEntities[1].CompositeKeySkipShared.Remove(rightEntities[1].CompositeKeySkipShared.Single(e => e.Key2 == "8_2")); @@ -665,13 +640,12 @@ public virtual Task Can_update_many_to_many_composite_shared_with_navs() rightEntities[3].CompositeKeySkipShared.Remove(rightEntities[3].CompositeKeySkipShared.Single(e => e.Key2 == "8_5")); rightEntities[3].CompositeKeySkipShared.Add( - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Key2 = "Z7714"; - e.Key3 = new DateTime(7714, 1, 1); - })); + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Key2 = "Z7714"; + e.Key3 = new DateTime(7714, 1, 1); + })); if (RequiresDetectChanges) { @@ -865,9 +839,7 @@ void ValidateNavigations( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_composite_additional_pk_with_navs(bool async) { List keys = null; @@ -877,48 +849,42 @@ await ExecuteWithStrategyInTransactionAsync( { var leftEntities = new[] { - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Key2 = "7711"; - e.Key3 = new DateTime(7711, 1, 1); - }), - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Key2 = "7712"; - e.Key3 = new DateTime(7712, 1, 1); - }), - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Key2 = "7713"; - e.Key3 = new DateTime(7713, 1, 1); - }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Key2 = "7711"; + e.Key3 = new DateTime(7711, 1, 1); + }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Key2 = "7712"; + e.Key3 = new DateTime(7712, 1, 1); + }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Key2 = "7713"; + e.Key3 = new DateTime(7713, 1, 1); + }), }; var rightEntities = new[] { - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }) + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }) }; leftEntities[0].ThreeSkipFull = CreateCollection(); @@ -1027,62 +993,54 @@ public virtual Task Can_update_many_to_many_composite_additional_pk_with_navs() var threes = new[] { - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - }) + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + }) }; var composites = new[] { - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Key2 = "Z7711"; - e.Key3 = new DateTime(7711, 1, 1); - }), - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Key2 = "Z7712"; - e.Key3 = new DateTime(7712, 1, 1); - }), - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Key2 = "Z7713"; - e.Key3 = new DateTime(7713, 1, 1); - }), - context.EntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Key2 = "Z7714"; - e.Key3 = new DateTime(7714, 1, 1); - }) + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Key2 = "Z7711"; + e.Key3 = new DateTime(7711, 1, 1); + }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Key2 = "Z7712"; + e.Key3 = new DateTime(7712, 1, 1); + }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Key2 = "Z7713"; + e.Key3 = new DateTime(7713, 1, 1); + }), + context.EntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Key2 = "Z7714"; + e.Key3 = new DateTime(7714, 1, 1); + }) }; leftEntities[0].ThreeSkipFull.Add(threes[0]); @@ -1348,9 +1306,7 @@ static void ValidateJoinNavigations(DbContext context) } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_self_shared(bool async) { List leftKeys = null; @@ -1467,54 +1423,46 @@ public virtual Task Can_update_many_to_many_self() var twos = new[] { - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - }) + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + }) }; leftEntities[0].SelfSkipSharedRight.Add(twos[0]); @@ -1614,9 +1562,7 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_with_navs(bool async) { List keys = null; @@ -1727,69 +1673,61 @@ public virtual Task Can_update_many_to_many_with_navs() var rightEntities = await context.Set().Include(e => e.TwoSkipFull).OrderBy(e => e.Name).ToListAsync(); leftEntities[0].ThreeSkipFull.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + })); leftEntities[0].ThreeSkipFull.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + })); leftEntities[0].ThreeSkipFull.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + })); rightEntities[0].TwoSkipFull.Add( - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - })); + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + })); rightEntities[0].TwoSkipFull.Add( - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - })); + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + })); rightEntities[0].TwoSkipFull.Add( - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - })); + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + })); leftEntities[1].ThreeSkipFull.Remove(leftEntities[1].ThreeSkipFull.Single(e => e.Name == "EntityThree 17")); rightEntities[1].TwoSkipFull.Remove(rightEntities[1].TwoSkipFull.Single(e => e.Name == "EntityTwo 6")); leftEntities[2].ThreeSkipFull.Remove(leftEntities[2].ThreeSkipFull.Single(e => e.Name == "EntityThree 13")); leftEntities[2].ThreeSkipFull.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + })); rightEntities[2].TwoSkipFull.Remove(rightEntities[2].TwoSkipFull.Single(e => e.Name == "EntityTwo 3")); rightEntities[2].TwoSkipFull.Add( - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - })); + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + })); if (RequiresDetectChanges) { @@ -1880,9 +1818,7 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_with_inheritance(bool async) { List keys = null; @@ -1983,69 +1919,61 @@ public virtual Task Can_update_many_to_many_with_inheritance() var rightEntities = await context.Set().Include(e => e.OneSkip).OrderBy(e => e.Name).ToListAsync(); leftEntities[0].BranchSkip.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + })); leftEntities[0].BranchSkip.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + })); leftEntities[0].BranchSkip.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + })); rightEntities[0].OneSkip.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + })); rightEntities[0].OneSkip.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + })); rightEntities[0].OneSkip.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + })); leftEntities[1].BranchSkip.Remove(leftEntities[1].BranchSkip.Single(e => e.Name == "Branch 4")); rightEntities[1].OneSkip.Remove(rightEntities[1].OneSkip.Single(e => e.Name == "EntityOne 9")); leftEntities[4].BranchSkip.Remove(leftEntities[4].BranchSkip.Single(e => e.Name == "Branch 5")); leftEntities[2].BranchSkip.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + })); rightEntities[2].OneSkip.Remove(rightEntities[2].OneSkip.Single(e => e.Name == "EntityOne 8")); rightEntities[2].OneSkip.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + })); if (RequiresDetectChanges) { @@ -2125,9 +2053,7 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_self_with_payload(bool async) { List leftKeys = null; @@ -2264,54 +2190,46 @@ public virtual Task Can_update_many_to_many_self_with_payload() var ones = new[] { - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - }) + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + }) }; leftEntities[0].SelfSkipPayloadRight.Add(ones[0]); @@ -2448,9 +2366,7 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_shared_with_payload(bool async) { List keys = null; @@ -2563,48 +2479,42 @@ public virtual Task Can_update_many_to_many_shared_with_payload() .ToListAsync(); leftEntities[0].ThreeSkipPayloadFullShared.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + })); leftEntities[0].ThreeSkipPayloadFullShared.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + })); leftEntities[0].ThreeSkipPayloadFullShared.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + })); rightEntities[0].OneSkipPayloadFullShared.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + })); rightEntities[0].OneSkipPayloadFullShared.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + })); rightEntities[0].OneSkipPayloadFullShared.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + })); leftEntities[2].ThreeSkipPayloadFullShared .Remove(leftEntities[2].ThreeSkipPayloadFullShared.Single(e => e.Name == "EntityThree 10")); @@ -2615,23 +2525,21 @@ public virtual Task Can_update_many_to_many_shared_with_payload() .Remove(leftEntities[3].ThreeSkipPayloadFullShared.Single(e => e.Name == "EntityThree 17")); leftEntities[3].ThreeSkipPayloadFullShared .Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + })); rightEntities[2].OneSkipPayloadFullShared .Remove(rightEntities[2].OneSkipPayloadFullShared.Single(e => e.Name == "EntityOne 12")); rightEntities[2].OneSkipPayloadFullShared .Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + })); if (RequiresDetectChanges) { @@ -2752,9 +2660,7 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_shared(bool async) { List keys = null; @@ -2856,58 +2762,50 @@ public virtual Task Can_update_many_to_many_shared() var twos = new[] { - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + }), }; var ones = new[] { - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + }), }; leftEntities[0].TwoSkipShared.Add(twos[0]); @@ -3005,9 +2903,7 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_with_payload(bool async) { List keys = null; @@ -3123,48 +3019,42 @@ public virtual Task Can_update_many_to_many_with_payload() var rightEntities = await context.Set().Include(e => e.OneSkipPayloadFull).OrderBy(e => e.Name).ToListAsync(); leftEntities[0].ThreeSkipPayloadFull.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + })); leftEntities[0].ThreeSkipPayloadFull.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + })); leftEntities[0].ThreeSkipPayloadFull.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + })); rightEntities[0].OneSkipPayloadFull.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + })); rightEntities[0].OneSkipPayloadFull.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + })); rightEntities[0].OneSkipPayloadFull.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + })); leftEntities[1].ThreeSkipPayloadFull .Remove(leftEntities[1].ThreeSkipPayloadFull.Single(e => e.Name == "EntityThree 10")); @@ -3173,21 +3063,19 @@ public virtual Task Can_update_many_to_many_with_payload() leftEntities[2].ThreeSkipPayloadFull .Remove(leftEntities[2].ThreeSkipPayloadFull.Single(e => e.Name == "EntityThree 13")); leftEntities[2].ThreeSkipPayloadFull.Add( - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - })); + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + })); rightEntities[2].OneSkipPayloadFull.Remove(rightEntities[2].OneSkipPayloadFull.Single(e => e.Name == "EntityOne 15")); rightEntities[2].OneSkipPayloadFull.Add( - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - })); + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + })); if (RequiresDetectChanges) { @@ -3441,9 +3329,7 @@ static void ValidateJoinNavigations(DbContext context) } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many(bool async) { List keys = null; @@ -3534,15 +3420,9 @@ void ValidateFixup(DbContext context, IList leftEntities, IList().CreateInstance( - (e, p) => - { - e.One = leftEntities[0]; - e.Two = rightEntities[0]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.One = leftEntities[0]; - e.Two = rightEntities[1]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.One = leftEntities[0]; - e.Two = rightEntities[2]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.One = leftEntities[1]; - e.Two = rightEntities[0]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.One = leftEntities[2]; - e.Two = rightEntities[0]; - }), + context.Set().CreateInstance((e, p) => + { + e.One = leftEntities[0]; + e.Two = rightEntities[0]; + }), + context.Set().CreateInstance((e, p) => + { + e.One = leftEntities[0]; + e.Two = rightEntities[1]; + }), + context.Set().CreateInstance((e, p) => + { + e.One = leftEntities[0]; + e.Two = rightEntities[2]; + }), + context.Set().CreateInstance((e, p) => + { + e.One = leftEntities[1]; + e.Two = rightEntities[0]; + }), + context.Set().CreateInstance((e, p) => + { + e.One = leftEntities[2]; + e.Two = rightEntities[0]; + }), }; - var extra = context.Set().CreateInstance( - (e, p) => + var extra = context.Set().CreateInstance((e, p) => + { + e.JoinEntities = new ObservableCollection { - e.JoinEntities = new ObservableCollection - { - joinEntities[0], - joinEntities[1], - joinEntities[2], - joinEntities[3], - joinEntities[4], - }; - }); + joinEntities[0], + joinEntities[1], + joinEntities[2], + joinEntities[3], + joinEntities[4], + }; + }); rightEntities[0].Extra = extra; rightEntities[1].Extra = extra; @@ -3720,15 +3594,9 @@ void ValidateFixup(DbContext context, IList leftEntities, IList keys = null; @@ -3869,58 +3737,50 @@ public virtual Task Can_update_many_to_many() var twos = new[] { - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - }) + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + }) }; var ones = new[] { - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - }), - context.EntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + }), + context.EntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + }), }; leftEntities[0].TwoSkip.Add(twos[0]); @@ -4115,9 +3975,7 @@ void ValidateNavigations(List ones, List twos) } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_fully_by_convention(bool async) { List keys = null; @@ -4217,9 +4075,7 @@ void ValidateFixup(DbContext context, IList leftEntities, I } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_fully_by_convention_generated_keys(bool async) { await ExecuteWithStrategyInTransactionAsync( @@ -4315,11 +4171,7 @@ void ValidateFixup(DbContext context, IList leftEntities, ILi } } - [ConditionalTheory] - [InlineData(true, false)] - [InlineData(false, false)] - [InlineData(true, true)] - [InlineData(false, true)] + [ConditionalTheory, InlineData(true, false), InlineData(false, false), InlineData(true, true), InlineData(false, true)] public virtual async Task Can_Attach_or_Update_a_many_to_many_with_mixed_set_and_unset_keys(bool useUpdate, bool async) { var existingLeftId = -1; @@ -4470,9 +4322,7 @@ void ValidateFixup(DbContext context, IList leftEntities, ILi } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Initial_tracking_uses_skip_navigations(bool async) { List keys = null; @@ -4555,13 +4405,8 @@ void ValidateFixup(DbContext context, IList leftEntities, I } } - [ConditionalTheory] - [InlineData(new[] { 1, 2, 3 })] - [InlineData(new[] { 2, 1, 3 })] - [InlineData(new[] { 3, 1, 2 })] - [InlineData(new[] { 3, 2, 1 })] - [InlineData(new[] { 1, 3, 2 })] - [InlineData(new[] { 2, 3, 1 })] + [ConditionalTheory, InlineData(new[] { 1, 2, 3 }), InlineData(new[] { 2, 1, 3 }), InlineData(new[] { 3, 1, 2 }), + InlineData(new[] { 3, 2, 1 }), InlineData(new[] { 1, 3, 2 }), InlineData(new[] { 2, 3, 1 })] public virtual void Can_load_entities_in_any_order(int[] order) { using var context = CreateContext(); @@ -4614,13 +4459,12 @@ public virtual Task Can_insert_update_delete_shared_type_entity_type() => ExecuteWithStrategyInTransactionAsync( context => { - var entity = context.Set>("JoinOneToThreePayloadFullShared").CreateInstance( - (e, p) => - { - e["OneId"] = 1; - e["ThreeId"] = 1; - e["Payload"] = "NewlyAdded"; - }); + var entity = context.Set>("JoinOneToThreePayloadFullShared").CreateInstance((e, p) => + { + e["OneId"] = 1; + e["ThreeId"] = 1; + e["Payload"] = "NewlyAdded"; + }); context.Set>("JoinOneToThreePayloadFullShared").Add(entity); return context.SaveChangesAsync(); @@ -4660,12 +4504,11 @@ public virtual Task Can_insert_update_delete_proxyable_shared_type_entity_type() return ExecuteWithStrategyInTransactionAsync( async context => { - var entity = context.Set("PST").CreateInstance( - (e, p) => - { - e["Id"] = Fixture.UseGeneratedKeys ? null : 1; - e["Payload"] = "NewlyAdded"; - }); + var entity = context.Set("PST").CreateInstance((e, p) => + { + e["Id"] = Fixture.UseGeneratedKeys ? null : 1; + e["Payload"] = "NewlyAdded"; + }); context.Set("PST").Add(entity); @@ -4700,9 +4543,7 @@ public virtual Task Can_insert_update_delete_proxyable_shared_type_entity_type() }); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_with_navs_by_join_entity(bool async) { await ExecuteWithStrategyInTransactionAsync( @@ -4710,79 +4551,68 @@ await ExecuteWithStrategyInTransactionAsync( { var leftEntities = new[] { - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - }), - context.EntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - }) + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + }), + context.EntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + }) }; var rightEntities = new[] { - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.EntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }) + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.EntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }) }; var joinEntities = new[] { - context.Set().CreateInstance( - (e, p) => - { - e.Two = leftEntities[0]; - e.Three = rightEntities[0]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Two = leftEntities[0]; - e.Three = rightEntities[1]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Two = leftEntities[0]; - e.Three = rightEntities[2]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Two = leftEntities[1]; - e.Three = rightEntities[0]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Two = leftEntities[2]; - e.Three = rightEntities[0]; - }) + context.Set().CreateInstance((e, p) => + { + e.Two = leftEntities[0]; + e.Three = rightEntities[0]; + }), + context.Set().CreateInstance((e, p) => + { + e.Two = leftEntities[0]; + e.Three = rightEntities[1]; + }), + context.Set().CreateInstance((e, p) => + { + e.Two = leftEntities[0]; + e.Three = rightEntities[2]; + }), + context.Set().CreateInstance((e, p) => + { + e.Two = leftEntities[1]; + e.Three = rightEntities[0]; + }), + context.Set().CreateInstance((e, p) => + { + e.Two = leftEntities[2]; + e.Three = rightEntities[0]; + }) }; if (async) @@ -4848,19 +4678,11 @@ static void ValidateFixup(DbContext context, IList leftEntities, ILis } } - [ConditionalTheory] - [InlineData(false, false, false, false)] - [InlineData(false, true, false, false)] - [InlineData(true, false, false, false)] - [InlineData(true, true, false, false)] - [InlineData(false, false, true, false)] - [InlineData(false, true, true, false)] - [InlineData(true, false, true, false)] - [InlineData(true, true, true, false)] - [InlineData(false, false, true, true)] - [InlineData(false, true, true, true)] - [InlineData(true, false, true, true)] - [InlineData(true, true, true, true)] + [ConditionalTheory, InlineData(false, false, false, false), InlineData(false, true, false, false), + InlineData(true, false, false, false), InlineData(true, true, false, false), InlineData(false, false, true, false), + InlineData(false, true, true, false), InlineData(true, false, true, false), InlineData(true, true, true, false), + InlineData(false, false, true, true), InlineData(false, true, true, true), InlineData(true, false, true, true), + InlineData(true, true, true, true)] public virtual Task Can_add_and_remove_a_new_relationship(bool modifyLeft, bool modifyRight, bool useJoin, bool useNavs) { var leftId = -1; @@ -4893,18 +4715,16 @@ public virtual Task Can_add_and_remove_a_new_relationship(bool modifyLeft, bool ? new JoinOneToTwo { One = left, Two = right } : new JoinOneToTwo { OneId = leftId, TwoId = rightId } : useNavs - ? context.CreateProxy( - e => - { - e.One = left; - e.Two = right; - }) - : context.CreateProxy( - e => - { - e.OneId = leftId; - e.TwoId = rightId; - })); + ? context.CreateProxy(e => + { + e.One = left; + e.Two = right; + }) + : context.CreateProxy(e => + { + e.OneId = leftId; + e.TwoId = rightId; + })); } else { @@ -4961,15 +4781,9 @@ public virtual Task Can_add_and_remove_a_new_relationship(bool modifyLeft, bool }); } - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(false, true, false)] - [InlineData(true, false, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(false, true, true)] - [InlineData(true, false, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(false, true, false), InlineData(true, false, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(false, true, true), InlineData(true, false, true), + InlineData(true, true, true)] public virtual Task Can_add_and_remove_a_new_relationship_self(bool modifyLeft, bool modifyRight, bool useJoin) { var leftId = -1; @@ -5050,19 +4864,11 @@ public virtual Task Can_add_and_remove_a_new_relationship_self(bool modifyLeft, }); } - [ConditionalTheory] - [InlineData(false, false, false, false)] - [InlineData(false, true, false, false)] - [InlineData(true, false, false, false)] - [InlineData(true, true, false, false)] - [InlineData(false, false, true, false)] - [InlineData(false, true, true, false)] - [InlineData(true, false, true, false)] - [InlineData(true, true, true, false)] - [InlineData(false, false, true, true)] - [InlineData(false, true, true, true)] - [InlineData(true, false, true, true)] - [InlineData(true, true, true, true)] + [ConditionalTheory, InlineData(false, false, false, false), InlineData(false, true, false, false), + InlineData(true, false, false, false), InlineData(true, true, false, false), InlineData(false, false, true, false), + InlineData(false, true, true, false), InlineData(true, false, true, false), InlineData(true, true, true, false), + InlineData(false, false, true, true), InlineData(false, true, true, true), InlineData(true, false, true, true), + InlineData(true, true, true, true)] public virtual Task Can_add_and_remove_a_new_relationship_composite_with_navs( bool modifyLeft, bool modifyRight, @@ -5115,20 +4921,18 @@ public virtual Task Can_add_and_remove_a_new_relationship_composite_with_navs( LeafId = rightId } : useNavs - ? context.CreateProxy( - e => - { - e.Composite = left; - e.Leaf = right; - }) - : context.CreateProxy( - e => - { - e.CompositeId1 = leftKey1; - e.CompositeId2 = leftKey2; - e.CompositeId3 = leftKey3; - e.LeafId = rightId; - })); + ? context.CreateProxy(e => + { + e.Composite = left; + e.Leaf = right; + }) + : context.CreateProxy(e => + { + e.CompositeId1 = leftKey1; + e.CompositeId2 = leftKey2; + e.CompositeId3 = leftKey3; + e.LeafId = rightId; + })); } else { @@ -5201,19 +5005,11 @@ public virtual Task Can_add_and_remove_a_new_relationship_composite_with_navs( }); } - [ConditionalTheory] - [InlineData(false, false, false, false)] - [InlineData(false, true, false, false)] - [InlineData(true, false, false, false)] - [InlineData(true, true, false, false)] - [InlineData(false, false, true, false)] - [InlineData(false, true, true, false)] - [InlineData(true, false, true, false)] - [InlineData(true, true, true, false)] - [InlineData(false, false, true, true)] - [InlineData(false, true, true, true)] - [InlineData(true, false, true, true)] - [InlineData(true, true, true, true)] + [ConditionalTheory, InlineData(false, false, false, false), InlineData(false, true, false, false), + InlineData(true, false, false, false), InlineData(true, true, false, false), InlineData(false, false, true, false), + InlineData(false, true, true, false), InlineData(true, false, true, false), InlineData(true, true, true, false), + InlineData(false, false, true, true), InlineData(false, true, true, true), InlineData(true, false, true, true), + InlineData(true, true, true, true)] public virtual Task Can_add_and_remove_a_new_relationship_composite_additional_pk_with_navs( bool modifyLeft, bool modifyRight, @@ -5266,20 +5062,18 @@ public virtual Task Can_add_and_remove_a_new_relationship_composite_additional_p ThreeId = rightId } : useNavs - ? context.CreateProxy( - e => - { - e.Composite = left; - e.Three = right; - }) - : context.CreateProxy( - e => - { - e.CompositeId1 = leftKey1; - e.CompositeId2 = leftKey2; - e.CompositeId3 = leftKey3; - e.ThreeId = rightId; - })); + ? context.CreateProxy(e => + { + e.Composite = left; + e.Three = right; + }) + : context.CreateProxy(e => + { + e.CompositeId1 = leftKey1; + e.CompositeId2 = leftKey2; + e.CompositeId3 = leftKey3; + e.ThreeId = rightId; + })); } else { @@ -5352,15 +5146,9 @@ public virtual Task Can_add_and_remove_a_new_relationship_composite_additional_p }); } - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(false, true, false)] - [InlineData(true, false, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(false, true, true)] - [InlineData(true, false, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(false, true, false), InlineData(true, false, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(false, true, true), InlineData(true, false, true), + InlineData(true, true, true)] public virtual Task Can_add_and_remove_a_new_relationship_with_inheritance(bool modifyLeft, bool modifyRight, bool useJoin) { var leftId = -1; @@ -5390,12 +5178,11 @@ public virtual Task Can_add_and_remove_a_new_relationship_with_inheritance(bool context.Add( RequiresDetectChanges ? new JoinOneToBranch { EntityOneId = leftId, EntityBranchId = rightId } - : context.CreateProxy( - e => - { - e.EntityOneId = leftId; - e.EntityBranchId = rightId; - })); + : context.CreateProxy(e => + { + e.EntityOneId = leftId; + e.EntityBranchId = rightId; + })); } else { @@ -5448,15 +5235,9 @@ public virtual Task Can_add_and_remove_a_new_relationship_with_inheritance(bool }); } - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(false, true, false)] - [InlineData(true, false, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(false, true, true)] - [InlineData(true, false, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(false, true, false), InlineData(true, false, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(false, true, true), InlineData(true, false, true), + InlineData(true, true, true)] public virtual Task Can_add_and_remove_a_new_relationship_shared_with_payload(bool modifyLeft, bool modifyRight, bool useJoin) { var leftId = -1; @@ -5541,15 +5322,9 @@ public virtual Task Can_add_and_remove_a_new_relationship_shared_with_payload(bo }); } - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(false, true, false)] - [InlineData(true, false, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(false, true, true)] - [InlineData(true, false, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(false, true, false), InlineData(true, false, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(false, true, true), InlineData(true, false, true), + InlineData(true, true, true)] public virtual Task Can_add_and_remove_a_new_relationship_shared(bool modifyLeft, bool modifyRight, bool useJoin) { var leftId = -1; @@ -5630,19 +5405,11 @@ public virtual Task Can_add_and_remove_a_new_relationship_shared(bool modifyLeft }); } - [ConditionalTheory] - [InlineData(false, false, false, false)] - [InlineData(false, true, false, false)] - [InlineData(true, false, false, false)] - [InlineData(true, true, false, false)] - [InlineData(false, false, true, false)] - [InlineData(false, true, true, false)] - [InlineData(true, false, true, false)] - [InlineData(true, true, true, false)] - [InlineData(false, false, true, true)] - [InlineData(false, true, true, true)] - [InlineData(true, false, true, true)] - [InlineData(true, true, true, true)] + [ConditionalTheory, InlineData(false, false, false, false), InlineData(false, true, false, false), + InlineData(true, false, false, false), InlineData(true, true, false, false), InlineData(false, false, true, false), + InlineData(false, true, true, false), InlineData(true, false, true, false), InlineData(true, true, true, false), + InlineData(false, false, true, true), InlineData(false, true, true, true), InlineData(true, false, true, true), + InlineData(true, true, true, true)] public virtual Task Can_add_and_remove_a_new_relationship_with_payload( bool modifyLeft, bool modifyRight, @@ -5679,18 +5446,16 @@ public virtual Task Can_add_and_remove_a_new_relationship_with_payload( ? new JoinOneToThreePayloadFull { One = left, Three = right } : new JoinOneToThreePayloadFull { OneId = leftId, ThreeId = rightId } : useNavs - ? context.CreateProxy( - e => - { - e.One = left; - e.Three = right; - }) - : context.CreateProxy( - e => - { - e.OneId = leftId; - e.ThreeId = rightId; - })); + ? context.CreateProxy(e => + { + e.One = left; + e.Three = right; + }) + : context.CreateProxy(e => + { + e.OneId = leftId; + e.ThreeId = rightId; + })); } else { @@ -5751,11 +5516,7 @@ public virtual Task Can_add_and_remove_a_new_relationship_with_payload( }); } - [ConditionalTheory] - [InlineData(false, false)] - [InlineData(false, true)] - [InlineData(true, false)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(false, true), InlineData(true, false), InlineData(true, true)] public virtual async Task Can_replace_dependent_with_many_to_many(bool createNewCollection, bool async) { var principalKey = 0; @@ -5855,9 +5616,9 @@ static void ValidateFixup(DbContext context, EntityOne principal, EntityTwo left Assert.Same(rightEntity, leftEntity.ThreeSkipFull.Single()); Assert.Same(leftEntity, rightEntity.TwoSkipFull.Single()); - VerifyRelationshipSnapshots(context, new[] { principal }); - VerifyRelationshipSnapshots(context, new[] { leftEntity }); - VerifyRelationshipSnapshots(context, new[] { rightEntity }); + VerifyRelationshipSnapshots(context, [principal]); + VerifyRelationshipSnapshots(context, [leftEntity]); + VerifyRelationshipSnapshots(context, [rightEntity]); } } @@ -5967,11 +5728,10 @@ public override ManyToManyContext CreateContext() } public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - w => w.Ignore( - CoreEventId.MappedEntityTypeIgnoredWarning, - CoreEventId.MappedPropertyIgnoredWarning, - CoreEventId.MappedNavigationIgnoredWarning)); + => base.AddOptions(builder).ConfigureWarnings(w => w.Ignore( + CoreEventId.MappedEntityTypeIgnoredWarning, + CoreEventId.MappedPropertyIgnoredWarning, + CoreEventId.MappedNavigationIgnoredWarning)); protected override string StoreName => "ManyToManyTracking"; diff --git a/test/EFCore.Specification.Tests/MaterializationInterceptionTestBase.cs b/test/EFCore.Specification.Tests/MaterializationInterceptionTestBase.cs index aed7059b329..91853555604 100644 --- a/test/EFCore.Specification.Tests/MaterializationInterceptionTestBase.cs +++ b/test/EFCore.Specification.Tests/MaterializationInterceptionTestBase.cs @@ -3,14 +3,14 @@ namespace Microsoft.EntityFrameworkCore; -public abstract class MaterializationInterceptionTestBase(NonSharedFixture fixture) : SingletonInterceptorsTestBase(fixture) +public abstract class MaterializationInterceptionTestBase(NonSharedFixture fixture) + : SingletonInterceptorsTestBase(fixture) where TContext : SingletonInterceptorsTestBase.LibraryContext { protected override string StoreName => "MaterializationInterception"; - [ConditionalTheory] - [ClassData(typeof(DataGenerator))] + [ConditionalTheory, ClassData(typeof(DataGenerator))] public virtual async Task Binding_interceptors_are_used_by_queries(bool inject, bool usePooling) { var interceptors = new[] @@ -35,8 +35,7 @@ public virtual async Task Binding_interceptors_are_used_by_queries(bool inject, Assert.All(interceptors, i => Assert.Equal(1, i.CalledCount)); } - [ConditionalTheory] - [ClassData(typeof(DataGenerator))] + [ConditionalTheory, ClassData(typeof(DataGenerator))] public virtual async Task Binding_interceptors_are_used_when_creating_instances(bool inject, bool usePooling) { var interceptors = new[] @@ -57,8 +56,7 @@ public virtual async Task Binding_interceptors_are_used_when_creating_instances( Assert.All(interceptors, i => Assert.Equal(1, i.CalledCount)); } - [ConditionalTheory] - [ClassData(typeof(DataGenerator))] + [ConditionalTheory, ClassData(typeof(DataGenerator))] public virtual async Task Intercept_query_materialization_for_empty_constructor(bool inject, bool usePooling) { var creatingInstanceCount = 0; @@ -72,60 +70,59 @@ public virtual async Task Intercept_query_materialization_for_empty_constructor( var interceptors = new[] { - new ValidatingMaterializationInterceptor( - (data, instance, method) => + new ValidatingMaterializationInterceptor((data, instance, method) => + { + Assert.Same(context, data.Context); + Assert.Same(data.Context.Model.FindEntityType(typeof(Book)), data.EntityType); + Assert.Equal(QueryTrackingBehavior.TrackAll, data.QueryTrackingBehavior); + + var idProperty = data.EntityType.FindProperty(nameof(Book.Id))!; + var id = data.GetPropertyValue(nameof(Book.Id))!; + Assert.Equal(id, data.GetPropertyValue(nameof(Book.Id))); + Assert.Equal(id, data.GetPropertyValue(idProperty)); + Assert.Equal(id, data.GetPropertyValue(idProperty)); + ids.Add(id); + + var titleProperty = data.EntityType.FindProperty(nameof(Book.Title))!; + var title = data.GetPropertyValue(nameof(Book.Title)); + Assert.Equal(title, data.GetPropertyValue(nameof(Book.Title))); + Assert.Equal(title, data.GetPropertyValue(titleProperty)); + Assert.Equal(title, data.GetPropertyValue(titleProperty)); + titles.Add(title); + + var authorProperty = data.EntityType.FindProperty("Author")!; + var author = data.GetPropertyValue("Author"); + Assert.Equal(author, data.GetPropertyValue("Author")); + Assert.Equal(author, data.GetPropertyValue(authorProperty)); + Assert.Equal(author, data.GetPropertyValue(authorProperty)); + authors.Add(author); + + switch (method) { - Assert.Same(context, data.Context); - Assert.Same(data.Context.Model.FindEntityType(typeof(Book)), data.EntityType); - Assert.Equal(QueryTrackingBehavior.TrackAll, data.QueryTrackingBehavior); - - var idProperty = data.EntityType.FindProperty(nameof(Book.Id))!; - var id = data.GetPropertyValue(nameof(Book.Id))!; - Assert.Equal(id, data.GetPropertyValue(nameof(Book.Id))); - Assert.Equal(id, data.GetPropertyValue(idProperty)); - Assert.Equal(id, data.GetPropertyValue(idProperty)); - ids.Add(id); - - var titleProperty = data.EntityType.FindProperty(nameof(Book.Title))!; - var title = data.GetPropertyValue(nameof(Book.Title)); - Assert.Equal(title, data.GetPropertyValue(nameof(Book.Title))); - Assert.Equal(title, data.GetPropertyValue(titleProperty)); - Assert.Equal(title, data.GetPropertyValue(titleProperty)); - titles.Add(title); - - var authorProperty = data.EntityType.FindProperty("Author")!; - var author = data.GetPropertyValue("Author"); - Assert.Equal(author, data.GetPropertyValue("Author")); - Assert.Equal(author, data.GetPropertyValue(authorProperty)); - Assert.Equal(author, data.GetPropertyValue(authorProperty)); - authors.Add(author); - - switch (method) - { - case nameof(IMaterializationInterceptor.CreatingInstance): - creatingInstanceCount++; - Assert.Null(instance); - break; - case nameof(IMaterializationInterceptor.CreatedInstance): - createdInstanceCount++; - Assert.IsType(instance); - Assert.Equal(Guid.Empty, ((Book)instance!).Id); - Assert.Null(((Book)instance!).Title); - break; - case nameof(IMaterializationInterceptor.InitializingInstance): - initializingInstanceCount++; - Assert.IsType(instance); - Assert.Equal(Guid.Empty, ((Book)instance!).Id); - Assert.Null(((Book)instance!).Title); - break; - case nameof(IMaterializationInterceptor.InitializedInstance): - initializedInstanceCount++; - Assert.IsType(instance); - Assert.Equal(id, ((Book)instance!).Id); - Assert.Equal(title, ((Book)instance!).Title); - break; - } - }) + case nameof(IMaterializationInterceptor.CreatingInstance): + creatingInstanceCount++; + Assert.Null(instance); + break; + case nameof(IMaterializationInterceptor.CreatedInstance): + createdInstanceCount++; + Assert.IsType(instance); + Assert.Equal(Guid.Empty, ((Book)instance!).Id); + Assert.Null(((Book)instance!).Title); + break; + case nameof(IMaterializationInterceptor.InitializingInstance): + initializingInstanceCount++; + Assert.IsType(instance); + Assert.Equal(Guid.Empty, ((Book)instance!).Id); + Assert.Null(((Book)instance!).Title); + break; + case nameof(IMaterializationInterceptor.InitializedInstance): + initializedInstanceCount++; + Assert.IsType(instance); + Assert.Equal(id, ((Book)instance!).Id); + Assert.Equal(title, ((Book)instance!).Title); + break; + } + }) }; using (context = await CreateContext(interceptors, inject, usePooling)) @@ -165,8 +162,7 @@ public virtual async Task Intercept_query_materialization_for_empty_constructor( private static int _id = 1; - [ConditionalTheory] // Issue #30244 - [ClassData(typeof(DataGenerator))] + [ConditionalTheory, ClassData(typeof(DataGenerator))] // Issue #30244 public virtual async Task Intercept_query_materialization_with_owned_types(bool async, bool usePooling) { var creatingInstanceCounts = new Dictionary(); @@ -177,38 +173,37 @@ public virtual async Task Intercept_query_materialization_with_owned_types(bool var interceptors = new[] { - new ValidatingMaterializationInterceptor( - (data, instance, method) => + new ValidatingMaterializationInterceptor((data, instance, method) => + { + Assert.Same(context, data.Context); + Assert.Equal(QueryTrackingBehavior.TrackAll, data.QueryTrackingBehavior); + + int count; + var clrType = data.EntityType.ClrType; + switch (method) { - Assert.Same(context, data.Context); - Assert.Equal(QueryTrackingBehavior.TrackAll, data.QueryTrackingBehavior); - - int count; - var clrType = data.EntityType.ClrType; - switch (method) - { - case nameof(IMaterializationInterceptor.CreatingInstance): - count = creatingInstanceCounts.GetOrAddNew(clrType); - creatingInstanceCounts[clrType] = count + 1; - Assert.Null(instance); - break; - case nameof(IMaterializationInterceptor.CreatedInstance): - count = createdInstanceCounts.GetOrAddNew(clrType); - createdInstanceCounts[clrType] = count + 1; - Assert.Same(clrType, instance!.GetType()); - break; - case nameof(IMaterializationInterceptor.InitializingInstance): - count = initializingInstanceCounts.GetOrAddNew(clrType); - initializingInstanceCounts[clrType] = count + 1; - Assert.Same(clrType, instance!.GetType()); - break; - case nameof(IMaterializationInterceptor.InitializedInstance): - count = initializedInstanceCounts.GetOrAddNew(clrType); - initializedInstanceCounts[clrType] = count + 1; - Assert.Same(clrType, instance!.GetType()); - break; - } - }) + case nameof(IMaterializationInterceptor.CreatingInstance): + count = creatingInstanceCounts.GetOrAddNew(clrType); + creatingInstanceCounts[clrType] = count + 1; + Assert.Null(instance); + break; + case nameof(IMaterializationInterceptor.CreatedInstance): + count = createdInstanceCounts.GetOrAddNew(clrType); + createdInstanceCounts[clrType] = count + 1; + Assert.Same(clrType, instance!.GetType()); + break; + case nameof(IMaterializationInterceptor.InitializingInstance): + count = initializingInstanceCounts.GetOrAddNew(clrType); + initializingInstanceCounts[clrType] = count + 1; + Assert.Same(clrType, instance!.GetType()); + break; + case nameof(IMaterializationInterceptor.InitializedInstance): + count = initializedInstanceCounts.GetOrAddNew(clrType); + initializedInstanceCounts[clrType] = count + 1; + Assert.Same(clrType, instance!.GetType()); + break; + } + }) }; using (context = await CreateContext(interceptors, inject: true, usePooling)) @@ -253,8 +248,7 @@ public virtual async Task Intercept_query_materialization_with_owned_types(bool } } - [ConditionalTheory] // Issue #31365 - [ClassData(typeof(DataGenerator))] + [ConditionalTheory, ClassData(typeof(DataGenerator))] // Issue #31365 public virtual async Task Intercept_query_materialization_with_owned_types_projecting_collection(bool async, bool usePooling) { var creatingInstanceCounts = new Dictionary(); @@ -265,38 +259,37 @@ public virtual async Task Intercept_query_materialization_with_owned_types_proje var interceptors = new[] { - new ValidatingMaterializationInterceptor( - (data, instance, method) => + new ValidatingMaterializationInterceptor((data, instance, method) => + { + Assert.Same(context, data.Context); + Assert.Equal(QueryTrackingBehavior.NoTracking, data.QueryTrackingBehavior); + + int count; + var clrType = data.EntityType.ClrType; + switch (method) { - Assert.Same(context, data.Context); - Assert.Equal(QueryTrackingBehavior.NoTracking, data.QueryTrackingBehavior); - - int count; - var clrType = data.EntityType.ClrType; - switch (method) - { - case nameof(IMaterializationInterceptor.CreatingInstance): - count = creatingInstanceCounts.GetOrAddNew(clrType); - creatingInstanceCounts[clrType] = count + 1; - Assert.Null(instance); - break; - case nameof(IMaterializationInterceptor.CreatedInstance): - count = createdInstanceCounts.GetOrAddNew(clrType); - createdInstanceCounts[clrType] = count + 1; - Assert.Same(clrType, instance!.GetType()); - break; - case nameof(IMaterializationInterceptor.InitializingInstance): - count = initializingInstanceCounts.GetOrAddNew(clrType); - initializingInstanceCounts[clrType] = count + 1; - Assert.Same(clrType, instance!.GetType()); - break; - case nameof(IMaterializationInterceptor.InitializedInstance): - count = initializedInstanceCounts.GetOrAddNew(clrType); - initializedInstanceCounts[clrType] = count + 1; - Assert.Same(clrType, instance!.GetType()); - break; - } - }) + case nameof(IMaterializationInterceptor.CreatingInstance): + count = creatingInstanceCounts.GetOrAddNew(clrType); + creatingInstanceCounts[clrType] = count + 1; + Assert.Null(instance); + break; + case nameof(IMaterializationInterceptor.CreatedInstance): + count = createdInstanceCounts.GetOrAddNew(clrType); + createdInstanceCounts[clrType] = count + 1; + Assert.Same(clrType, instance!.GetType()); + break; + case nameof(IMaterializationInterceptor.InitializingInstance): + count = initializingInstanceCounts.GetOrAddNew(clrType); + initializingInstanceCounts[clrType] = count + 1; + Assert.Same(clrType, instance!.GetType()); + break; + case nameof(IMaterializationInterceptor.InitializedInstance): + count = initializedInstanceCounts.GetOrAddNew(clrType); + initializedInstanceCounts[clrType] = count + 1; + Assert.Same(clrType, instance!.GetType()); + break; + } + }) }; using (context = await CreateContext(interceptors, inject: true, usePooling)) @@ -343,8 +336,7 @@ public virtual async Task Intercept_query_materialization_with_owned_types_proje } } - [ConditionalTheory] - [ClassData(typeof(DataGenerator))] + [ConditionalTheory, ClassData(typeof(DataGenerator))] public virtual async Task Intercept_query_materialization_for_full_constructor(bool inject, bool usePooling) { var creatingInstanceCount = 0; @@ -358,60 +350,59 @@ public virtual async Task Intercept_query_materialization_for_full_constructor(b var interceptors = new[] { - new ValidatingMaterializationInterceptor( - (data, instance, method) => + new ValidatingMaterializationInterceptor((data, instance, method) => + { + Assert.Same(context, data.Context); + Assert.Same(data.Context.Model.FindEntityType(typeof(Pamphlet)), data.EntityType); + Assert.Equal(QueryTrackingBehavior.TrackAll, data.QueryTrackingBehavior); + + var idProperty = data.EntityType.FindProperty(nameof(Pamphlet.Id))!; + var id = data.GetPropertyValue(nameof(Pamphlet.Id))!; + Assert.Equal(id, data.GetPropertyValue(nameof(Pamphlet.Id))); + Assert.Equal(id, data.GetPropertyValue(idProperty)); + Assert.Equal(id, data.GetPropertyValue(idProperty)); + ids.Add(id); + + var titleProperty = data.EntityType.FindProperty(nameof(Pamphlet.Title))!; + var title = data.GetPropertyValue(nameof(Pamphlet.Title)); + Assert.Equal(title, data.GetPropertyValue(nameof(Pamphlet.Title))); + Assert.Equal(title, data.GetPropertyValue(titleProperty)); + Assert.Equal(title, data.GetPropertyValue(titleProperty)); + titles.Add(title); + + var authorProperty = data.EntityType.FindProperty("Author")!; + var author = data.GetPropertyValue("Author"); + Assert.Equal(author, data.GetPropertyValue("Author")); + Assert.Equal(author, data.GetPropertyValue(authorProperty)); + Assert.Equal(author, data.GetPropertyValue(authorProperty)); + authors.Add(author); + + switch (method) { - Assert.Same(context, data.Context); - Assert.Same(data.Context.Model.FindEntityType(typeof(Pamphlet)), data.EntityType); - Assert.Equal(QueryTrackingBehavior.TrackAll, data.QueryTrackingBehavior); - - var idProperty = data.EntityType.FindProperty(nameof(Pamphlet.Id))!; - var id = data.GetPropertyValue(nameof(Pamphlet.Id))!; - Assert.Equal(id, data.GetPropertyValue(nameof(Pamphlet.Id))); - Assert.Equal(id, data.GetPropertyValue(idProperty)); - Assert.Equal(id, data.GetPropertyValue(idProperty)); - ids.Add(id); - - var titleProperty = data.EntityType.FindProperty(nameof(Pamphlet.Title))!; - var title = data.GetPropertyValue(nameof(Pamphlet.Title)); - Assert.Equal(title, data.GetPropertyValue(nameof(Pamphlet.Title))); - Assert.Equal(title, data.GetPropertyValue(titleProperty)); - Assert.Equal(title, data.GetPropertyValue(titleProperty)); - titles.Add(title); - - var authorProperty = data.EntityType.FindProperty("Author")!; - var author = data.GetPropertyValue("Author"); - Assert.Equal(author, data.GetPropertyValue("Author")); - Assert.Equal(author, data.GetPropertyValue(authorProperty)); - Assert.Equal(author, data.GetPropertyValue(authorProperty)); - authors.Add(author); - - switch (method) - { - case nameof(IMaterializationInterceptor.CreatingInstance): - creatingInstanceCount++; - Assert.Null(instance); - break; - case nameof(IMaterializationInterceptor.CreatedInstance): - createdInstanceCount++; - Assert.IsType(instance); - Assert.Equal(id, ((Pamphlet)instance!).Id); - Assert.Equal(title, ((Pamphlet)instance!).Title); - break; - case nameof(IMaterializationInterceptor.InitializingInstance): - initializingInstanceCount++; - Assert.IsType(instance); - Assert.Equal(id, ((Pamphlet)instance!).Id); - Assert.Equal(title, ((Pamphlet)instance!).Title); - break; - case nameof(IMaterializationInterceptor.InitializedInstance): - initializedInstanceCount++; - Assert.IsType(instance); - Assert.Equal(id, ((Pamphlet)instance!).Id); - Assert.Equal(title, ((Pamphlet)instance!).Title); - break; - } - }) + case nameof(IMaterializationInterceptor.CreatingInstance): + creatingInstanceCount++; + Assert.Null(instance); + break; + case nameof(IMaterializationInterceptor.CreatedInstance): + createdInstanceCount++; + Assert.IsType(instance); + Assert.Equal(id, ((Pamphlet)instance!).Id); + Assert.Equal(title, ((Pamphlet)instance!).Title); + break; + case nameof(IMaterializationInterceptor.InitializingInstance): + initializingInstanceCount++; + Assert.IsType(instance); + Assert.Equal(id, ((Pamphlet)instance!).Id); + Assert.Equal(title, ((Pamphlet)instance!).Title); + break; + case nameof(IMaterializationInterceptor.InitializedInstance): + initializedInstanceCount++; + Assert.IsType(instance); + Assert.Equal(id, ((Pamphlet)instance!).Id); + Assert.Equal(title, ((Pamphlet)instance!).Title); + break; + } + }) }; using (context = await CreateContext(interceptors, inject, usePooling)) @@ -446,8 +437,7 @@ public virtual async Task Intercept_query_materialization_for_full_constructor(b } } - [ConditionalTheory] - [ClassData(typeof(DataGenerator))] + [ConditionalTheory, ClassData(typeof(DataGenerator))] public virtual async Task Multiple_materialization_interceptors_can_be_used(bool inject, bool usePooling) { var interceptors = new ISingletonInterceptor[] diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ComplexCollections.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ComplexCollections.cs index 63a12cc35ce..b81c0101dd1 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ComplexCollections.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ComplexCollections.cs @@ -14,7 +14,8 @@ public abstract partial class ModelBuilderTest public abstract class ComplexCollectionTestBase(ModelBuilderFixtureBase fixture) : ModelBuilderTestBase(fixture) { // This is used for common configuration that would be applied for all complex collections - protected virtual TestComplexCollectionBuilder ConfigureComplexCollection(TestComplexCollectionBuilder builder) + protected virtual TestComplexCollectionBuilder ConfigureComplexCollection( + TestComplexCollectionBuilder builder) where TElement : notnull => builder; @@ -23,11 +24,12 @@ public virtual void Can_set_complex_property_annotation() { var modelBuilder = CreateModelBuilder(); - var complexCollectionBuilder = ConfigureComplexCollection(modelBuilder - .Ignore() - .Entity() - .Ignore(e => e.Customer) - .ComplexCollection(e => e.Customers)) + var complexCollectionBuilder = ConfigureComplexCollection( + modelBuilder + .Ignore() + .Entity() + .Ignore(e => e.Customer) + .ComplexCollection(e => e.Customers)) .HasTypeAnnotation("foo", "bar") .HasPropertyAnnotation("foo2", "bar2") .Ignore(c => c.Details) @@ -56,12 +58,13 @@ public virtual void Can_set_property_annotation() { var modelBuilder = CreateModelBuilder(); - ConfigureComplexCollection(modelBuilder - .Ignore() - .Ignore() - .Entity() - .Ignore(e => e.Customer) - .ComplexCollection(e => e.Customers)) + ConfigureComplexCollection( + modelBuilder + .Ignore() + .Ignore() + .Entity() + .Ignore(e => e.Customer) + .ComplexCollection(e => e.Customers)) .Ignore(c => c.Details) .Ignore(c => c.Orders) .Property(c => c.Name).HasAnnotation("foo", "bar"); @@ -78,12 +81,13 @@ public virtual void Can_set_property_annotation_when_no_clr_property() { var modelBuilder = CreateModelBuilder(); - ConfigureComplexCollection(modelBuilder - .Ignore() - .Ignore() - .Entity() - .Ignore(e => e.Customer) - .ComplexCollection(e => e.Customers)) + ConfigureComplexCollection( + modelBuilder + .Ignore() + .Ignore() + .Entity() + .Ignore(e => e.Customer) + .ComplexCollection(e => e.Customers)) .Ignore(c => c.Details) .Ignore(c => c.Orders) .Property(Customer.NameProperty.Name).HasAnnotation("foo", "bar"); @@ -100,12 +104,13 @@ public virtual void Can_set_property_annotation_by_type() { var modelBuilder = CreateModelBuilder(c => c.Properties().HaveAnnotation("foo", "bar")); - ConfigureComplexCollection(modelBuilder - .Ignore() - .Ignore() - .Entity() - .Ignore(e => e.Customer) - .ComplexCollection(e => e.Customers)) + ConfigureComplexCollection( + modelBuilder + .Ignore() + .Ignore() + .Entity() + .Ignore(e => e.Customer) + .ComplexCollection(e => e.Customers)) .Ignore(c => c.Details) .Ignore(c => c.Orders) .Property(c => c.Name); @@ -405,7 +410,8 @@ public virtual void Properties_can_have_access_mode_set() var model = modelBuilder.FinalizeModel(); - var quarksProperty = model.FindEntityType(typeof(ComplexProperties))!.GetComplexProperties().Single(p => p.Name == nameof(ComplexProperties.QuarksCollection)); + var quarksProperty = model.FindEntityType(typeof(ComplexProperties))!.GetComplexProperties() + .Single(p => p.Name == nameof(ComplexProperties.QuarksCollection)); var quarksType = quarksProperty.ComplexType; Assert.Equal(PropertyAccessMode.FieldDuringConstruction, quarksProperty.GetPropertyAccessMode()); @@ -736,11 +742,10 @@ public virtual void Properties_can_have_value_converter_set() [ConditionalFact(Skip = "Issue #35613")] public virtual void Value_converter_configured_on_non_nullable_type_is_applied() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveConversion, CustomValueComparer>(); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveConversion, CustomValueComparer>(); + }); modelBuilder .Ignore() @@ -769,13 +774,12 @@ public virtual void Value_converter_configured_on_non_nullable_type_is_applied() [ConditionalFact(Skip = "Issue #35613")] public virtual void Value_converter_configured_on_nullable_type_overrides_non_nullable() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveConversion, CustomValueComparer>(); - c.Properties() - .HaveConversion, CustomValueComparer, CustomValueComparer>(); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveConversion, CustomValueComparer>(); + c.Properties() + .HaveConversion, CustomValueComparer, CustomValueComparer>(); + }); modelBuilder .Ignore() @@ -803,7 +807,6 @@ public virtual void Value_converter_configured_on_nullable_type_overrides_non_nu Assert.IsType>(wierd.GetProviderValueComparer()); } - [ConditionalFact] public virtual void Value_converter_type_is_checked() { @@ -820,9 +823,8 @@ public virtual void Value_converter_type_is_checked() ConfigureComplexCollection(b); Assert.Equal( CoreStrings.ConverterPropertyMismatch("string", "ComplexProperties.QuarksCollection#Quarks", "Up", "int"), - Assert.Throws( - () => b.Property(e => e.Up).HasConversion( - new StringToBytesConverter(Encoding.UTF8))).Message); + Assert.Throws(() => b.Property(e => e.Up).HasConversion( + new StringToBytesConverter(Encoding.UTF8))).Message); }); var model = modelBuilder.FinalizeModel(); @@ -906,12 +908,11 @@ protected virtual void Throws_for_incompatible_type() [ConditionalFact(Skip = "Issue #35613")] public virtual void Can_set_max_length_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveMaxLength(0); - c.Properties().HaveMaxLength(100); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveMaxLength(0); + c.Properties().HaveMaxLength(100); + }); modelBuilder .Ignore() @@ -977,12 +978,11 @@ public virtual void Can_set_sentinel_for_properties() [ConditionalFact(Skip = "Issue #35613")] public virtual void Can_set_sentinel_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveSentinel(-1); - c.Properties().HaveSentinel("100"); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveSentinel(-1); + c.Properties().HaveSentinel("100"); + }); modelBuilder .Ignore() @@ -1014,12 +1014,11 @@ public virtual void Can_set_sentinel_for_property_type() [ConditionalFact(Skip = "Issue #35613")] public virtual void Can_set_unbounded_max_length_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveMaxLength(0); - c.Properties().HaveMaxLength(-1); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveMaxLength(0); + c.Properties().HaveMaxLength(-1); + }); modelBuilder .Ignore() @@ -1051,12 +1050,11 @@ public virtual void Can_set_unbounded_max_length_for_property_type() [ConditionalFact(Skip = "Issue #35613")] public virtual void Can_set_precision_and_scale_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HavePrecision(1, 0); - c.Properties().HavePrecision(100, 10); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HavePrecision(1, 0); + c.Properties().HavePrecision(100, 10); + }); modelBuilder .Ignore() @@ -1178,13 +1176,13 @@ public virtual void Throws_for_value_generator_that_cannot_be_constructed() Assert.Equal( CoreStrings.CannotCreateValueGenerator(nameof(BadCustomValueGenerator1), "HasValueGenerator"), - Assert.Throws( - () => complexType.FindProperty("Up").GetValueGeneratorFactory()(null, null)).Message); + Assert.Throws(() => complexType.FindProperty("Up").GetValueGeneratorFactory()(null, null)) + .Message); Assert.Equal( CoreStrings.CannotCreateValueGenerator(nameof(BadCustomValueGenerator2), "HasValueGenerator"), - Assert.Throws( - () => complexType.FindProperty("Down").GetValueGeneratorFactory()(null, null)).Message); + Assert.Throws(() => complexType.FindProperty("Down").GetValueGeneratorFactory()(null, null)) + .Message); } #pragma warning disable CS9113 // Parameter 'foo' is unread @@ -1237,12 +1235,11 @@ public virtual void Can_set_unicode_for_properties() [ConditionalFact(Skip = "Issue #35613")] public virtual void Can_set_unicode_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().AreUnicode(); - c.Properties().AreUnicode(false); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().AreUnicode(); + c.Properties().AreUnicode(false); + }); modelBuilder .Ignore() @@ -1354,23 +1351,22 @@ public virtual void PrimitiveCollectionBuilder_methods_can_be_chained() .Entity() .ComplexCollection(e => e.QuarksCollection) .PrimitiveCollection>("UpCollection") - .ElementType( - t => t - .HasAnnotation("B", "C") - .HasConversion(typeof(long)) - .HasConversion(new CastingConverter()) - .HasConversion(typeof(long), typeof(CustomValueComparer)) - .HasConversion(typeof(long), new CustomValueComparer()) - .HasConversion(new CastingConverter()) - .HasConversion(new CastingConverter(), new CustomValueComparer()) - .HasConversion() - .HasConversion(new CustomValueComparer()) - .HasConversion>() - .HasMaxLength(2) - .HasPrecision(1) - .HasPrecision(1, 2) - .IsRequired() - .IsUnicode()) + .ElementType(t => t + .HasAnnotation("B", "C") + .HasConversion(typeof(long)) + .HasConversion(new CastingConverter()) + .HasConversion(typeof(long), typeof(CustomValueComparer)) + .HasConversion(typeof(long), new CustomValueComparer()) + .HasConversion(new CastingConverter()) + .HasConversion(new CastingConverter(), new CustomValueComparer()) + .HasConversion() + .HasConversion(new CustomValueComparer()) + .HasConversion>() + .HasMaxLength(2) + .HasPrecision(1) + .HasPrecision(1, 2) + .IsRequired() + .IsUnicode()) .IsRequired() .HasAnnotation("A", "V") .IsConcurrencyToken() diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ComplexType.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ComplexType.cs index 1b8d6063d4c..fcd5eaf7c39 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ComplexType.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ComplexType.cs @@ -825,13 +825,12 @@ private class ExpandoObjectComparer() : ValueComparer((v1, v2) => [ConditionalFact] public virtual void Properties_can_have_value_converter_configured_by_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties(typeof(IWrapped<>)).AreUnicode(false); - c.Properties().HaveMaxLength(20); - c.Properties().HaveConversion(typeof(WrappedStringToStringConverter)); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties(typeof(IWrapped<>)).AreUnicode(false); + c.Properties().HaveMaxLength(20); + c.Properties().HaveConversion(typeof(WrappedStringToStringConverter)); + }); modelBuilder .Ignore() @@ -852,11 +851,10 @@ public virtual void Properties_can_have_value_converter_configured_by_type() [ConditionalFact(Skip = "Issue #35613")] public virtual void Value_converter_configured_on_non_nullable_type_is_applied() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveConversion, CustomValueComparer>(); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveConversion, CustomValueComparer>(); + }); modelBuilder .Ignore() @@ -884,13 +882,12 @@ public virtual void Value_converter_configured_on_non_nullable_type_is_applied() [ConditionalFact(Skip = "Issue #35613")] public virtual void Value_converter_configured_on_nullable_type_overrides_non_nullable() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveConversion, CustomValueComparer>(); - c.Properties() - .HaveConversion, CustomValueComparer, CustomValueComparer>(); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveConversion, CustomValueComparer>(); + c.Properties() + .HaveConversion, CustomValueComparer, CustomValueComparer>(); + }); modelBuilder .Ignore() @@ -935,9 +932,8 @@ public virtual void Value_converter_type_is_checked() { Assert.Equal( CoreStrings.ConverterPropertyMismatch("string", "ComplexProperties.Quarks#Quarks", "Up", "int"), - Assert.Throws( - () => b.Property(e => e.Up).HasConversion( - new StringToBytesConverter(Encoding.UTF8))).Message); + Assert.Throws(() => b.Property(e => e.Up).HasConversion( + new StringToBytesConverter(Encoding.UTF8))).Message); }); var model = modelBuilder.FinalizeModel(); @@ -1117,12 +1113,11 @@ public virtual void Can_set_max_length_for_properties() [ConditionalFact(Skip = "Issue #35613")] public virtual void Can_set_max_length_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveMaxLength(0); - c.Properties().HaveMaxLength(100); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveMaxLength(0); + c.Properties().HaveMaxLength(100); + }); modelBuilder .Ignore() @@ -1186,12 +1181,11 @@ public virtual void Can_set_sentinel_for_properties() [ConditionalFact(Skip = "Issue #35613")] public virtual void Can_set_sentinel_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveSentinel(-1); - c.Properties().HaveSentinel("100"); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveSentinel(-1); + c.Properties().HaveSentinel("100"); + }); modelBuilder .Ignore() @@ -1222,12 +1216,11 @@ public virtual void Can_set_sentinel_for_property_type() [ConditionalFact(Skip = "Issue #35613")] public virtual void Can_set_unbounded_max_length_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveMaxLength(0); - c.Properties().HaveMaxLength(-1); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveMaxLength(0); + c.Properties().HaveMaxLength(-1); + }); modelBuilder .Ignore() @@ -1298,12 +1291,11 @@ public virtual void Can_set_precision_and_scale_for_properties() [ConditionalFact(Skip = "Issue #35613")] public virtual void Can_set_precision_and_scale_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HavePrecision(1, 0); - c.Properties().HavePrecision(100, 10); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HavePrecision(1, 0); + c.Properties().HavePrecision(100, 10); + }); modelBuilder .Ignore() @@ -1423,13 +1415,13 @@ public virtual void Throws_for_value_generator_that_cannot_be_constructed() Assert.Equal( CoreStrings.CannotCreateValueGenerator(nameof(BadCustomValueGenerator1), "HasValueGenerator"), - Assert.Throws( - () => complexType.FindProperty("Up").GetValueGeneratorFactory()(null, null)).Message); + Assert.Throws(() => complexType.FindProperty("Up").GetValueGeneratorFactory()(null, null)) + .Message); Assert.Equal( CoreStrings.CannotCreateValueGenerator(nameof(BadCustomValueGenerator2), "HasValueGenerator"), - Assert.Throws( - () => complexType.FindProperty("Down").GetValueGeneratorFactory()(null, null)).Message); + Assert.Throws(() => complexType.FindProperty("Down").GetValueGeneratorFactory()(null, null)) + .Message); } #pragma warning disable CS9113 // Parameter 'foo' is unread @@ -1481,12 +1473,11 @@ public virtual void Can_set_unicode_for_properties() [ConditionalFact(Skip = "Issue #35613")] public virtual void Can_set_unicode_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().AreUnicode(); - c.Properties().AreUnicode(false); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().AreUnicode(); + c.Properties().AreUnicode(false); + }); modelBuilder .Ignore() @@ -1588,14 +1579,13 @@ public virtual void Complex_properties_not_discovered_by_convention() .ComplexProperty(e => e.Customer); modelBuilder - .Entity( - b => - { - b.Ignore(e => e.Tuple); - b.Ignore(e => e.Tuples); - b.ComplexProperty(e => e.Label); - b.ComplexProperty(e => e.OldLabel); - }); + .Entity(b => + { + b.Ignore(e => e.Tuple); + b.Ignore(e => e.Tuples); + b.ComplexProperty(e => e.Label); + b.ComplexProperty(e => e.OldLabel); + }); var model = modelBuilder.FinalizeModel(); AssertEqual(modelBuilder.Model, model); @@ -1653,7 +1643,8 @@ public virtual void Complex_properties_can_be_configured_by_type() var model = modelBuilder.FinalizeModel(); - Assert.All(model.FindEntityType(typeof(ComplexProperties)).GetComplexProperties(), + Assert.All( + model.FindEntityType(typeof(ComplexProperties)).GetComplexProperties(), p => Assert.Equal(typeof(Customer), p.ComplexType.ClrType)); } @@ -1831,6 +1822,7 @@ public virtual void Can_add_shadow_primitive_collections_when_they_have_been_ign var complexType = model.FindEntityType(typeof(ComplexProperties))!.GetComplexProperties().Single().ComplexType; Assert.NotNull(complexType.FindProperty("Shadow")); } + [ConditionalFact(Skip = "Issue #35613")] public virtual void Primitive_collections_can_be_made_required() { @@ -2197,23 +2189,22 @@ public virtual void PrimitiveCollectionBuilder_methods_can_be_chained() .Entity() .ComplexProperty(e => e.CollectionQuarks) .PrimitiveCollection(e => e.Up) - .ElementType( - t => t - .HasAnnotation("B", "C") - .HasConversion(typeof(long)) - .HasConversion(new CastingConverter()) - .HasConversion(typeof(long), typeof(CustomValueComparer)) - .HasConversion(typeof(long), new CustomValueComparer()) - .HasConversion(new CastingConverter()) - .HasConversion(new CastingConverter(), new CustomValueComparer()) - .HasConversion() - .HasConversion(new CustomValueComparer()) - .HasConversion>() - .HasMaxLength(2) - .HasPrecision(1) - .HasPrecision(1, 2) - .IsRequired() - .IsUnicode()) + .ElementType(t => t + .HasAnnotation("B", "C") + .HasConversion(typeof(long)) + .HasConversion(new CastingConverter()) + .HasConversion(typeof(long), typeof(CustomValueComparer)) + .HasConversion(typeof(long), new CustomValueComparer()) + .HasConversion(new CastingConverter()) + .HasConversion(new CastingConverter(), new CustomValueComparer()) + .HasConversion() + .HasConversion(new CustomValueComparer()) + .HasConversion>() + .HasMaxLength(2) + .HasPrecision(1) + .HasPrecision(1, 2) + .IsRequired() + .IsUnicode()) .IsRequired() .HasAnnotation("A", "V") .IsConcurrencyToken() diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.Generic.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.Generic.cs index b3ddcf9b4a2..3d1b91a5b9e 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.Generic.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.Generic.cs @@ -16,9 +16,8 @@ public override TestEntityTypeBuilder SharedTypeEntity(string public override TestModelBuilder Entity(Action> buildAction) { - ModelBuilder.Entity( - entityTypeBuilder => - buildAction(new GenericTestEntityTypeBuilder(entityTypeBuilder))); + ModelBuilder.Entity(entityTypeBuilder => + buildAction(new GenericTestEntityTypeBuilder(entityTypeBuilder))); return this; } @@ -156,7 +155,9 @@ public override TestEntityTypeBuilder ComplexProperty( public override TestComplexCollectionBuilder ComplexCollection(string propertyName) => Wrap(EntityTypeBuilder.ComplexCollection(propertyName)); - public override TestComplexCollectionBuilder ComplexCollection(string propertyName, string complexTypeName) + public override TestComplexCollectionBuilder ComplexCollection( + string propertyName, + string complexTypeName) => Wrap(EntityTypeBuilder.ComplexCollection(propertyName, complexTypeName)); public override TestComplexCollectionBuilder ComplexCollection( @@ -165,19 +166,23 @@ public override TestComplexCollectionBuilder ComplexCollection Wrap(EntityTypeBuilder.ComplexCollection(propertyExpression)); public override TestComplexCollectionBuilder ComplexCollection( - Expression?>> propertyExpression, string complexTypeName) + Expression?>> propertyExpression, + string complexTypeName) where TElement : default => Wrap(EntityTypeBuilder.ComplexCollection(propertyExpression, complexTypeName)); public override TestEntityTypeBuilder ComplexCollection( - string propertyName, Action> buildAction) + string propertyName, + Action> buildAction) { buildAction(Wrap(EntityTypeBuilder.ComplexCollection(propertyName))); return this; } public override TestEntityTypeBuilder ComplexCollection( - string propertyName, string complexTypeName, Action> buildAction) + string propertyName, + string complexTypeName, + Action> buildAction) { buildAction(Wrap(EntityTypeBuilder.ComplexCollection(propertyName, complexTypeName))); return this; @@ -193,7 +198,9 @@ public override TestEntityTypeBuilder ComplexCollection( } public override TestEntityTypeBuilder ComplexCollection( - Expression?>> propertyExpression, string complexTypeName, Action> buildAction) + Expression?>> propertyExpression, + string complexTypeName, + Action> buildAction) where TElement : default { buildAction(Wrap(EntityTypeBuilder.ComplexCollection(propertyExpression, complexTypeName))); @@ -415,7 +422,8 @@ protected virtual GenericTestComplexCollectionBuilder Wrap(ComplexCollecti where T : notnull => new(complexPropertyBuilder); - protected virtual GenericTestComplexTypePropertyBuilder Wrap(ComplexTypePropertyBuilder propertyBuilder) + protected virtual GenericTestComplexTypePropertyBuilder Wrap( + ComplexTypePropertyBuilder propertyBuilder) => new(propertyBuilder); protected virtual GenericTestComplexTypePrimitiveCollectionBuilder Wrap( @@ -494,7 +502,9 @@ public override TestComplexPropertyBuilder ComplexProperty( public override TestComplexCollectionBuilder ComplexCollection(string propertyName) => Wrap(PropertyBuilder.ComplexCollection(propertyName)); - public override TestComplexCollectionBuilder ComplexCollection(string propertyName, string complexTypeName) + public override TestComplexCollectionBuilder ComplexCollection( + string propertyName, + string complexTypeName) => Wrap(PropertyBuilder.ComplexCollection(propertyName, complexTypeName)); public override TestComplexCollectionBuilder ComplexCollection( @@ -503,26 +513,31 @@ public override TestComplexCollectionBuilder ComplexCollection Wrap(PropertyBuilder.ComplexCollection(propertyExpression)); public override TestComplexCollectionBuilder ComplexCollection( - Expression?>> propertyExpression, string complexTypeName) + Expression?>> propertyExpression, + string complexTypeName) where TElement : default => Wrap(PropertyBuilder.ComplexCollection(propertyExpression, complexTypeName)); public override TestComplexPropertyBuilder ComplexCollection( - string propertyName, Action> buildAction) + string propertyName, + Action> buildAction) { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyName))); return this; } public override TestComplexPropertyBuilder ComplexCollection( - string propertyName, string complexTypeName, Action> buildAction) + string propertyName, + string complexTypeName, + Action> buildAction) { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyName, complexTypeName))); return this; } public override TestComplexPropertyBuilder ComplexCollection( - Expression?>> propertyExpression, Action> buildAction) + Expression?>> propertyExpression, + Action> buildAction) where TElement : default { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyExpression))); @@ -530,7 +545,9 @@ public override TestComplexPropertyBuilder ComplexCollection } public override TestComplexPropertyBuilder ComplexCollection( - Expression?>> propertyExpression, string complexTypeName, Action> buildAction) + Expression?>> propertyExpression, + string complexTypeName, + Action> buildAction) where TElement : default { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyExpression, complexTypeName))); @@ -555,11 +572,13 @@ public override TestComplexPropertyBuilder UsePropertyAccessMode(Prope public override TestComplexPropertyBuilder UseDefaultPropertyAccessMode(PropertyAccessMode propertyAccessMode) => Wrap(PropertyBuilder.UseDefaultPropertyAccessMode(propertyAccessMode)); - public override TestComplexTypeDiscriminatorBuilder HasDiscriminator(Expression> propertyExpression) + public override TestComplexTypeDiscriminatorBuilder HasDiscriminator( + Expression> propertyExpression) => new GenericTestComplexTypeDiscriminatorBuilder(PropertyBuilder.HasDiscriminator(propertyExpression)); public override TestComplexTypeDiscriminatorBuilder HasDiscriminator(string propertyName) - => new GenericTestComplexTypeDiscriminatorBuilder(PropertyBuilder.HasDiscriminator(propertyName)); + => new GenericTestComplexTypeDiscriminatorBuilder( + PropertyBuilder.HasDiscriminator(propertyName)); public override TestComplexPropertyBuilder HasNoDiscriminator() => Wrap(PropertyBuilder.HasNoDiscriminator()); @@ -586,10 +605,12 @@ protected virtual GenericTestComplexPropertyBuilder Wrap(ComplexPropertyBu where T : notnull => new(complexPropertyBuilder); - protected virtual GenericTestComplexTypePropertyBuilder Wrap(ComplexTypePropertyBuilder propertyBuilder) + protected virtual GenericTestComplexTypePropertyBuilder Wrap( + ComplexTypePropertyBuilder propertyBuilder) => new(propertyBuilder); - protected virtual GenericTestComplexCollectionTypePropertyBuilder Wrap(ComplexCollectionTypePropertyBuilder propertyBuilder) + protected virtual GenericTestComplexCollectionTypePropertyBuilder Wrap( + ComplexCollectionTypePropertyBuilder propertyBuilder) => new(propertyBuilder); protected virtual GenericTestComplexTypePrimitiveCollectionBuilder Wrap( @@ -668,7 +689,9 @@ public override TestComplexCollectionBuilder ComplexProperty ComplexCollection(string propertyName) => Wrap(PropertyBuilder.ComplexCollection(propertyName)); - public override TestComplexCollectionBuilder ComplexCollection(string propertyName, string complexTypeName) + public override TestComplexCollectionBuilder ComplexCollection( + string propertyName, + string complexTypeName) => Wrap(PropertyBuilder.ComplexCollection(propertyName, complexTypeName)); public override TestComplexCollectionBuilder ComplexCollection( @@ -677,26 +700,31 @@ public override TestComplexCollectionBuilder ComplexCollection Wrap(PropertyBuilder.ComplexCollection(propertyExpression)); public override TestComplexCollectionBuilder ComplexCollection( - Expression?>> propertyExpression, string complexTypeName) + Expression?>> propertyExpression, + string complexTypeName) where TElement : default => Wrap(PropertyBuilder.ComplexCollection(propertyExpression, complexTypeName)); public override TestComplexCollectionBuilder ComplexCollection( - string propertyName, Action> buildAction) + string propertyName, + Action> buildAction) { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyName))); return this; } public override TestComplexCollectionBuilder ComplexCollection( - string propertyName, string complexTypeName, Action> buildAction) + string propertyName, + string complexTypeName, + Action> buildAction) { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyName, complexTypeName))); return this; } public override TestComplexCollectionBuilder ComplexCollection( - Expression?>> propertyExpression, Action> buildAction) + Expression?>> propertyExpression, + Action> buildAction) where TElement : default { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyExpression))); @@ -704,7 +732,9 @@ public override TestComplexCollectionBuilder ComplexCollection ComplexCollection( - Expression?>> propertyExpression, string complexTypeName, Action> buildAction) + Expression?>> propertyExpression, + string complexTypeName, + Action> buildAction) where TElement : default { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyExpression, complexTypeName))); @@ -757,12 +787,14 @@ public override TestDiscriminatorBuilder HasValue(string entityT => Wrap(DiscriminatorBuilder.HasValue(entityTypeName, value)); } - protected class GenericTestComplexTypeDiscriminatorBuilder(ComplexTypeDiscriminatorBuilder discriminatorBuilder) + protected class GenericTestComplexTypeDiscriminatorBuilder( + ComplexTypeDiscriminatorBuilder discriminatorBuilder) : TestComplexTypeDiscriminatorBuilder { protected ComplexTypeDiscriminatorBuilder DiscriminatorBuilder { get; } = discriminatorBuilder; - protected virtual TestComplexTypeDiscriminatorBuilder Wrap(ComplexTypeDiscriminatorBuilder discriminatorBuilder) + protected virtual TestComplexTypeDiscriminatorBuilder Wrap( + ComplexTypeDiscriminatorBuilder discriminatorBuilder) => new GenericTestComplexTypeDiscriminatorBuilder(discriminatorBuilder); public override TestComplexTypeDiscriminatorBuilder HasValue(TDiscriminator value) @@ -1144,7 +1176,8 @@ ComplexTypePropertyBuilder IInfrastructure PropertyBuilder; } - protected class GenericTestComplexCollectionTypePropertyBuilder(ComplexCollectionTypePropertyBuilder propertyBuilder) : + protected class GenericTestComplexCollectionTypePropertyBuilder( + ComplexCollectionTypePropertyBuilder propertyBuilder) : TestComplexCollectionTypePropertyBuilder, IInfrastructure> { @@ -1153,7 +1186,8 @@ protected class GenericTestComplexCollectionTypePropertyBuilder(Compl public override IMutableProperty Metadata => PropertyBuilder.Metadata; - protected virtual TestComplexCollectionTypePropertyBuilder Wrap(ComplexCollectionTypePropertyBuilder propertyBuilder) + protected virtual TestComplexCollectionTypePropertyBuilder Wrap( + ComplexCollectionTypePropertyBuilder propertyBuilder) => new GenericTestComplexCollectionTypePropertyBuilder(propertyBuilder); public override TestComplexCollectionTypePropertyBuilder HasAnnotation(string annotation, object? value) @@ -1227,7 +1261,8 @@ public override TestComplexCollectionTypePropertyBuilder HasConversio valueComparer, providerComparerType)); - public override TestComplexCollectionTypePropertyBuilder HasConversion(ValueConverter converter) + public override TestComplexCollectionTypePropertyBuilder HasConversion( + ValueConverter converter) => Wrap(PropertyBuilder.HasConversion(converter)); public override TestComplexCollectionTypePropertyBuilder HasConversion( @@ -1244,7 +1279,9 @@ public override TestComplexCollectionTypePropertyBuilder HasConversio public override TestComplexCollectionTypePropertyBuilder HasConversion(ValueConverter? converter) => Wrap(PropertyBuilder.HasConversion(converter)); - public override TestComplexCollectionTypePropertyBuilder HasConversion(ValueConverter? converter, ValueComparer? valueComparer) + public override TestComplexCollectionTypePropertyBuilder HasConversion( + ValueConverter? converter, + ValueComparer? valueComparer) => Wrap(PropertyBuilder.HasConversion(converter, valueComparer)); public override TestComplexCollectionTypePropertyBuilder HasConversion( @@ -1559,10 +1596,9 @@ public override TestEntityTypeBuilder UsingEntity( public override TestEntityTypeBuilder UsingEntity( Action>> configureJoinEntityType) => new GenericTestEntityTypeBuilder( - CollectionCollectionBuilder.UsingEntity( - e => configureJoinEntityType( - new GenericTestEntityTypeBuilder>( - new EntityTypeBuilder>(e.Metadata))))); + CollectionCollectionBuilder.UsingEntity(e => configureJoinEntityType( + new GenericTestEntityTypeBuilder>( + new EntityTypeBuilder>(e.Metadata))))); public override TestEntityTypeBuilder UsingEntity( string joinEntityName, @@ -1577,8 +1613,8 @@ public override TestEntityTypeBuilder UsingEntity( public override TestEntityTypeBuilder UsingEntity( Action> configureJoinEntityType) => new GenericTestEntityTypeBuilder( - CollectionCollectionBuilder.UsingEntity( - e => configureJoinEntityType(new GenericTestEntityTypeBuilder(e)))); + CollectionCollectionBuilder.UsingEntity(e + => configureJoinEntityType(new GenericTestEntityTypeBuilder(e)))); public override TestEntityTypeBuilder UsingEntity( string joinEntityName, diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.Inheritance.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.Inheritance.cs index 6cc741e6d46..e20a9fb5c7d 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.Inheritance.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.Inheritance.cs @@ -159,8 +159,8 @@ public virtual void Can_set_and_remove_base_type() return true; }); Fixture.TestHelpers.ModelAsserter.AssertEqual( - initialIndexes.SingleOrDefault()?.Properties ?? Array.Empty(), - pickle.GetIndexes().SingleOrDefault()?.Properties ?? Array.Empty()); + initialIndexes.SingleOrDefault()?.Properties ?? [], + pickle.GetIndexes().SingleOrDefault()?.Properties ?? []); Fixture.TestHelpers.ModelAsserter.AssertEqual( initialForeignKeys.Single().Properties, pickle.GetForeignKeys().Single().Properties); @@ -191,8 +191,8 @@ public virtual void Can_set_and_remove_base_type() return true; }); Fixture.TestHelpers.ModelAsserter.AssertEqual( - initialIndexes.SingleOrDefault()?.Properties ?? Array.Empty(), - ingredient.GetIndexes().SingleOrDefault()?.Properties ?? Array.Empty()); + initialIndexes.SingleOrDefault()?.Properties ?? [], + ingredient.GetIndexes().SingleOrDefault()?.Properties ?? []); Fixture.TestHelpers.ModelAsserter.AssertEqual( initialForeignKeys.Single().Properties, ingredient.GetForeignKeys().Single().Properties); @@ -594,18 +594,14 @@ public virtual void Index_removed_when_covered_by_an_inherited_foreign_key() Assert.Empty(derivedDependentEntityType.GetDeclaredIndexes()); principalEntityBuilder.HasMany(c => c.Orders).WithOne(o => o.Customer) - .HasForeignKey( - o => new { o.CustomerId, o.AnotherCustomerId }) - .HasPrincipalKey( - c => new { c.Id, c.AlternateKey }); + .HasForeignKey(o => new { o.CustomerId, o.AnotherCustomerId }) + .HasPrincipalKey(c => new { c.Id, c.AlternateKey }); Assert.Empty(derivedDependentEntityType.GetDeclaredIndexes()); derivedPrincipalEntityBuilder.HasMany().WithOne() - .HasForeignKey( - o => new { o.CustomerId }) - .HasPrincipalKey( - c => new { c.Id }); + .HasForeignKey(o => new { o.CustomerId }) + .HasPrincipalKey(c => new { c.Id }); var fk = dependentEntityType.GetForeignKeys().Single(); Assert.Single(dependentEntityType.GetIndexes()); @@ -638,10 +634,8 @@ public virtual void Index_removed_when_covered_by_an_inherited_foreign_key() Fixture.TestHelpers.ModelAsserter.AssertEqual(initialForeignKeys, derivedDependentEntityType.GetForeignKeys()); principalEntityBuilder.HasOne().WithOne() - .HasPrincipalKey( - c => new { c.Id }) - .HasForeignKey( - o => new { o.CustomerId }); + .HasPrincipalKey(c => new { c.Id }) + .HasForeignKey(o => new { o.CustomerId }); modelBuilder.FinalizeModel(); @@ -677,15 +671,12 @@ public virtual void Index_removed_when_covered_by_an_inherited_index() var dependentEntityBuilder = modelBuilder.Entity(); var derivedDependentEntityBuilder = modelBuilder.Entity(); - dependentEntityBuilder.HasIndex( - o => new { o.CustomerId, o.AnotherCustomerId }) + dependentEntityBuilder.HasIndex(o => new { o.CustomerId, o.AnotherCustomerId }) .IsUnique(); derivedPrincipalEntityBuilder.HasMany().WithOne() - .HasPrincipalKey( - c => new { c.Id }) - .HasForeignKey( - o => new { o.CustomerId }); + .HasPrincipalKey(c => new { c.Id }) + .HasForeignKey(o => new { o.CustomerId }); var dependentEntityType = dependentEntityBuilder.Metadata; var derivedDependentEntityType = derivedDependentEntityBuilder.Metadata; @@ -827,9 +818,9 @@ public virtual void Can_reconfigure_inherited_intraHierarchical_relationship() .HasForeignKey(); var fk = bookLabelEntityBuilder.Metadata.FindNavigation(nameof(BookLabel.SpecialBookLabel)).ForeignKey; - Assert.Equal(new[] { fk }, extraSpecialBookLabelEntityBuilder.Metadata.GetForeignKeys()); + Assert.Equal([fk], extraSpecialBookLabelEntityBuilder.Metadata.GetForeignKeys()); Assert.Equal(nameof(SpecialBookLabel.BookLabel), fk.DependentToPrincipal.Name); - Assert.Equal(new[] { fk }, extraSpecialBookLabelEntityBuilder.Metadata.GetForeignKeys()); + Assert.Equal([fk], extraSpecialBookLabelEntityBuilder.Metadata.GetForeignKeys()); } [ConditionalFact] @@ -854,11 +845,10 @@ public virtual void Relationships_on_derived_types_are_discovered_first_if_base_ Assert.Empty(modelBuilder.Model.FindEntityType(typeof(CityViewModel)).GetForeignKeys()); - modelBuilder.Entity( - c => - { - c.Ignore(c => c.CustomValues); - }); + modelBuilder.Entity(c => + { + c.Ignore(c => c.CustomValues); + }); Assert.Null(modelBuilder.Model.FindEntityType(typeof(Dictionary))); diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ManyToMany.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ManyToMany.cs index 1681985a01f..3dcdd67a0d6 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ManyToMany.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ManyToMany.cs @@ -148,22 +148,20 @@ public virtual void Finds_existing_navigations_and_uses_associated_FK_with_field .WithMany()) .HasKey(j => new { j.DependentWithFieldId, j.ManyToManyPrincipalWithFieldId }); - modelBuilder.Entity( - e => - { - e.Property(p => p.Id); - e.Property(p => p.Name); - e.HasKey(p => p.Id); - }); - modelBuilder.Entity( - e => - { - e.Property(d => d.DependentWithFieldId); - e.Property(d => d.AnotherOneToManyPrincipalId); - e.Ignore(d => d.OneToManyPrincipal); - e.Ignore(d => d.OneToOnePrincipal); - e.HasKey(d => d.DependentWithFieldId); - }); + modelBuilder.Entity(e => + { + e.Property(p => p.Id); + e.Property(p => p.Name); + e.HasKey(p => p.Id); + }); + modelBuilder.Entity(e => + { + e.Property(d => d.DependentWithFieldId); + e.Property(d => d.AnotherOneToManyPrincipalId); + e.Ignore(d => d.OneToManyPrincipal); + e.Ignore(d => d.OneToOnePrincipal); + e.HasKey(d => d.DependentWithFieldId); + }); var principalEntityType = model.FindEntityType(typeof(ManyToManyPrincipalWithField))!; var dependentEntityType = model.FindEntityType(typeof(DependentWithField))!; @@ -230,11 +228,10 @@ public virtual void Join_type_is_automatically_configured_by_convention() var key = joinEntityType.FindPrimaryKey()!; Assert.Equal( - new[] - { + [ nameof(ImplicitManyToManyB.As) + nameof(ImplicitManyToManyA.Id), nameof(ImplicitManyToManyA.Bs) + nameof(ImplicitManyToManyB.Id) - }, + ], key.Properties.Select(p => p.Name)); Assert.DoesNotContain(joinEntityType.GetProperties(), p => !p.IsIndexerProperty()); @@ -296,7 +293,7 @@ public virtual void Can_configure_join_type() var key = productCategoryType.FindPrimaryKey()!; Assert.Equal( - new[] { nameof(ProductCategory.ProductId), nameof(ProductCategory.CategoryId) }, + [nameof(ProductCategory.ProductId), nameof(ProductCategory.CategoryId)], key.Properties.Select(p => p.Name)); } @@ -307,8 +304,7 @@ public virtual void Can_configure_join_type_with_implicit_join_relationships() var manyToMany = modelBuilder.Entity() .HasMany(p => p.Categories).WithMany(c => c.Products) - .UsingEntity( - pcb => pcb.HasKey(pc => new { pc.ProductId, pc.CategoryId })); + .UsingEntity(pcb => pcb.HasKey(pc => new { pc.ProductId, pc.CategoryId })); Assert.Equal(typeof(Product), manyToMany.Metadata.ClrType); @@ -330,7 +326,7 @@ public virtual void Can_configure_join_type_with_implicit_join_relationships() var key = productCategoryType.FindPrimaryKey()!; Assert.Equal( - new[] { nameof(ProductCategory.ProductId), nameof(ProductCategory.CategoryId) }, + [nameof(ProductCategory.ProductId), nameof(ProductCategory.CategoryId)], key.Properties.Select(p => p.Name)); } @@ -373,7 +369,7 @@ public virtual void Can_configure_shared_join_type_with_implicit_join_relationsh var key = productCategoryType.FindPrimaryKey()!; Assert.Equal( - new[] { nameof(ProductCategory.ProductId), nameof(ProductCategory.CategoryId) }, + [nameof(ProductCategory.ProductId), nameof(ProductCategory.CategoryId)], key.Properties.Select(p => p.Name)); } @@ -416,9 +412,8 @@ public virtual void Throws_for_conflicting_many_to_one_on_left() nameof(Product) + "." + nameof(Product.Categories), nameof(Category) + "." + nameof(Category.Products), nameof(Product)), - Assert.Throws( - () => modelBuilder.Entity() - .HasMany(o => o.Products).WithMany(c => c.Categories)).Message); + Assert.Throws(() => modelBuilder.Entity() + .HasMany(o => o.Products).WithMany(c => c.Categories)).Message); } [ConditionalFact] @@ -438,9 +433,8 @@ public virtual void Throws_for_conflicting_many_to_one_on_right() nameof(Category) + "." + nameof(Category.Products), nameof(Category) + "." + nameof(Category.Products), nameof(Product)), - Assert.Throws( - () => modelBuilder.Entity() - .HasMany(o => o.Categories).WithMany(c => c.Products)).Message); + Assert.Throws(() => modelBuilder.Entity() + .HasMany(o => o.Categories).WithMany(c => c.Products)).Message); } [ConditionalFact] @@ -478,7 +472,7 @@ public virtual void Many_to_many_with_only_Has_navigation_configured() var key = joinEntityType.FindPrimaryKey()!; Assert.Equal( - new[] { "ProductsId", "UniCategoryId" }, + ["ProductsId", "UniCategoryId"], key.Properties.Select(p => p.Name)); Assert.DoesNotContain(joinEntityType.GetProperties(), p => !p.IsIndexerProperty()); @@ -519,7 +513,7 @@ public virtual void Many_to_many_with_no_navigations_configured() var key = joinEntityType.FindPrimaryKey()!; Assert.Equal( - new[] { "NoCategoryId", "NoProductId" }, + ["NoCategoryId", "NoProductId"], key.Properties.Select(p => p.Name)); Assert.DoesNotContain(joinEntityType.GetProperties(), p => !p.IsIndexerProperty()); @@ -566,7 +560,7 @@ public virtual void Many_to_many_with_a_shadow_navigation() var key = joinEntityType.FindPrimaryKey()!; Assert.Equal( - new[] { "DependentsId", "ShadowId" }, + ["DependentsId", "ShadowId"], key.Properties.Select(p => p.Name)); Assert.DoesNotContain(joinEntityType.GetProperties(), p => !p.IsIndexerProperty()); @@ -607,7 +601,7 @@ public virtual void Many_to_many_with_only_With_navigation_configured() var key = joinEntityType.FindPrimaryKey()!; Assert.Equal( - new[] { "ProductsId", "UniCategoryId" }, + ["ProductsId", "UniCategoryId"], key.Properties.Select(p => p.Name)); Assert.DoesNotContain(joinEntityType.GetProperties(), p => !p.IsIndexerProperty()); @@ -620,11 +614,10 @@ public virtual void Throws_for_self_ref_with_same_navigation() Assert.Equal( CoreStrings.ManyToManyOneNav(nameof(SelfRefManyToOne), nameof(SelfRefManyToOne.SelfRef2)), - Assert.Throws( - () => modelBuilder - .Entity() - .HasMany(e => e.SelfRef2) - .WithMany(e => e.SelfRef2)).Message); + Assert.Throws(() => modelBuilder + .Entity() + .HasMany(e => e.SelfRef2) + .WithMany(e => e.SelfRef2)).Message); } [ConditionalFact] @@ -693,7 +686,7 @@ public virtual void Overrides_ForeignKeyAttribute() var joinEntityType = categoryFk.DeclaringEntityType; Assert.Equal(2, joinEntityType.GetForeignKeys().Count()); Assert.Equal( - new[] { "CategoryWithAttributeId", "ProductWithAttributeId" }, + ["CategoryWithAttributeId", "ProductWithAttributeId"], joinEntityType.FindPrimaryKey()!.Properties.Select(p => p.Name)); } @@ -716,13 +709,12 @@ public virtual void ForeignKeyAttribute_does_not_force_convention_join_table_inc { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - entity => - { - entity.HasMany(d => d.MotorBauArtMatching) - .WithMany(p => p.MotorArtMatching) - .UsingEntity>("MotorArtXMotorBauartMatching"); - }); + modelBuilder.Entity(entity => + { + entity.HasMany(d => d.MotorBauArtMatching) + .WithMany(p => p.MotorArtMatching) + .UsingEntity>("MotorArtXMotorBauartMatching"); + }); var model = modelBuilder.FinalizeModel(); @@ -733,7 +725,7 @@ public virtual void ForeignKeyAttribute_does_not_force_convention_join_table_inc e => { Assert.Equal("MotorArtMatching", e.ShortName()); - AssertEqual(new[] { e.FindProperty("MotorArtMatchingId")! }, e.GetProperties()); + AssertEqual([e.FindProperty("MotorArtMatchingId")!], e.GetProperties()); Assert.Empty(e.GetForeignKeys()); Assert.Empty(e.GetNavigations()); Assert.Collection(e.GetSkipNavigations(), n => Assert.Equal("MotorBauArtMatching", n.Name)); @@ -741,7 +733,7 @@ public virtual void ForeignKeyAttribute_does_not_force_convention_join_table_inc e => { Assert.Equal("MotorBauartMatching", e.ShortName()); - AssertEqual(new[] { e.FindProperty("MotorBauartMatchingId")! }, e.GetProperties()); + AssertEqual([e.FindProperty("MotorBauartMatchingId")!], e.GetProperties()); Assert.Empty(e.GetForeignKeys()); Assert.Empty(e.GetNavigations()); Assert.Collection(e.GetSkipNavigations(), n => Assert.Equal("MotorArtMatching", n.Name)); @@ -790,13 +782,12 @@ public virtual void ForeignKeyAttribute_does_not_force_convention_join_table_inc { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - entity => - { - entity.HasMany(d => d.MotorBauArtMismatching) - .WithMany(p => p.MotorArtMismatching) - .UsingEntity>("MotorArtXMotorBauartMismatching"); - }); + modelBuilder.Entity(entity => + { + entity.HasMany(d => d.MotorBauArtMismatching) + .WithMany(p => p.MotorArtMismatching) + .UsingEntity>("MotorArtXMotorBauartMismatching"); + }); var model = modelBuilder.FinalizeModel(); @@ -807,7 +798,7 @@ public virtual void ForeignKeyAttribute_does_not_force_convention_join_table_inc e => { Assert.Equal("MotorArtMismatching", e.ShortName()); - AssertEqual(new[] { e.FindProperty("MotorArtMismatchingId")! }, e.GetProperties()); + AssertEqual([e.FindProperty("MotorArtMismatchingId")!], e.GetProperties()); Assert.Empty(e.GetForeignKeys()); Assert.Empty(e.GetNavigations()); Assert.Collection(e.GetSkipNavigations(), n => Assert.Equal("MotorBauArtMismatching", n.Name)); @@ -815,7 +806,7 @@ public virtual void ForeignKeyAttribute_does_not_force_convention_join_table_inc e => { Assert.Equal("MotorBauartMismatching", e.ShortName()); - AssertEqual(new[] { e.FindProperty("MotorBauartMismatchingId")! }, e.GetProperties()); + AssertEqual([e.FindProperty("MotorBauartMismatchingId")!], e.GetProperties()); Assert.Empty(e.GetForeignKeys()); Assert.Empty(e.GetNavigations()); Assert.Collection(e.GetSkipNavigations(), n => Assert.Equal("MotorArtMismatching", n.Name)); @@ -917,10 +908,9 @@ public virtual void IsRequired_throws() Assert.Equal( CoreStrings.RequiredSkipNavigation(nameof(ManyToManyNavPrincipal), nameof(ManyToManyNavPrincipal.Dependents)), - Assert.Throws( - () => modelBuilder.Entity() - .Navigation(p => p.Dependents) - .IsRequired()).Message); + Assert.Throws(() => modelBuilder.Entity() + .Navigation(p => p.Dependents) + .IsRequired()).Message); } [ConditionalFact] @@ -958,11 +948,10 @@ public virtual void Can_use_shared_type_as_join_entity() var shared1 = model.FindEntityType("Shared1")!; Assert.Equal(2, shared1.GetForeignKeys().Count()); Assert.Equal( - new[] - { + [ nameof(ManyToManyNavPrincipal.Dependents) + nameof(NavDependent.Id), nameof(NavDependent.ManyToManyPrincipals) + nameof(ManyToManyNavPrincipal.Id) - }, + ], shared1.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.True(shared1.HasSharedClrType); Assert.Equal(typeof(Dictionary), shared1.ClrType); @@ -970,11 +959,10 @@ public virtual void Can_use_shared_type_as_join_entity() var shared2 = model.FindEntityType("Shared2")!; Assert.Equal(2, shared2.GetForeignKeys().Count()); Assert.Equal( - new[] - { + [ nameof(ManyToManyPrincipalWithField.Dependents) + nameof(DependentWithField.DependentWithFieldId), nameof(DependentWithField.ManyToManyPrincipals) + nameof(ManyToManyPrincipalWithField.Id) - }, + ], shared2.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.NotNull(shared2.FindProperty("Payload")); Assert.True(shared2.HasSharedClrType); @@ -1022,11 +1010,10 @@ public virtual void Can_use_implicit_shared_type_as_join_entity() var shared1 = model.FindEntityType("Shared1")!; Assert.Equal(2, shared1.GetForeignKeys().Count()); Assert.Equal( - new[] - { + [ nameof(ManyToManyNavPrincipal.Dependents) + nameof(NavDependent.Id), nameof(NavDependent.ManyToManyPrincipals) + nameof(ManyToManyNavPrincipal.Id) - }, + ], shared1.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.True(shared1.HasSharedClrType); Assert.Equal(typeof(Dictionary), shared1.ClrType); @@ -1034,11 +1021,10 @@ public virtual void Can_use_implicit_shared_type_as_join_entity() var shared2 = model.FindEntityType("Shared2")!; Assert.Equal(2, shared2.GetForeignKeys().Count()); Assert.Equal( - new[] - { + [ nameof(ManyToManyPrincipalWithField.Dependents) + nameof(DependentWithField.DependentWithFieldId), nameof(DependentWithField.ManyToManyPrincipals) + nameof(ManyToManyPrincipalWithField.Id) - }, + ], shared2.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.NotNull(shared2.FindProperty("Payload")); Assert.True(shared2.HasSharedClrType); @@ -1085,11 +1071,10 @@ public virtual void Can_use_implicit_shared_type_with_default_name_as_join_entit .FindSkipNavigation(nameof(ManyToManyNavPrincipal.Dependents))!.JoinEntityType!; Assert.Equal(2, shared1.GetForeignKeys().Count()); Assert.Equal( - new[] - { + [ nameof(ManyToManyNavPrincipal.Dependents) + nameof(NavDependent.Id), nameof(NavDependent.ManyToManyPrincipals) + nameof(ManyToManyNavPrincipal.Id) - }, + ], shared1.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.True(shared1.HasSharedClrType); Assert.Equal(typeof(Dictionary), shared1.ClrType); @@ -1099,11 +1084,10 @@ public virtual void Can_use_implicit_shared_type_with_default_name_as_join_entit .FindSkipNavigation(nameof(ManyToManyPrincipalWithField.Dependents))!.JoinEntityType!; Assert.Equal(2, shared2.GetForeignKeys().Count()); Assert.Equal( - new[] - { + [ nameof(ManyToManyPrincipalWithField.Dependents) + nameof(DependentWithField.DependentWithFieldId), nameof(DependentWithField.ManyToManyPrincipals) + nameof(ManyToManyPrincipalWithField.Id) - }, + ], shared2.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.NotNull(shared2.FindProperty("Payload")); Assert.True(shared2.HasSharedClrType); @@ -1147,11 +1131,10 @@ public virtual void Can_use_implicit_shared_type_with_implicit_relationships_as_ var shared1 = model.FindEntityType("Shared1")!; Assert.Equal(2, shared1.GetForeignKeys().Count()); Assert.Equal( - new[] - { + [ nameof(ManyToManyNavPrincipal.Dependents) + nameof(NavDependent.Id), nameof(NavDependent.ManyToManyPrincipals) + nameof(ManyToManyNavPrincipal.Id) - }, + ], shared1.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.True(shared1.HasSharedClrType); Assert.Equal(typeof(Dictionary), shared1.ClrType); @@ -1159,11 +1142,10 @@ public virtual void Can_use_implicit_shared_type_with_implicit_relationships_as_ var shared2 = model.FindEntityType("Shared2")!; Assert.Equal(2, shared2.GetForeignKeys().Count()); Assert.Equal( - new[] - { + [ nameof(ManyToManyPrincipalWithField.Dependents) + nameof(DependentWithField.DependentWithFieldId), nameof(DependentWithField.ManyToManyPrincipals) + nameof(ManyToManyPrincipalWithField.Id) - }, + ], shared2.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.NotNull(shared2.FindProperty("Payload")); Assert.True(shared2.HasSharedClrType); @@ -1210,11 +1192,10 @@ public virtual void Can_use_implicit_shared_type_with_default_name_and_implicit_ .FindSkipNavigation(nameof(ManyToManyNavPrincipal.Dependents))!.JoinEntityType!; Assert.Equal(2, shared1.GetForeignKeys().Count()); Assert.Equal( - new[] - { + [ nameof(ManyToManyNavPrincipal.Dependents) + nameof(NavDependent.Id), nameof(NavDependent.ManyToManyPrincipals) + nameof(ManyToManyNavPrincipal.Id) - }, + ], shared1.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.True(shared1.HasSharedClrType); Assert.Equal(typeof(Dictionary), shared1.ClrType); @@ -1225,11 +1206,10 @@ public virtual void Can_use_implicit_shared_type_with_default_name_and_implicit_ .FindSkipNavigation(nameof(ManyToManyPrincipalWithField.Dependents))!.JoinEntityType!; Assert.Equal(2, shared2.GetForeignKeys().Count()); Assert.Equal( - new[] - { + [ nameof(ManyToManyPrincipalWithField.Dependents) + nameof(DependentWithField.DependentWithFieldId), nameof(DependentWithField.ManyToManyPrincipals) + nameof(ManyToManyPrincipalWithField.Id) - }, + ], shared2.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.NotNull(shared2.FindProperty("Payload")); Assert.True(shared2.HasSharedClrType); diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ManyToOne.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ManyToOne.cs index 2f33dcf9f0c..49e184ea132 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ManyToOne.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.ManyToOne.cs @@ -64,24 +64,22 @@ public virtual void Finds_existing_navigations_and_uses_associated_FK_with_field var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - e => - { - e.Property(p => p.Id); - e.Property(p => p.AlternateKey); - e.Property(p => p.Name); - e.HasKey(p => p.Id); - }); - modelBuilder.Entity( - e => - { - e.Property(d => d.DependentWithFieldId); - e.Property(d => d.OneToManyPrincipalId); - e.Property(d => d.AnotherOneToManyPrincipalId); - e.Ignore(d => d.ManyToManyPrincipals); - e.Ignore(d => d.OneToOnePrincipal); - e.HasKey(d => d.DependentWithFieldId); - }); + modelBuilder.Entity(e => + { + e.Property(p => p.Id); + e.Property(p => p.AlternateKey); + e.Property(p => p.Name); + e.HasKey(p => p.Id); + }); + modelBuilder.Entity(e => + { + e.Property(d => d.DependentWithFieldId); + e.Property(d => d.OneToManyPrincipalId); + e.Property(d => d.AnotherOneToManyPrincipalId); + e.Ignore(d => d.ManyToManyPrincipals); + e.Ignore(d => d.OneToOnePrincipal); + e.HasKey(d => d.DependentWithFieldId); + }); modelBuilder.Entity() .HasMany(p => p.Dependents) @@ -1430,16 +1428,15 @@ public virtual void Explicitly_set_shadow_FK_name_is_preserved_with_HasPrincipal { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - m => - { - m.Property("_email"); + modelBuilder.Entity(m => + { + m.Property("_email"); - m.HasMany("_profiles") - .WithOne("User") - .HasForeignKey("Email") - .HasPrincipalKey("_email"); - }); + m.HasMany("_profiles") + .WithOne("User") + .HasForeignKey("Email") + .HasPrincipalKey("_email"); + }); modelBuilder.Entity().Property("Email"); @@ -1471,12 +1468,10 @@ public virtual void Creates_both_navigations_and_finds_existing_composite_FK() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder .Entity().HasOne(e => e.Whoopper).WithMany() - .HasForeignKey( - c => new { c.BurgerId1, c.BurgerId2 }); + .HasForeignKey(c => new { c.BurgerId1, c.BurgerId2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1488,8 +1483,7 @@ public virtual void Creates_both_navigations_and_finds_existing_composite_FK() modelBuilder .Entity().HasOne(e => e.Whoopper).WithMany(e => e.Tomatoes) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.FinalizeModel(); @@ -1521,8 +1515,7 @@ public virtual void Creates_both_navigations_and_creates_composite_FK_specified( { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1538,8 +1531,7 @@ public virtual void Creates_both_navigations_and_creates_composite_FK_specified( modelBuilder .Entity().HasOne(e => e.Whoopper).WithMany(e => e.Tomatoes) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.FinalizeModel(); @@ -1573,9 +1565,7 @@ public virtual void Can_use_alternate_composite_key() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => b.HasKey( - c => new { c.Id1, c.Id2 })); + modelBuilder.Entity(b => b.HasKey(c => new { c.Id1, c.Id2 })); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1593,10 +1583,8 @@ public virtual void Can_use_alternate_composite_key() modelBuilder .Entity().HasOne(e => e.Whoopper).WithMany(e => e.Tomatoes) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }) - .HasPrincipalKey( - e => new { e.AlternateKey1, e.AlternateKey2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }) + .HasPrincipalKey(e => new { e.AlternateKey1, e.AlternateKey2 }); modelBuilder.FinalizeModel(); @@ -1637,9 +1625,7 @@ public virtual void Can_use_alternate_composite_key_in_any_order() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => b.HasKey( - c => new { c.Id1, c.Id2 })); + modelBuilder.Entity(b => b.HasKey(c => new { c.Id1, c.Id2 })); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1657,10 +1643,8 @@ public virtual void Can_use_alternate_composite_key_in_any_order() modelBuilder .Entity().HasOne(e => e.Whoopper).WithMany(e => e.Tomatoes) - .HasPrincipalKey( - e => new { e.AlternateKey1, e.AlternateKey2 }) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasPrincipalKey(e => new { e.AlternateKey1, e.AlternateKey2 }) + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.FinalizeModel(); @@ -1701,8 +1685,7 @@ public virtual void Creates_specified_composite_FK_with_navigation_to_principal( { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1718,8 +1701,7 @@ public virtual void Creates_specified_composite_FK_with_navigation_to_principal( modelBuilder .Entity().HasOne(e => e.Whoopper).WithMany() - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.FinalizeModel(); @@ -1751,8 +1733,7 @@ public virtual void Creates_specified_composite_FK_with_navigation_to_dependent( { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1768,8 +1749,7 @@ public virtual void Creates_specified_composite_FK_with_navigation_to_dependent( modelBuilder .Entity().HasOne().WithMany(e => e.Tomatoes) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.FinalizeModel(); @@ -1801,8 +1781,7 @@ public virtual void Creates_relationship_with_no_navigations_and_specified_compo { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Entity().HasMany(w => w.Tomatoes).WithOne(t => t.Whoopper); modelBuilder.Entity(); modelBuilder.Ignore(); @@ -1821,8 +1800,7 @@ public virtual void Creates_relationship_with_no_navigations_and_specified_compo modelBuilder .Entity().HasOne().WithMany() - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.FinalizeModel(); @@ -1858,11 +1836,9 @@ public virtual void Creates_relationship_on_existing_FK_is_using_different_princ { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Entity().HasOne(e => e.ToastedBun).WithOne(e => e.Whoopper) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1874,10 +1850,8 @@ public virtual void Creates_relationship_on_existing_FK_is_using_different_princ modelBuilder .Entity().HasOne().WithMany() - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }) - .HasPrincipalKey( - e => new { e.AlternateKey1, e.AlternateKey2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }) + .HasPrincipalKey(e => new { e.AlternateKey1, e.AlternateKey2 }); var navigation = dependentType.GetNavigations().Single(); var existingFk = navigation.ForeignKey; @@ -1914,11 +1888,9 @@ public virtual void Creates_relationship_on_existing_FK_is_using_different_princ { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Entity().HasOne(e => e.ToastedBun).WithOne(e => e.Whoopper) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1930,10 +1902,8 @@ public virtual void Creates_relationship_on_existing_FK_is_using_different_princ modelBuilder .Entity().HasOne().WithMany() - .HasPrincipalKey( - e => new { e.AlternateKey1, e.AlternateKey2 }) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasPrincipalKey(e => new { e.AlternateKey1, e.AlternateKey2 }) + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); var existingFk = dependentType.GetNavigations().Single().ForeignKey; Assert.Same(existingFk, principalType.GetNavigations().Single().ForeignKey); @@ -1965,8 +1935,7 @@ public virtual void Throws_on_existing_one_to_one_relationship() var model = modelBuilder.Model; modelBuilder.Entity() .HasOne(e => e.Hob).WithOne(e => e.Nob) - .HasForeignKey( - e => new { e.HobId1, e.HobId2 }); + .HasForeignKey(e => new { e.HobId1, e.HobId2 }); var dependentType = model.FindEntityType(typeof(Hob)); var principalType = model.FindEntityType(typeof(Nob)); @@ -1977,9 +1946,8 @@ public virtual void Throws_on_existing_one_to_one_relationship() dependentType.DisplayName() + "." + nameof(Hob.Nob), principalType.DisplayName() + "." + nameof(Nob.Hob), dependentType.DisplayName() + "." + nameof(Hob.Nob)), - Assert.Throws( - () => - modelBuilder.Entity().HasOne(e => e.Nob).WithMany(e => e.Hobs)).Message); + Assert.Throws(() => + modelBuilder.Entity().HasOne(e => e.Nob).WithMany(e => e.Hobs)).Message); } [ConditionalFact] @@ -1989,8 +1957,7 @@ public virtual void Removes_existing_unidirectional_one_to_one_relationship() var model = modelBuilder.Model; modelBuilder.Entity() .HasOne(e => e.Hob).WithOne(e => e.Nob) - .HasForeignKey( - e => new { e.HobId1, e.HobId2 }); + .HasForeignKey(e => new { e.HobId1, e.HobId2 }); // The below means the relationship is no longer // using Nob.Hob. After that it is allowed to override @@ -2018,7 +1985,7 @@ public virtual void Removes_existing_unidirectional_one_to_one_relationship() // so now the RelationshipDiscoveryConvention should be able // to unambiguously and automatically match up Nob.Hob and Hob.Nobs var oldFk = principalType.GetForeignKeys().Single(); - Assert.Equal(new[] { nameof(Nob.HobId1), nameof(Nob.HobId2) }, oldFk.Properties.Select(p => p.Name)); + Assert.Equal([nameof(Nob.HobId1), nameof(Nob.HobId2)], oldFk.Properties.Select(p => p.Name)); Assert.Same(oldFk, dependentType.GetNavigations().Single(n => n.Name == nameof(Hob.Nobs)).ForeignKey); Assert.Same(oldFk, principalType.GetNavigations().Single(n => n.Name == nameof(Nob.Hob)).ForeignKey); Assert.False(oldFk.IsUnique); @@ -2031,8 +1998,7 @@ public virtual void Relationships_discovered_when_ambiguity_on_the_inverse_is_re modelBuilder.Entity() .Ignore(e => e.Hobs) .HasOne(e => e.Hob).WithOne() - .HasForeignKey( - e => new { e.HobId1, e.HobId2 }); + .HasForeignKey(e => new { e.HobId1, e.HobId2 }); var model = modelBuilder.FinalizeModel(); @@ -2072,8 +2038,7 @@ public virtual void Nullable_FK_are_optional_by_default() modelBuilder .Entity().HasOne(e => e.Hob).WithMany(e => e.Nobs) - .HasForeignKey( - e => new { e.HobId1, e.HobId2 }); + .HasForeignKey(e => new { e.HobId1, e.HobId2 }); modelBuilder.FinalizeModel(); @@ -2095,8 +2060,7 @@ public virtual void Non_nullable_FK_are_required_by_default() modelBuilder .Entity().HasOne(e => e.Nob).WithMany(e => e.Hobs) - .HasForeignKey( - e => new { e.NobId1, e.NobId2 }); + .HasForeignKey(e => new { e.NobId1, e.NobId2 }); modelBuilder.FinalizeModel(); @@ -2118,8 +2082,7 @@ public virtual void Nullable_FK_can_be_made_required() modelBuilder .Entity().HasOne(e => e.Hob).WithMany(e => e.Nobs) - .HasForeignKey( - e => new { e.HobId1, e.HobId2 }) + .HasForeignKey(e => new { e.HobId1, e.HobId2 }) .IsRequired(); modelBuilder.FinalizeModel(); @@ -2142,8 +2105,7 @@ public virtual void Non_nullable_FK_can_be_made_optional() modelBuilder .Entity().HasOne(e => e.Nob).WithMany(e => e.Hobs) - .HasForeignKey( - e => new { e.NobId1, e.NobId2 }) + .HasForeignKey(e => new { e.NobId1, e.NobId2 }) .IsRequired(false); modelBuilder.FinalizeModel(); @@ -2166,8 +2128,7 @@ public virtual void Non_nullable_FK_can_be_made_optional_separately() modelBuilder .Entity().HasOne(e => e.Nob).WithMany(e => e.Hobs) - .HasForeignKey( - e => new { e.NobId1, e.NobId2 }); + .HasForeignKey(e => new { e.NobId1, e.NobId2 }); modelBuilder .Entity().HasOne(e => e.Nob).WithMany(e => e.Hobs) @@ -2261,15 +2222,14 @@ public virtual void Creates_shadow_FK_property_with_non_shadow_PK() modelBuilder.Entity(); modelBuilder.Ignore(); - modelBuilder.Entity( - b => - { - b.HasMany() - .WithOne(e => e.FirstNav) - .HasForeignKey("ShadowId") - .IsRequired() - .HasAnnotation("Test", "foo"); - }); + modelBuilder.Entity(b => + { + b.HasMany() + .WithOne(e => e.FirstNav) + .HasForeignKey("ShadowId") + .IsRequired() + .HasAnnotation("Test", "foo"); + }); var model = modelBuilder.FinalizeModel(); diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.NonGeneric.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.NonGeneric.cs index a724926f9df..d2c38751240 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.NonGeneric.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.NonGeneric.cs @@ -131,7 +131,8 @@ public override TestComplexPropertyBuilder ComplexProperty where TProperty : default { var memberInfo = propertyExpression.GetMemberAccess(); - return Wrap(EntityTypeBuilder.ComplexProperty(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName)); + return Wrap( + EntityTypeBuilder.ComplexProperty(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName)); } public override TestEntityTypeBuilder ComplexProperty( @@ -152,7 +153,9 @@ public override TestEntityTypeBuilder ComplexProperty( where TProperty : default { var memberInfo = propertyExpression.GetMemberAccess(); - buildAction(Wrap(EntityTypeBuilder.ComplexProperty(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName))); + buildAction( + Wrap( + EntityTypeBuilder.ComplexProperty(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName))); return this; } @@ -169,10 +172,13 @@ public override TestEntityTypeBuilder ComplexProperty( public override TestComplexCollectionBuilder ComplexCollection(string propertyName) => Wrap(EntityTypeBuilder.ComplexCollection(propertyName)); - public override TestComplexCollectionBuilder ComplexCollection(string propertyName, string complexTypeName) + public override TestComplexCollectionBuilder ComplexCollection( + string propertyName, + string complexTypeName) => Wrap(EntityTypeBuilder.ComplexCollection(propertyName, complexTypeName)); - public override TestComplexCollectionBuilder ComplexCollection(Expression?>> propertyExpression) + public override TestComplexCollectionBuilder ComplexCollection( + Expression?>> propertyExpression) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); @@ -180,29 +186,35 @@ public override TestComplexCollectionBuilder ComplexCollection ComplexCollection( - Expression?>> propertyExpression, string complexTypeName) + Expression?>> propertyExpression, + string complexTypeName) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); - return Wrap(EntityTypeBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName)); + return Wrap( + EntityTypeBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName)); } public override TestEntityTypeBuilder ComplexCollection( - string propertyName, Action> buildAction) + string propertyName, + Action> buildAction) { buildAction(Wrap(EntityTypeBuilder.ComplexCollection(propertyName))); return this; } public override TestEntityTypeBuilder ComplexCollection( - string propertyName, string complexTypeName, Action> buildAction) + string propertyName, + string complexTypeName, + Action> buildAction) { buildAction(Wrap(EntityTypeBuilder.ComplexCollection(propertyName, complexTypeName))); return this; } public override TestEntityTypeBuilder ComplexCollection( - Expression?>> propertyExpression, Action> buildAction) + Expression?>> propertyExpression, + Action> buildAction) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); @@ -211,11 +223,15 @@ public override TestEntityTypeBuilder ComplexCollection( } public override TestEntityTypeBuilder ComplexCollection( - Expression?>> propertyExpression, string complexTypeName, Action> buildAction) + Expression?>> propertyExpression, + string complexTypeName, + Action> buildAction) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); - buildAction(Wrap(EntityTypeBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName))); + buildAction( + Wrap( + EntityTypeBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName))); return this; } @@ -562,7 +578,9 @@ public override TestComplexPropertyBuilder ComplexProperty( public override TestComplexCollectionBuilder ComplexCollection(string propertyName) => Wrap(PropertyBuilder.ComplexCollection(propertyName)); - public override TestComplexCollectionBuilder ComplexCollection(string propertyName, string complexTypeName) + public override TestComplexCollectionBuilder ComplexCollection( + string propertyName, + string complexTypeName) => Wrap(PropertyBuilder.ComplexCollection(propertyName, complexTypeName)); public override TestComplexCollectionBuilder ComplexCollection( @@ -574,29 +592,35 @@ public override TestComplexCollectionBuilder ComplexCollection ComplexCollection( - Expression?>> propertyExpression, string complexTypeName) + Expression?>> propertyExpression, + string complexTypeName) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); - return Wrap(PropertyBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName)); + return Wrap( + PropertyBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName)); } public override TestComplexPropertyBuilder ComplexCollection( - string propertyName, Action> buildAction) + string propertyName, + Action> buildAction) { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyName))); return this; } public override TestComplexPropertyBuilder ComplexCollection( - string propertyName, string complexTypeName, Action> buildAction) + string propertyName, + string complexTypeName, + Action> buildAction) { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyName, complexTypeName))); return this; } public override TestComplexPropertyBuilder ComplexCollection( - Expression?>> propertyExpression, Action> buildAction) + Expression?>> propertyExpression, + Action> buildAction) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); @@ -605,11 +629,15 @@ public override TestComplexPropertyBuilder ComplexCollection } public override TestComplexPropertyBuilder ComplexCollection( - Expression?>> propertyExpression, string complexTypeName, Action> buildAction) + Expression?>> propertyExpression, + string complexTypeName, + Action> buildAction) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); - buildAction(Wrap(PropertyBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName))); + buildAction( + Wrap( + PropertyBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName))); return this; } @@ -631,12 +659,15 @@ public override TestComplexPropertyBuilder UsePropertyAccessMode(Prope public override TestComplexPropertyBuilder UseDefaultPropertyAccessMode(PropertyAccessMode propertyAccessMode) => Wrap(PropertyBuilder.UseDefaultPropertyAccessMode(propertyAccessMode)); - public override TestComplexTypeDiscriminatorBuilder HasDiscriminator(Expression> propertyExpression) - => new NonGenericTestComplexTypeDiscriminatorBuilder(PropertyBuilder.HasDiscriminator( - propertyExpression.GetMemberAccess().GetSimpleMemberName(), propertyExpression.GetMemberAccess().GetMemberType())); + public override TestComplexTypeDiscriminatorBuilder HasDiscriminator( + Expression> propertyExpression) + => new NonGenericTestComplexTypeDiscriminatorBuilder( + PropertyBuilder.HasDiscriminator( + propertyExpression.GetMemberAccess().GetSimpleMemberName(), propertyExpression.GetMemberAccess().GetMemberType())); public override TestComplexTypeDiscriminatorBuilder HasDiscriminator(string propertyName) - => new NonGenericTestComplexTypeDiscriminatorBuilder(PropertyBuilder.HasDiscriminator(propertyName, typeof(TDiscriminator))); + => new NonGenericTestComplexTypeDiscriminatorBuilder( + PropertyBuilder.HasDiscriminator(propertyName, typeof(TDiscriminator))); public override TestComplexPropertyBuilder HasNoDiscriminator() => Wrap(PropertyBuilder.HasNoDiscriminator()); @@ -662,7 +693,8 @@ protected virtual NonGenericTestComplexPropertyBuilder Wrap(ComplexPropert protected virtual NonGenericTestComplexTypePropertyBuilder Wrap(ComplexTypePropertyBuilder propertyBuilder) => new(propertyBuilder); - protected virtual NonGenericTestComplexCollectionTypePropertyBuilder Wrap(ComplexCollectionTypePropertyBuilder propertyBuilder) + protected virtual NonGenericTestComplexCollectionTypePropertyBuilder Wrap( + ComplexCollectionTypePropertyBuilder propertyBuilder) => new(propertyBuilder); protected virtual NonGenericTestComplexTypePrimitiveCollectionBuilder Wrap( @@ -758,10 +790,13 @@ public override TestComplexCollectionBuilder ComplexProperty ComplexCollection(string propertyName) => Wrap(PropertyBuilder.ComplexCollection(propertyName)); - public override TestComplexCollectionBuilder ComplexCollection(string propertyName, string complexTypeName) + public override TestComplexCollectionBuilder ComplexCollection( + string propertyName, + string complexTypeName) => Wrap(PropertyBuilder.ComplexCollection(propertyName, complexTypeName)); - public override TestComplexCollectionBuilder ComplexCollection(Expression?>> propertyExpression) + public override TestComplexCollectionBuilder ComplexCollection( + Expression?>> propertyExpression) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); @@ -769,29 +804,35 @@ public override TestComplexCollectionBuilder ComplexCollection ComplexCollection( - Expression?>> propertyExpression, string complexTypeName) + Expression?>> propertyExpression, + string complexTypeName) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); - return Wrap(PropertyBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName)); + return Wrap( + PropertyBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName)); } public override TestComplexCollectionBuilder ComplexCollection( - string propertyName, Action> buildAction) + string propertyName, + Action> buildAction) { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyName))); return this; } public override TestComplexCollectionBuilder ComplexCollection( - string propertyName, string complexTypeName, Action> buildAction) + string propertyName, + string complexTypeName, + Action> buildAction) { buildAction(Wrap(PropertyBuilder.ComplexCollection(propertyName, complexTypeName))); return this; } public override TestComplexCollectionBuilder ComplexCollection( - Expression?>> propertyExpression, Action> buildAction) + Expression?>> propertyExpression, + Action> buildAction) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); @@ -800,11 +841,15 @@ public override TestComplexCollectionBuilder ComplexCollection ComplexCollection( - Expression?>> propertyExpression, string complexTypeName, Action> buildAction) + Expression?>> propertyExpression, + string complexTypeName, + Action> buildAction) where TElement : default { var memberInfo = propertyExpression.GetMemberAccess(); - buildAction(Wrap(PropertyBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName))); + buildAction( + Wrap( + PropertyBuilder.ComplexCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName(), complexTypeName))); return this; } @@ -1322,7 +1367,8 @@ public override TestComplexCollectionTypePropertyBuilder HasConversio valueComparer, providerComparerType)); - public override TestComplexCollectionTypePropertyBuilder HasConversion(ValueConverter converter) + public override TestComplexCollectionTypePropertyBuilder HasConversion( + ValueConverter converter) => Wrap(PropertyBuilder.HasConversion(converter)); public override TestComplexCollectionTypePropertyBuilder HasConversion( @@ -1339,7 +1385,9 @@ public override TestComplexCollectionTypePropertyBuilder HasConversio public override TestComplexCollectionTypePropertyBuilder HasConversion(ValueConverter? converter) => Wrap(PropertyBuilder.HasConversion(converter)); - public override TestComplexCollectionTypePropertyBuilder HasConversion(ValueConverter? converter, ValueComparer? valueComparer) + public override TestComplexCollectionTypePropertyBuilder HasConversion( + ValueConverter? converter, + ValueComparer? valueComparer) => Wrap(PropertyBuilder.HasConversion(converter, valueComparer)); public override TestComplexCollectionTypePropertyBuilder HasConversion( @@ -1662,8 +1710,8 @@ public override TestEntityTypeBuilder UsingEntity( public override TestEntityTypeBuilder UsingEntity( Action>> configureJoinEntityType) => new NonGenericTestEntityTypeBuilder( - CollectionCollectionBuilder.UsingEntity( - e => configureJoinEntityType(new NonGenericTestEntityTypeBuilder>(e)))); + CollectionCollectionBuilder.UsingEntity(e + => configureJoinEntityType(new NonGenericTestEntityTypeBuilder>(e)))); public override TestEntityTypeBuilder UsingEntity( string joinEntityName, diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.NonRelationship.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.NonRelationship.cs index fc59b872116..bcef39f8bb8 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.NonRelationship.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.NonRelationship.cs @@ -99,14 +99,13 @@ public virtual void Can_set_entity_key_from_property_name_when_no_clr_property() var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => - { - b.Property(Customer.IdProperty.Name + 1); - b.Ignore(p => p.Details); - b.Ignore(p => p.Orders); - b.HasKey(Customer.IdProperty.Name + 1); - }); + modelBuilder.Entity(b => + { + b.Property(Customer.IdProperty.Name + 1); + b.Ignore(p => p.Details); + b.Ignore(p => p.Orders); + b.HasKey(Customer.IdProperty.Name + 1); + }); var entity = model.FindEntityType(typeof(Customer))!; @@ -119,13 +118,12 @@ public virtual void Can_set_entity_key_from_clr_property_when_property_ignored_o { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.HasNoKey(); - b.Ignore(Customer.IdProperty.Name); - b.HasKey(e => e.Id); - }); + modelBuilder.Entity(b => + { + b.HasNoKey(); + b.Ignore(Customer.IdProperty.Name); + b.HasKey(e => e.Id); + }); var entity = modelBuilder.Model.FindEntityType(typeof(Customer))!; @@ -141,8 +139,7 @@ public virtual void Can_set_composite_entity_key_from_clr_properties() modelBuilder .Entity() - .HasKey( - e => new { e.Id, e.Name }); + .HasKey(e => new { e.Id, e.Name }); var entity = model.FindEntityType(typeof(Customer))!; @@ -159,12 +156,11 @@ public virtual void Can_set_composite_entity_key_from_property_names_when_mixed_ modelBuilder.Ignore(); modelBuilder.Ignore(); - modelBuilder.Entity( - b => - { - b.Property(Customer.NameProperty.Name + "Shadow"); - b.HasKey(Customer.IdProperty.Name, Customer.NameProperty.Name + "Shadow"); - }); + modelBuilder.Entity(b => + { + b.Property(Customer.NameProperty.Name + "Shadow"); + b.HasKey(Customer.IdProperty.Name, Customer.NameProperty.Name + "Shadow"); + }); var entity = model.FindEntityType(typeof(Customer))!; @@ -181,8 +177,7 @@ public virtual void Can_set_entity_key_with_annotations() var keyBuilder = modelBuilder .Entity() - .HasKey( - e => new { e.Id, e.Name }); + .HasKey(e => new { e.Id, e.Name }); keyBuilder.HasAnnotation("A1", "V1") .HasAnnotation("A2", "V2"); @@ -190,7 +185,7 @@ public virtual void Can_set_entity_key_with_annotations() var entity = model.FindEntityType(typeof(Customer))!; Assert.Equal( - new[] { Customer.IdProperty.Name, Customer.NameProperty.Name }, entity.FindPrimaryKey()!.Properties.Select(p => p.Name)); + [Customer.IdProperty.Name, Customer.NameProperty.Name], entity.FindPrimaryKey()!.Properties.Select(p => p.Name)); Assert.Equal("V1", keyBuilder.Metadata["A1"]); Assert.Equal("V2", keyBuilder.Metadata["A2"]); } @@ -206,7 +201,6 @@ public virtual void Can_upgrade_candidate_key_to_primary_key() modelBuilder.Ignore(); var entity = modelBuilder.Model.FindEntityType(typeof(Customer))!; - var key = entity.FindKey(entity.FindProperty(Customer.NameProperty)!); modelBuilder.Entity().HasKey(b => b.Name); @@ -242,12 +236,11 @@ public virtual void Can_set_alternate_key_from_property_name_when_no_clr_propert var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => - { - b.Property(Customer.AlternateKeyProperty.Name + 1); - b.HasAlternateKey(Customer.AlternateKeyProperty.Name + 1); - }); + modelBuilder.Entity(b => + { + b.Property(Customer.AlternateKeyProperty.Name + 1); + b.HasAlternateKey(Customer.AlternateKeyProperty.Name + 1); + }); var entity = model.FindEntityType(typeof(Customer))!; @@ -260,12 +253,11 @@ public virtual void Can_set_alternate_key_from_property_name_when_no_clr_propert public virtual void Can_set_alternate_key_from_clr_property_when_property_ignored() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(Customer.AlternateKeyProperty.Name); - b.HasAlternateKey(e => e.AlternateKey); - }); + modelBuilder.Entity(b => + { + b.Ignore(Customer.AlternateKeyProperty.Name); + b.HasAlternateKey(e => e.AlternateKey); + }); var entity = modelBuilder.Model.FindEntityType(typeof(Customer))!; @@ -351,16 +343,15 @@ public virtual void Properties_are_required_by_default_only_if_CLR_type_is_nulla { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up); - b.Property(e => e.Down); - b.Property("Charm"); - b.Property("Strange"); - b.Property("Top"); - b.Property("Bottom"); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up); + b.Property(e => e.Down); + b.Property("Charm"); + b.Property("Strange"); + b.Property("Top"); + b.Property("Bottom"); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(Quarks))!; @@ -377,17 +368,16 @@ public virtual void Properties_can_be_ignored() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.Up); - b.Ignore(e => e.Down); - b.Ignore("Charm"); - b.Ignore("Strange"); - b.Ignore("Top"); - b.Ignore("Bottom"); - b.Ignore("Shadow"); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.Up); + b.Ignore(e => e.Down); + b.Ignore("Charm"); + b.Ignore("Strange"); + b.Ignore("Top"); + b.Ignore("Bottom"); + b.Ignore("Shadow"); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(Quarks))!; Assert.Contains(nameof(Quarks.Id), entityType.GetProperties().Select(p => p.Name)); @@ -420,12 +410,11 @@ public virtual void Conventions_can_be_added() [ConditionalFact] public virtual void Conventions_can_be_removed() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Conventions.Add(s => new TestConvention()); - c.Conventions.Remove(typeof(TestConvention)); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Conventions.Add(s => new TestConvention()); + c.Conventions.Remove(typeof(TestConvention)); + }); var model = modelBuilder.FinalizeModel(); @@ -435,12 +424,11 @@ public virtual void Conventions_can_be_removed() [ConditionalFact] public virtual void Conventions_can_be_removed_by_generic_method() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Conventions.Add(s => new TestConvention()); - c.Conventions.Remove(); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Conventions.Add(s => new TestConvention()); + c.Conventions.Remove(); + }); var model = modelBuilder.FinalizeModel(); @@ -450,10 +438,9 @@ public virtual void Conventions_can_be_removed_by_generic_method() [ConditionalFact] public virtual void Conventions_can_be_replaced() { - var modelBuilder = CreateModelBuilder( - c => - c.Conventions.Replace( - s => new TestDbSetFindingConvention(s.GetService()!))); + var modelBuilder = CreateModelBuilder(c => + c.Conventions.Replace(s + => new TestDbSetFindingConvention(s.GetService()!))); var model = modelBuilder.FinalizeModel(); @@ -519,12 +506,11 @@ public virtual void Can_add_shadow_properties_when_they_have_been_ignored() var modelBuilder = CreateModelBuilder(); modelBuilder.Ignore(); - modelBuilder.Entity( - b => - { - b.Ignore("Shadow"); - b.Property("Shadow"); - }); + modelBuilder.Entity(b => + { + b.Ignore("Shadow"); + b.Property("Shadow"); + }); var model = modelBuilder.FinalizeModel(); @@ -552,12 +538,11 @@ public virtual void Ignoring_a_navigation_property_removes_discovered_entity_typ { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(c => c.Details); - b.Ignore(c => c.Orders); - }); + modelBuilder.Entity(b => + { + b.Ignore(c => c.Details); + b.Ignore(c => c.Orders); + }); var model = modelBuilder.FinalizeModel(); @@ -569,12 +554,11 @@ public virtual void Ignoring_a_navigation_property_removes_discovered_relationsh { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(c => c.Details); - b.Ignore(c => c.Orders); - }); + modelBuilder.Entity(b => + { + b.Ignore(c => c.Details); + b.Ignore(c => c.Orders); + }); modelBuilder.Entity(b => b.Ignore(c => c.Customer)); var model = modelBuilder.FinalizeModel(); @@ -601,16 +585,15 @@ public virtual void Properties_can_be_made_required() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up).IsRequired(); - b.Property(e => e.Down).IsRequired(); - b.Property("Charm").IsRequired(); - b.Property("Strange").IsRequired(); - b.Property("Top").IsRequired(); - b.Property("Bottom").IsRequired(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up).IsRequired(); + b.Property(e => e.Down).IsRequired(); + b.Property("Charm").IsRequired(); + b.Property("Strange").IsRequired(); + b.Property("Top").IsRequired(); + b.Property("Bottom").IsRequired(); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks))!; @@ -628,13 +611,12 @@ public virtual void Properties_can_be_made_optional() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Down).IsRequired(false); - b.Property("Strange").IsRequired(false); - b.Property("Bottom").IsRequired(false); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Down).IsRequired(false); + b.Property("Strange").IsRequired(false); + b.Property("Bottom").IsRequired(false); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks))!; @@ -648,35 +630,32 @@ public virtual void Properties_can_be_made_optional() public virtual void Key_properties_cannot_be_made_optional() => Assert.Equal( CoreStrings.KeyPropertyCannotBeNullable(nameof(Quarks.Down), nameof(Quarks), "{'" + nameof(Quarks.Down) + "'}"), - Assert.Throws( - () => - CreateModelBuilder().Entity( - b => - { - b.HasAlternateKey(e => new { e.Down }); - b.Property(e => e.Down).IsRequired(false); - })).Message); + Assert.Throws(() => + CreateModelBuilder().Entity(b => + { + b.HasAlternateKey(e => new { e.Down }); + b.Property(e => e.Down).IsRequired(false); + })).Message); [ConditionalFact] public virtual void Non_nullable_properties_cannot_be_made_optional() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - Assert.Equal( - CoreStrings.CannotBeNullable("Up", "Quarks", "int"), - Assert.Throws(() => b.Property(e => e.Up).IsRequired(false)).Message); + modelBuilder.Entity(b => + { + Assert.Equal( + CoreStrings.CannotBeNullable("Up", "Quarks", "int"), + Assert.Throws(() => b.Property(e => e.Up).IsRequired(false)).Message); - Assert.Equal( - CoreStrings.CannotBeNullable("Charm", "Quarks", "int"), - Assert.Throws(() => b.Property("Charm").IsRequired(false)).Message); + Assert.Equal( + CoreStrings.CannotBeNullable("Charm", "Quarks", "int"), + Assert.Throws(() => b.Property("Charm").IsRequired(false)).Message); - Assert.Equal( - CoreStrings.CannotBeNullable("Top", "Quarks", "int"), - Assert.Throws(() => b.Property("Top").IsRequired(false)).Message); - }); + Assert.Equal( + CoreStrings.CannotBeNullable("Top", "Quarks", "int"), + Assert.Throws(() => b.Property("Top").IsRequired(false)).Message); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks))!; @@ -691,14 +670,13 @@ public virtual void Properties_specified_by_string_are_shadow_properties_unless_ { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property("Up"); - b.Property("Gluon"); - b.Property("Down"); - b.Property("Photon"); - }); + modelBuilder.Entity(b => + { + b.Property("Up"); + b.Property("Gluon"); + b.Property("Down"); + b.Property("Photon"); + }); var model = modelBuilder.FinalizeModel(); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(Quarks))!; @@ -720,20 +698,19 @@ public virtual void Properties_can_be_made_concurrency_tokens() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up).IsConcurrencyToken(); - b.Property(e => e.Down).IsConcurrencyToken(false); - b.Property("Charm").IsConcurrencyToken(); - b.Property("Strange").IsConcurrencyToken(false); - b.Property("Top").IsConcurrencyToken(); - b.Property("Bottom").IsConcurrencyToken(false); - b.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotifications); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up).IsConcurrencyToken(); + b.Property(e => e.Down).IsConcurrencyToken(false); + b.Property("Charm").IsConcurrencyToken(); + b.Property("Strange").IsConcurrencyToken(false); + b.Property("Top").IsConcurrencyToken(); + b.Property("Bottom").IsConcurrencyToken(false); + b.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotifications); + }); var model = modelBuilder.FinalizeModel(); - var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(Quarks))!; + var entityType = model.FindEntityType(typeof(Quarks))!; Assert.False(entityType.FindProperty(Customer.IdProperty.Name)!.IsConcurrencyToken); Assert.True(entityType.FindProperty("Up")!.IsConcurrencyToken); @@ -759,14 +736,13 @@ public virtual void Properties_can_have_access_mode_set() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up); - b.Property(e => e.Down).HasField("_forDown").UsePropertyAccessMode(PropertyAccessMode.Field); - b.Property("Charm").UsePropertyAccessMode(PropertyAccessMode.Property); - b.Property("Strange").UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up); + b.Property(e => e.Down).HasField("_forDown").UsePropertyAccessMode(PropertyAccessMode.Field); + b.Property("Charm").UsePropertyAccessMode(PropertyAccessMode.Property); + b.Property("Strange").UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks))!; @@ -784,20 +760,18 @@ public virtual void Access_mode_can_be_overridden_at_entity_and_property_levels( modelBuilder.UsePropertyAccessMode(PropertyAccessMode.Field); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id1); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id1); + }); modelBuilder.Ignore(); - modelBuilder.Entity( - b => - { - b.UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction); - b.Property(e => e.Up).UsePropertyAccessMode(PropertyAccessMode.Property); - b.Property(e => e.Down).HasField("_forDown"); - }); + modelBuilder.Entity(b => + { + b.UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction); + b.Property(e => e.Up).UsePropertyAccessMode(PropertyAccessMode.Property); + b.Property(e => e.Down).HasField("_forDown"); + }); var model = modelBuilder.FinalizeModel(); Assert.Equal(PropertyAccessMode.Field, model.GetPropertyAccessMode()); @@ -820,17 +794,16 @@ protected virtual void Properties_can_have_provider_type_set() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up); - b.Property(e => e.Down).HasConversion(); - b.Property("Charm").HasConversion>(); - b.Property("Strange").HasConversion( - new CustomValueComparer(), new CustomValueComparer()); - b.Property("Strange").HasConversion(null); - b.Property("Top").HasConversion(new CustomValueComparer()); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up); + b.Property(e => e.Down).HasConversion(); + b.Property("Charm").HasConversion>(); + b.Property("Strange").HasConversion( + new CustomValueComparer(), new CustomValueComparer()); + b.Property("Strange").HasConversion(null); + b.Property("Top").HasConversion(new CustomValueComparer()); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks))!; @@ -865,14 +838,13 @@ public virtual void Properties_can_have_provider_type_set_for_type() { var modelBuilder = CreateModelBuilder(c => c.Properties().HaveConversion()); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up); - b.Property(e => e.Down); - b.Property("Charm"); - b.Property("Strange"); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up); + b.Property(e => e.Down); + b.Property("Charm"); + b.Property("Strange"); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks))!; @@ -894,15 +866,14 @@ protected virtual void Properties_can_have_non_generic_value_converter_set(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up); - b.Property(e => e.Down).HasConversion(stringConverter); - b.Property("Charm").HasConversion(intConverter, null, new CustomValueComparer()); - b.Property("Strange").HasConversion(stringConverter); - b.Property("Strange").HasConversion(null); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up); + b.Property(e => e.Down).HasConversion(stringConverter); + b.Property("Charm").HasConversion(intConverter, null, new CustomValueComparer()); + b.Property("Strange").HasConversion(stringConverter); + b.Property("Strange").HasConversion(null); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks))!; @@ -930,16 +901,15 @@ protected virtual void Properties_can_have_custom_type_value_converter_type_set< { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up).HasConversion>(); - b.Property(e => e.Down) - .HasConversion, CustomValueComparer>(); - b.Property("Charm").HasConversion, CustomValueComparer>(); - b.Property("Strange").HasConversion>(); - b.Property("Strange").HasConversion(null, null); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up).HasConversion>(); + b.Property(e => e.Down) + .HasConversion, CustomValueComparer>(); + b.Property("Charm").HasConversion, CustomValueComparer>(); + b.Property("Strange").HasConversion>(); + b.Property("Strange").HasConversion(null, null); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks))!; @@ -975,15 +945,14 @@ public virtual void Properties_can_have_value_converter_set_inline() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up); - b.Property(e => e.Down).HasConversion(v => int.Parse(v!), v => v.ToString()); - b.Property("Charm").HasConversion(v => (long)v, v => (int)v, new CustomValueComparer()); - b.Property("Strange").HasConversion( - v => (double)v, v => (float)v, new CustomValueComparer(), new CustomValueComparer()); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up); + b.Property(e => e.Down).HasConversion(v => int.Parse(v!), v => v.ToString()); + b.Property("Charm").HasConversion(v => (long)v, v => (int)v, new CustomValueComparer()); + b.Property("Strange").HasConversion( + v => (double)v, v => (float)v, new CustomValueComparer(), new CustomValueComparer()); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1002,7 +971,7 @@ public virtual void Properties_can_have_value_converter_set_inline() var charm = entityType.FindProperty("Charm")!; Assert.IsType>(charm.GetValueConverter()); Assert.IsType>(charm.GetValueComparer()); - Assert.True(charm.GetProviderValueComparer()?.IsDefault()); + Assert.True(charm.GetProviderValueComparer().IsDefault()); var strange = entityType.FindProperty("Strange")!; Assert.IsType>(strange.GetValueConverter()); @@ -1015,18 +984,17 @@ public virtual void Properties_can_have_value_converter_set() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up); - b.Property(e => e.Down).HasConversion( - new ValueConverter(v => int.Parse(v), v => v.ToString())!); - b.Property("Charm").HasConversion( - new ValueConverter(v => v, v => (int)v), new CustomValueComparer()); - b.Property("Strange").HasConversion( - new ValueConverter(v => v, v => (float)v), new CustomValueComparer(), - new CustomValueComparer()); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up); + b.Property(e => e.Down).HasConversion( + new ValueConverter(v => int.Parse(v), v => v.ToString())!); + b.Property("Charm").HasConversion( + new ValueConverter(v => v, v => (int)v), new CustomValueComparer()); + b.Property("Strange").HasConversion( + new ValueConverter(v => v, v => (float)v), new CustomValueComparer(), + new CustomValueComparer()); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1034,13 +1002,13 @@ public virtual void Properties_can_have_value_converter_set() var up = entityType.FindProperty("Up")!; Assert.Null(up.GetProviderClrType()); Assert.Null(up.GetValueConverter()); - Assert.True(up.GetValueComparer()?.IsDefault()); - Assert.True(up.GetProviderValueComparer()?.IsDefault()); + Assert.True(up.GetValueComparer().IsDefault()); + Assert.True(up.GetProviderValueComparer().IsDefault()); var down = entityType.FindProperty("Down")!; Assert.IsType>(down.GetValueConverter()); - Assert.True(down.GetValueComparer()?.IsDefault()); - Assert.True(down.GetProviderValueComparer()?.IsDefault()); + Assert.True(down.GetValueComparer().IsDefault()); + Assert.True(down.GetProviderValueComparer().IsDefault()); var charm = entityType.FindProperty("Charm")!; Assert.IsType>(charm.GetValueConverter()); @@ -1058,22 +1026,21 @@ public virtual void IEnumerable_properties_with_value_converter_set_are_not_disc { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.ExpandoObject).HasConversion( - v => (string)((IDictionary)v!)["Value"], v => DeserializeExpandoObject(v)); + modelBuilder.Entity(b => + { + b.Property(e => e.ExpandoObject).HasConversion( + v => (string)((IDictionary)v!)["Value"], v => DeserializeExpandoObject(v)); - var comparer = new ValueComparer( - (v1, v2) => v1!.SequenceEqual(v2!), - v => v.GetHashCode()); + var comparer = new ValueComparer( + (v1, v2) => v1!.SequenceEqual(v2!), + v => v.GetHashCode()); - b.Property(e => e.ExpandoObject).Metadata.SetValueComparer(comparer); - }); + b.Property(e => e.ExpandoObject).Metadata.SetValueComparer(comparer); + }); var model = modelBuilder.FinalizeModel(); - var entityType = (IReadOnlyEntityType)model.GetEntityTypes().Single(); + IReadOnlyEntityType entityType = model.GetEntityTypes().Single(); Assert.NotNull(entityType.FindProperty(nameof(DynamicProperty.ExpandoObject))!.GetValueConverter()); Assert.NotNull(entityType.FindProperty(nameof(DynamicProperty.ExpandoObject))!.GetValueComparer()); } @@ -1094,13 +1061,12 @@ private class ExpandoObjectComparer() : ValueComparer((v1, v2) => [ConditionalFact] public virtual void Properties_can_have_value_converter_configured_by_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties(typeof(IWrapped<>)).AreUnicode(false); - c.Properties().HaveMaxLength(20); - c.Properties().HaveConversion(typeof(WrappedStringToStringConverter)); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties(typeof(IWrapped<>)).AreUnicode(false); + c.Properties().HaveMaxLength(20); + c.Properties().HaveConversion(typeof(WrappedStringToStringConverter)); + }); modelBuilder.Entity(); @@ -1117,11 +1083,10 @@ public virtual void Properties_can_have_value_converter_configured_by_type() [ConditionalFact] public virtual void Value_converter_configured_on_non_nullable_type_is_applied() { - var modelBuilder = CreateModelBuilder( - c => c.Properties().HaveConversion, CustomValueComparer>()); + var modelBuilder = CreateModelBuilder(c + => c.Properties().HaveConversion, CustomValueComparer>()); - modelBuilder.Entity( - b => b.Property("Wierd")); + modelBuilder.Entity(b => b.Property("Wierd")); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1138,19 +1103,17 @@ public virtual void Value_converter_configured_on_non_nullable_type_is_applied() [ConditionalFact] public virtual void Value_converter_configured_on_nullable_type_overrides_non_nullable() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveConversion, CustomValueComparer>(); - c.Properties() - .HaveConversion, CustomValueComparer, CustomValueComparer>(); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveConversion, CustomValueComparer>(); + c.Properties() + .HaveConversion, CustomValueComparer, CustomValueComparer>(); + }); - modelBuilder.Entity( - b => - { - b.Property("Wierd"); - }); + modelBuilder.Entity(b => + { + b.Property("Wierd"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1169,11 +1132,10 @@ public virtual void Value_converter_configured_on_nullable_type_overrides_non_nu [ConditionalFact] public virtual void Value_converter_configured_on_base_type_is_not_applied() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveConversion(typeof(WrappedStringToStringConverter)); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveConversion(typeof(WrappedStringToStringConverter)); + }); modelBuilder.Entity(); @@ -1191,12 +1153,11 @@ private class WrappedStringToStringConverter() [ConditionalFact] public virtual void Throws_for_conflicting_base_configurations_by_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties(); - c.IgnoreAny>(); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties(); + c.IgnoreAny>(); + }); Assert.Equal( CoreStrings.TypeConfigurationConflict( @@ -1210,15 +1171,13 @@ public virtual void Value_converter_type_is_checked() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - Assert.Equal( - CoreStrings.ConverterPropertyMismatch("string", "Quarks", "Up", "int"), - Assert.Throws( - () => b.Property(e => e.Up).HasConversion( - new StringToBytesConverter(Encoding.UTF8))).Message); - }); + modelBuilder.Entity(b => + { + Assert.Equal( + CoreStrings.ConverterPropertyMismatch("string", "Quarks", "Up", "int"), + Assert.Throws(() => b.Property(e => e.Up).HasConversion( + new StringToBytesConverter(Encoding.UTF8))).Message); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1230,13 +1189,12 @@ public virtual void Properties_can_have_field_set() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property("Up").HasField("_forUp"); - b.Property(e => e.Down).HasField("_forDown"); - b.Property("_forWierd").HasField("_forWierd"); - }); + modelBuilder.Entity(b => + { + b.Property("Up").HasField("_forUp"); + b.Property(e => e.Down).HasField("_forDown"); + b.Property("_forWierd").HasField("_forWierd"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1251,13 +1209,12 @@ public virtual void HasField_throws_if_field_is_not_found() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - Assert.Equal( - CoreStrings.MissingBackingField("_notFound", nameof(Quarks.Down), nameof(Quarks)), - Assert.Throws(() => b.Property(e => e.Down).HasField("_notFound")).Message); - }); + modelBuilder.Entity(b => + { + Assert.Equal( + CoreStrings.MissingBackingField("_notFound", nameof(Quarks.Down), nameof(Quarks)), + Assert.Throws(() => b.Property(e => e.Down).HasField("_notFound")).Message); + }); } [ConditionalFact] @@ -1265,13 +1222,12 @@ public virtual void HasField_throws_if_field_is_wrong_type() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - Assert.Equal( - CoreStrings.BadBackingFieldType("_forUp", "int", nameof(Quarks), nameof(Quarks.Down), "string"), - Assert.Throws(() => b.Property(e => e.Down).HasField("_forUp")).Message); - }); + modelBuilder.Entity(b => + { + Assert.Equal( + CoreStrings.BadBackingFieldType("_forUp", "int", nameof(Quarks), nameof(Quarks.Down), "string"), + Assert.Throws(() => b.Property(e => e.Down).HasField("_forUp")).Message); + }); } [ConditionalFact] @@ -1279,17 +1235,16 @@ public virtual void Properties_can_be_set_to_generate_values_on_Add() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id); - b.Property(e => e.Up).ValueGeneratedOnAddOrUpdate(); - b.Property(e => e.Down).ValueGeneratedNever(); - b.Property("Charm").Metadata.ValueGenerated = ValueGenerated.OnUpdateSometimes; - b.Property("Strange").ValueGeneratedNever(); - b.Property("Top").ValueGeneratedOnAddOrUpdate(); - b.Property("Bottom").ValueGeneratedOnUpdate(); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id); + b.Property(e => e.Up).ValueGeneratedOnAddOrUpdate(); + b.Property(e => e.Down).ValueGeneratedNever(); + b.Property("Charm").Metadata.ValueGenerated = ValueGenerated.OnUpdateSometimes; + b.Property("Strange").ValueGeneratedNever(); + b.Property("Top").ValueGeneratedOnAddOrUpdate(); + b.Property("Bottom").ValueGeneratedOnUpdate(); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1307,14 +1262,13 @@ public virtual void Properties_can_set_row_version() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id); - b.Property(e => e.Up).IsRowVersion(); - b.Property(e => e.Down).ValueGeneratedNever(); - b.Property("Charm").IsRowVersion(); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id); + b.Property(e => e.Up).IsRowVersion(); + b.Property(e => e.Down).ValueGeneratedNever(); + b.Property("Charm").IsRowVersion(); + }); var model = modelBuilder.FinalizeModel(); @@ -1334,16 +1288,15 @@ public virtual void Can_set_max_length_for_properties() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up).HasMaxLength(0); - b.Property(e => e.Down).HasMaxLength(100); - b.Property("Charm").HasMaxLength(0); - b.Property("Strange").HasMaxLength(-1); - b.Property("Top").HasMaxLength(0); - b.Property("Bottom").HasMaxLength(100); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up).HasMaxLength(0); + b.Property(e => e.Down).HasMaxLength(100); + b.Property("Charm").HasMaxLength(0); + b.Property("Strange").HasMaxLength(-1); + b.Property("Top").HasMaxLength(0); + b.Property("Bottom").HasMaxLength(100); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1360,21 +1313,19 @@ public virtual void Can_set_max_length_for_properties() [ConditionalFact] public virtual void Can_set_max_length_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveMaxLength(0); - c.Properties().HaveMaxLength(100); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveMaxLength(0); + c.Properties().HaveMaxLength(100); + }); - modelBuilder.Entity( - b => - { - b.Property("Charm"); - b.Property("Strange"); - b.Property("Top"); - b.Property("Bottom"); - }); + modelBuilder.Entity(b => + { + b.Property("Charm"); + b.Property("Strange"); + b.Property("Top"); + b.Property("Bottom"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1393,16 +1344,15 @@ public virtual void Can_set_sentinel_for_properties() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up).HasSentinel(1); - b.Property(e => e.Down).HasSentinel("100"); - b.Property("Charm").HasSentinel(-1); - b.Property("Strange").HasSentinel(""); - b.Property("Top").HasSentinel(77); - b.Property("Bottom").HasSentinel(null); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up).HasSentinel(1); + b.Property(e => e.Down).HasSentinel("100"); + b.Property("Charm").HasSentinel(-1); + b.Property("Strange").HasSentinel(""); + b.Property("Top").HasSentinel(77); + b.Property("Bottom").HasSentinel(null); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1421,15 +1371,14 @@ public virtual void Setting_sentinel_throws_for_null_on_nonnullable() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property("Top").Metadata.Sentinel = 77D; - b.Property("Charm").Metadata.Sentinel = EnumerablePartitionerOptions.NoBuffering; - Assert.Equal( - CoreStrings.IncompatibleSentinelValue("null", nameof(Quarks), nameof(Quarks.Up), "int"), - Assert.Throws(() => b.Property(e => e.Up).Metadata.Sentinel = null).Message); - }); + modelBuilder.Entity(b => + { + b.Property("Top").Metadata.Sentinel = 77D; + b.Property("Charm").Metadata.Sentinel = EnumerablePartitionerOptions.NoBuffering; + Assert.Equal( + CoreStrings.IncompatibleSentinelValue("null", nameof(Quarks), nameof(Quarks.Up), "int"), + Assert.Throws(() => b.Property(e => e.Up).Metadata.Sentinel = null).Message); + }); } [ConditionalFact] @@ -1437,34 +1386,31 @@ public virtual void Setting_sentinel_throws_for_noncompatible() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - Assert.Equal( - CoreStrings.IncompatibleSentinelValue("System.Byte[]", nameof(Quarks), nameof(Quarks.Up), "int"), - Assert.Throws(() => b.Property(e => e.Up).Metadata.Sentinel = Array.Empty()) - .Message); - }); + modelBuilder.Entity(b => + { + Assert.Equal( + CoreStrings.IncompatibleSentinelValue("System.Byte[]", nameof(Quarks), nameof(Quarks.Up), "int"), + Assert.Throws(() => b.Property(e => e.Up).Metadata.Sentinel = Array.Empty()) + .Message); + }); } [ConditionalFact] public virtual void Can_set_sentinel_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveSentinel(-1); - c.Properties().HaveSentinel("100"); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveSentinel(-1); + c.Properties().HaveSentinel("100"); + }); - modelBuilder.Entity( - b => - { - b.Property("Charm"); - b.Property("Strange"); - b.Property("Top"); - b.Property("Bottom"); - }); + modelBuilder.Entity(b => + { + b.Property("Charm"); + b.Property("Strange"); + b.Property("Top"); + b.Property("Bottom"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1481,21 +1427,19 @@ public virtual void Can_set_sentinel_for_property_type() [ConditionalFact] public virtual void Can_set_unbounded_max_length_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveMaxLength(0); - c.Properties().HaveMaxLength(-1); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveMaxLength(0); + c.Properties().HaveMaxLength(-1); + }); - modelBuilder.Entity( - b => - { - b.Property("Charm"); - b.Property("Strange"); - b.Property("Top"); - b.Property("Bottom"); - }); + modelBuilder.Entity(b => + { + b.Property("Charm"); + b.Property("Strange"); + b.Property("Top"); + b.Property("Bottom"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1514,16 +1458,15 @@ public virtual void Can_set_precision_and_scale_for_properties() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up).HasPrecision(1, 0); - b.Property(e => e.Down).HasPrecision(100, 10); - b.Property("Charm").HasPrecision(1, 0); - b.Property("Strange").HasPrecision(100, 10); - b.Property("Top").HasPrecision(1, 0); - b.Property("Bottom").HasPrecision(100, 10); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up).HasPrecision(1, 0); + b.Property(e => e.Down).HasPrecision(100, 10); + b.Property("Charm").HasPrecision(1, 0); + b.Property("Strange").HasPrecision(100, 10); + b.Property("Top").HasPrecision(1, 0); + b.Property("Bottom").HasPrecision(100, 10); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1547,21 +1490,19 @@ public virtual void Can_set_precision_and_scale_for_properties() [ConditionalFact] public virtual void Can_set_precision_and_scale_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HavePrecision(1, 0); - c.Properties().HavePrecision(100, 10); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HavePrecision(1, 0); + c.Properties().HavePrecision(100, 10); + }); - modelBuilder.Entity( - b => - { - b.Property("Charm"); - b.Property("Strange"); - b.Property("Top"); - b.Property("Bottom"); - }); + modelBuilder.Entity(b => + { + b.Property("Charm"); + b.Property("Strange"); + b.Property("Top"); + b.Property("Bottom"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1587,16 +1528,15 @@ public virtual void Can_set_custom_value_generator_for_properties() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up).HasValueGenerator(); - b.Property(e => e.Down).HasValueGenerator(typeof(CustomValueGenerator)); - b.Property("Charm").HasValueGenerator((_, __) => new CustomValueGenerator()); - b.Property("Strange").HasValueGenerator(); - b.Property("Top").HasValueGeneratorFactory(typeof(CustomValueGeneratorFactory)); - b.Property("Bottom").HasValueGeneratorFactory(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up).HasValueGenerator(); + b.Property(e => e.Down).HasValueGenerator(typeof(CustomValueGenerator)); + b.Property("Charm").HasValueGenerator((_, __) => new CustomValueGenerator()); + b.Property("Strange").HasValueGenerator(); + b.Property("Top").HasValueGeneratorFactory(typeof(CustomValueGeneratorFactory)); + b.Property("Bottom").HasValueGeneratorFactory(); + }); var model = modelBuilder.FinalizeModel(); @@ -1631,13 +1571,12 @@ public virtual void Throws_for_bad_value_generator_type() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - Assert.Equal( - CoreStrings.BadValueGeneratorType(nameof(Random), nameof(ValueGenerator)), - Assert.Throws(() => b.Property(e => e.Down).HasValueGenerator(typeof(Random))).Message); - }); + modelBuilder.Entity(b => + { + Assert.Equal( + CoreStrings.BadValueGeneratorType(nameof(Random), nameof(ValueGenerator)), + Assert.Throws(() => b.Property(e => e.Down).HasValueGenerator(typeof(Random))).Message); + }); } [ConditionalFact] @@ -1646,24 +1585,23 @@ public virtual void Throws_for_value_generator_that_cannot_be_constructed() var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => - { - b.Property(e => e.Up).HasValueGenerator(); - b.Property(e => e.Down).HasValueGenerator(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up).HasValueGenerator(); + b.Property(e => e.Down).HasValueGenerator(); + }); var entityType = model.FindEntityType(typeof(Quarks))!; Assert.Equal( CoreStrings.CannotCreateValueGenerator(nameof(BadCustomValueGenerator1), "HasValueGenerator"), - Assert.Throws( - () => entityType.FindProperty("Up")!.GetValueGeneratorFactory()!(null!, null!)).Message); + Assert.Throws(() => entityType.FindProperty("Up")!.GetValueGeneratorFactory()!(null!, null!)) + .Message); Assert.Equal( CoreStrings.CannotCreateValueGenerator(nameof(BadCustomValueGenerator2), "HasValueGenerator"), - Assert.Throws( - () => entityType.FindProperty("Down")!.GetValueGeneratorFactory()!(null!, null!)).Message); + Assert.Throws(() => entityType.FindProperty("Down")!.GetValueGeneratorFactory()!(null!, null!)) + .Message); } #pragma warning disable CS9113 // Parameter 'foo' is unread @@ -1789,16 +1727,15 @@ public virtual void Can_set_unicode_for_properties() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Up).IsUnicode(); - b.Property(e => e.Down).IsUnicode(false); - b.Property("Charm").IsUnicode(); - b.Property("Strange").IsUnicode(false); - b.Property("Top").IsUnicode(); - b.Property("Bottom").IsUnicode(false); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Up).IsUnicode(); + b.Property(e => e.Down).IsUnicode(false); + b.Property("Charm").IsUnicode(); + b.Property("Strange").IsUnicode(false); + b.Property("Top").IsUnicode(); + b.Property("Bottom").IsUnicode(false); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1815,21 +1752,19 @@ public virtual void Can_set_unicode_for_properties() [ConditionalFact] public virtual void Can_set_unicode_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().AreUnicode(); - c.Properties().AreUnicode(false); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().AreUnicode(); + c.Properties().AreUnicode(false); + }); - modelBuilder.Entity( - b => - { - b.Property("Charm"); - b.Property("Strange"); - b.Property("Top"); - b.Property("Bottom"); - }); + modelBuilder.Entity(b => + { + b.Property("Charm"); + b.Property("Strange"); + b.Property("Top"); + b.Property("Bottom"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -1890,12 +1825,11 @@ public virtual void Can_add_index_when_no_clr_property() modelBuilder.Ignore(); modelBuilder - .Entity( - b => - { - b.Property("Index"); - b.HasIndex("Index"); - }); + .Entity(b => + { + b.Property("Index"); + b.HasIndex("Index"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Customer))!; @@ -1942,10 +1876,8 @@ public virtual void Can_add_contained_indexes() modelBuilder.Ignore(); var entityBuilder = modelBuilder.Entity(); - var firstIndexBuilder = entityBuilder.HasIndex( - ix => new { ix.Id, ix.AlternateKey }).IsUnique(); - var secondIndexBuilder = entityBuilder.HasIndex( - ix => new { ix.Id }); + var firstIndexBuilder = entityBuilder.HasIndex(ix => new { ix.Id, ix.AlternateKey }).IsUnique(); + var secondIndexBuilder = entityBuilder.HasIndex(ix => new { ix.Id }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Customer))!; @@ -1970,7 +1902,7 @@ public virtual void Can_set_primary_key_by_convention_for_user_specified_shadow_ entityBuilder.Property("Id"); Assert.NotNull(entityType.FindPrimaryKey()); - Assert.Equal(new[] { "Id" }, entityType.FindPrimaryKey()!.Properties.Select(p => p.Name)); + Assert.Equal(["Id"], entityType.FindPrimaryKey()!.Properties.Select(p => p.Name)); } [ConditionalFact] @@ -2036,7 +1968,7 @@ public virtual void Can_set_alternate_key_on_an_entity_with_fields() modelBuilder.Entity().HasAlternateKey(e => e.CompanyId); var entity = modelBuilder.Model.FindEntityType(typeof(EntityWithFields))!; - var properties = entity.GetProperties().Where(p => !p.IsShadowProperty()); + var properties = entity.GetProperties().Where(p => !p.IsShadowProperty()).ToList(); Assert.Single(properties); var property = properties.Single(); Assert.Equal(nameof(EntityWithFields.CompanyId), property.Name); @@ -2156,16 +2088,14 @@ public virtual void Can_ignore_a_field_on_a_keyless_entity_with_fields() public virtual void Can_add_seed_data_objects() { var modelBuilder = CreateModelBuilder(); - var model = modelBuilder.Model; modelBuilder.Ignore(); - modelBuilder.Entity( - c => - { - c.HasData( - new Beta { Id = -1, Name = " -1" }); - var customers = new List { new() { Id = -2 } }; - c.HasData(customers); - }); + modelBuilder.Entity(c => + { + c.HasData( + new Beta { Id = -1, Name = " -1" }); + var customers = new List { new() { Id = -2 } }; + c.HasData(customers); + }); var finalModel = modelBuilder.FinalizeModel(); @@ -2184,14 +2114,13 @@ public virtual void Can_add_seed_data_anonymous_objects() { var modelBuilder = CreateModelBuilder(); modelBuilder.Ignore(); - modelBuilder.Entity( - c => - { - c.HasData( - new { Id = -1 }); - var customers = new List { new { Id = -2 } }; - c.HasData(customers); - }); + modelBuilder.Entity(c => + { + c.HasData( + new { Id = -1 }); + var customers = new List { new { Id = -2 } }; + c.HasData(customers); + }); var model = modelBuilder.FinalizeModel(); @@ -2207,15 +2136,13 @@ public virtual void Can_add_seed_data_objects_indexed_property() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.IndexerProperty("Required"); - b.IndexerProperty("Optional"); - var d = new IndexedClass { Id = -1 }; - d["Required"] = 2; - b.HasData(d); - }); + modelBuilder.Entity(b => + { + b.IndexerProperty("Required"); + b.IndexerProperty("Optional"); + var d = new IndexedClass { Id = -1, ["Required"] = 2 }; + b.HasData(d); + }); var model = modelBuilder.FinalizeModel(); @@ -2231,13 +2158,12 @@ public virtual void Can_add_seed_data_anonymous_objects_indexed_property() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.IndexerProperty("Required"); - b.IndexerProperty("Optional"); - b.HasData(new { Id = -1, Required = 2 }); - }); + modelBuilder.Entity(b => + { + b.IndexerProperty("Required"); + b.IndexerProperty("Optional"); + b.HasData(new { Id = -1, Required = 2 }); + }); var model = modelBuilder.FinalizeModel(); @@ -2252,15 +2178,13 @@ public virtual void Can_add_seed_data_anonymous_objects_indexed_property() public virtual void Can_add_seed_data_objects_indexed_property_dictionary() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.IndexerProperty("Required"); - b.IndexerProperty("Optional"); - var d = new IndexedClassByDictionary { Id = -1 }; - d["Required"] = 2; - b.HasData(d); - }); + modelBuilder.Entity(b => + { + b.IndexerProperty("Required"); + b.IndexerProperty("Optional"); + var d = new IndexedClassByDictionary { Id = -1, ["Required"] = 2 }; + b.HasData(d); + }); var model = modelBuilder.FinalizeModel(); @@ -2275,13 +2199,12 @@ public virtual void Can_add_seed_data_objects_indexed_property_dictionary() public virtual void Can_add_seed_data_anonymous_objects_indexed_property_dictionary() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.IndexerProperty("Required"); - b.IndexerProperty("Optional"); - b.HasData(new { Id = -1, Required = 2 }); - }); + modelBuilder.Entity(b => + { + b.IndexerProperty("Required"); + b.IndexerProperty("Optional"); + b.HasData(new { Id = -1, Required = 2 }); + }); var model = modelBuilder.FinalizeModel(); @@ -2292,8 +2215,7 @@ public virtual void Can_add_seed_data_anonymous_objects_indexed_property_diction Assert.False(data.ContainsKey("Optional")); } - [ConditionalFact] //Issue#12617 - [UseCulture("de-DE")] + [ConditionalFact, UseCulture("de-DE")] //Issue#12617 public virtual void EntityType_name_is_stored_culture_invariantly() { var modelBuilder = CreateModelBuilder(); @@ -2409,7 +2331,7 @@ public virtual void Can_set_primitive_collection_annotation_by_type() var modelBuilder = CreateModelBuilder(c => c.Properties().HaveAnnotation("foo", "bar")); modelBuilder.Ignore(); - var propertyBuilder = modelBuilder + modelBuilder .Entity() .PrimitiveCollection(c => c.Notes); @@ -2423,14 +2345,13 @@ public virtual void Primitive_collections_are_required_by_default_only_if_CLR_ty { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up); - b.PrimitiveCollection(e => e.Down); - b.PrimitiveCollection>("Charm"); - b.PrimitiveCollection?>("Strange"); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up); + b.PrimitiveCollection(e => e.Down); + b.PrimitiveCollection>("Charm"); + b.PrimitiveCollection?>("Strange"); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; @@ -2445,14 +2366,13 @@ public virtual void Primitive_collections_can_be_ignored() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.Up); - b.Ignore(e => e.Down); - b.Ignore("Charm"); - b.Ignore("Strange"); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.Up); + b.Ignore(e => e.Down); + b.Ignore("Charm"); + b.Ignore("Strange"); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; Assert.Contains(nameof(CollectionQuarks.Id), entityType.GetProperties().Select(p => p.Name)); @@ -2483,14 +2403,13 @@ public virtual void Primitive_collections_can_be_made_required() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).IsRequired(); - b.PrimitiveCollection(e => e.Down).IsRequired(); - b.PrimitiveCollection>("Charm").IsRequired(); - b.PrimitiveCollection?>("Strange").IsRequired(); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).IsRequired(); + b.PrimitiveCollection(e => e.Down).IsRequired(); + b.PrimitiveCollection>("Charm").IsRequired(); + b.PrimitiveCollection?>("Strange").IsRequired(); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(CollectionQuarks))!; @@ -2506,14 +2425,13 @@ public virtual void Primitive_collections_can_be_made_optional() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).IsRequired(false); - b.PrimitiveCollection(e => e.Down).IsRequired(false); - b.PrimitiveCollection>("Charm").IsRequired(false); - b.PrimitiveCollection?>("Strange").IsRequired(false); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).IsRequired(false); + b.PrimitiveCollection(e => e.Down).IsRequired(false); + b.PrimitiveCollection>("Charm").IsRequired(false); + b.PrimitiveCollection?>("Strange").IsRequired(false); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(CollectionQuarks))!; @@ -2529,28 +2447,25 @@ public virtual void PrimitiveCollection_Key_properties_cannot_be_made_optional() => Assert.Equal( CoreStrings.KeyPropertyCannotBeNullable( nameof(CollectionQuarks.Down), nameof(CollectionQuarks), "{'" + nameof(CollectionQuarks.Down) + "'}"), - Assert.Throws( - () => - CreateModelBuilder().Entity( - b => - { - b.HasAlternateKey(e => new { e.Down }); - b.PrimitiveCollection(e => e.Down).IsRequired(false); - })).Message); + Assert.Throws(() => + CreateModelBuilder().Entity(b => + { + b.HasAlternateKey(e => new { e.Down }); + b.PrimitiveCollection(e => e.Down).IsRequired(false); + })).Message); [ConditionalFact] public virtual void Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection>("Up"); - b.PrimitiveCollection?>("Down"); - b.PrimitiveCollection>("Charm"); - b.PrimitiveCollection?>("Strange"); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection>("Up"); + b.PrimitiveCollection?>("Down"); + b.PrimitiveCollection>("Charm"); + b.PrimitiveCollection?>("Strange"); + }); var model = modelBuilder.FinalizeModel(); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; @@ -2571,18 +2486,17 @@ public virtual void Primitive_collections_can_be_made_concurrency_tokens() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).IsConcurrencyToken(); - b.PrimitiveCollection(e => e.Down).IsConcurrencyToken(false); - b.PrimitiveCollection>("Charm").IsConcurrencyToken(); - b.PrimitiveCollection?>("Strange").IsConcurrencyToken(false); - b.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotifications); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).IsConcurrencyToken(); + b.PrimitiveCollection(e => e.Down).IsConcurrencyToken(false); + b.PrimitiveCollection>("Charm").IsConcurrencyToken(); + b.PrimitiveCollection?>("Strange").IsConcurrencyToken(false); + b.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotifications); + }); var model = modelBuilder.FinalizeModel(); - var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; + var entityType = model.FindEntityType(typeof(CollectionQuarks))!; Assert.True(entityType.FindProperty("Up")!.IsConcurrencyToken); Assert.False(entityType.FindProperty("Down")!.IsConcurrencyToken); @@ -2597,15 +2511,14 @@ public virtual void Primitive_collections_can_have_access_mode_set() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up); - b.PrimitiveCollection(e => e.Down).HasField("_forDown").UsePropertyAccessMode(PropertyAccessMode.Field); - b.PrimitiveCollection>("Charm").UsePropertyAccessMode(PropertyAccessMode.Property); - b.PrimitiveCollection?>("Strange") - .UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up); + b.PrimitiveCollection(e => e.Down).HasField("_forDown").UsePropertyAccessMode(PropertyAccessMode.Field); + b.PrimitiveCollection>("Charm").UsePropertyAccessMode(PropertyAccessMode.Property); + b.PrimitiveCollection?>("Strange") + .UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(CollectionQuarks))!; @@ -2623,13 +2536,12 @@ public virtual void Access_mode_can_be_overridden_at_entity_and_primitive_collec modelBuilder.UsePropertyAccessMode(PropertyAccessMode.Field); - modelBuilder.Entity( - b => - { - b.UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction); - b.PrimitiveCollection(e => e.Up).UsePropertyAccessMode(PropertyAccessMode.Property); - b.PrimitiveCollection(e => e.Down).HasField("_forDown"); - }); + modelBuilder.Entity(b => + { + b.UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction); + b.PrimitiveCollection(e => e.Up).UsePropertyAccessMode(PropertyAccessMode.Property); + b.PrimitiveCollection(e => e.Down).HasField("_forDown"); + }); var model = modelBuilder.FinalizeModel(); Assert.Equal(PropertyAccessMode.Field, model.GetPropertyAccessMode()); @@ -2645,13 +2557,12 @@ public virtual void Primitive_collections_can_have_field_set() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection>("Up").HasField("_forUp"); - b.PrimitiveCollection(e => e.Down).HasField("_forDown"); - b.PrimitiveCollection?>("_forWierd").HasField("_forWierd"); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection>("Up").HasField("_forUp"); + b.PrimitiveCollection(e => e.Down).HasField("_forDown"); + b.PrimitiveCollection?>("_forWierd").HasField("_forWierd"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; @@ -2666,13 +2577,12 @@ public virtual void HasField_for_primitive_collection_throws_if_field_is_not_fou { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - Assert.Equal( - CoreStrings.MissingBackingField("_notFound", nameof(CollectionQuarks.Down), nameof(CollectionQuarks)), - Assert.Throws(() => b.PrimitiveCollection(e => e.Down).HasField("_notFound")).Message); - }); + modelBuilder.Entity(b => + { + Assert.Equal( + CoreStrings.MissingBackingField("_notFound", nameof(CollectionQuarks.Down), nameof(CollectionQuarks)), + Assert.Throws(() => b.PrimitiveCollection(e => e.Down).HasField("_notFound")).Message); + }); } [ConditionalFact] @@ -2680,15 +2590,14 @@ public virtual void HasField_for_primitive_collection_throws_if_field_is_wrong_t { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - Assert.Equal( - CoreStrings.BadBackingFieldType( - "_forUp", "ObservableCollection", nameof(CollectionQuarks), nameof(CollectionQuarks.Down), - "ObservableCollection"), - Assert.Throws(() => b.PrimitiveCollection(e => e.Down).HasField("_forUp")).Message); - }); + modelBuilder.Entity(b => + { + Assert.Equal( + CoreStrings.BadBackingFieldType( + "_forUp", "ObservableCollection", nameof(CollectionQuarks), nameof(CollectionQuarks.Down), + "ObservableCollection"), + Assert.Throws(() => b.PrimitiveCollection(e => e.Down).HasField("_forUp")).Message); + }); } [ConditionalFact] @@ -2696,17 +2605,16 @@ public virtual void Primitive_collections_can_be_set_to_generate_values_on_Add() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Id); - b.PrimitiveCollection(e => e.Up).ValueGeneratedOnAddOrUpdate(); - b.PrimitiveCollection(e => e.Down).ValueGeneratedNever(); - b.PrimitiveCollection>("Charm").Metadata.ValueGenerated = ValueGenerated.OnUpdateSometimes; - b.PrimitiveCollection>("Strange").ValueGeneratedNever(); - b.PrimitiveCollection>("Top").ValueGeneratedOnAddOrUpdate(); - b.PrimitiveCollection>("Bottom").ValueGeneratedOnUpdate(); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Id); + b.PrimitiveCollection(e => e.Up).ValueGeneratedOnAddOrUpdate(); + b.PrimitiveCollection(e => e.Down).ValueGeneratedNever(); + b.PrimitiveCollection>("Charm").Metadata.ValueGenerated = ValueGenerated.OnUpdateSometimes; + b.PrimitiveCollection>("Strange").ValueGeneratedNever(); + b.PrimitiveCollection>("Top").ValueGeneratedOnAddOrUpdate(); + b.PrimitiveCollection>("Bottom").ValueGeneratedOnUpdate(); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; @@ -2723,16 +2631,15 @@ public virtual void Can_set_max_length_for_primitive_collections() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).HasMaxLength(0); - b.PrimitiveCollection(e => e.Down).HasMaxLength(100); - b.PrimitiveCollection>("Charm").HasMaxLength(0); - b.PrimitiveCollection>("Strange").HasMaxLength(-1); - b.PrimitiveCollection("Top").HasMaxLength(0); - b.PrimitiveCollection("Bottom").HasMaxLength(100); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).HasMaxLength(0); + b.PrimitiveCollection(e => e.Down).HasMaxLength(100); + b.PrimitiveCollection>("Charm").HasMaxLength(0); + b.PrimitiveCollection>("Strange").HasMaxLength(-1); + b.PrimitiveCollection("Top").HasMaxLength(0); + b.PrimitiveCollection("Bottom").HasMaxLength(100); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; @@ -2751,16 +2658,15 @@ public virtual void Can_set_sentinel_for_primitive_collections() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).HasSentinel(null); - b.PrimitiveCollection(e => e.Down).HasSentinel(new ObservableCollection()); - b.PrimitiveCollection("Charm").HasSentinel([]); - b.PrimitiveCollection>("Strange").HasSentinel(new List()); - b.PrimitiveCollection("Top").HasSentinel([77]); - b.PrimitiveCollection>("Bottom").HasSentinel(new List { "" }); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).HasSentinel(null); + b.PrimitiveCollection(e => e.Down).HasSentinel([]); + b.PrimitiveCollection("Charm").HasSentinel([]); + b.PrimitiveCollection>("Strange").HasSentinel([]); + b.PrimitiveCollection("Top").HasSentinel([77]); + b.PrimitiveCollection>("Bottom").HasSentinel([""]); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; @@ -2779,15 +2685,14 @@ public virtual void Can_set_custom_value_generator_for_primitive_collections() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).HasValueGenerator(); - b.PrimitiveCollection(e => e.Down).HasValueGenerator(typeof(CustomValueGenerator)); - b.PrimitiveCollection>("Strange").HasValueGenerator(); - b.PrimitiveCollection("Top").HasValueGeneratorFactory(typeof(CustomValueGeneratorFactory)); - b.PrimitiveCollection>("Bottom").HasValueGeneratorFactory(); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).HasValueGenerator(); + b.PrimitiveCollection(e => e.Down).HasValueGenerator(typeof(CustomValueGenerator)); + b.PrimitiveCollection>("Strange").HasValueGenerator(); + b.PrimitiveCollection("Top").HasValueGeneratorFactory(typeof(CustomValueGeneratorFactory)); + b.PrimitiveCollection>("Bottom").HasValueGeneratorFactory(); + }); var model = modelBuilder.FinalizeModel(); @@ -2806,14 +2711,13 @@ public virtual void Throws_for_bad_value_generator_type_for_primitive_collection { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - Assert.Equal( - CoreStrings.BadValueGeneratorType(nameof(Random), nameof(ValueGenerator)), - Assert.Throws(() => b.PrimitiveCollection(e => e.Down).HasValueGenerator(typeof(Random))) - .Message); - }); + modelBuilder.Entity(b => + { + Assert.Equal( + CoreStrings.BadValueGeneratorType(nameof(Random), nameof(ValueGenerator)), + Assert.Throws(() => b.PrimitiveCollection(e => e.Down).HasValueGenerator(typeof(Random))) + .Message); + }); } [ConditionalFact] @@ -2822,24 +2726,23 @@ public virtual void Throws_for_primitive_collection_for_value_generator_that_can var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).HasValueGenerator(); - b.PrimitiveCollection(e => e.Down).HasValueGenerator(); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).HasValueGenerator(); + b.PrimitiveCollection(e => e.Down).HasValueGenerator(); + }); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; Assert.Equal( CoreStrings.CannotCreateValueGenerator(nameof(BadCustomValueGenerator1), "HasValueGenerator"), - Assert.Throws( - () => entityType.FindProperty("Up")!.GetValueGeneratorFactory()!(null!, null!)).Message); + Assert.Throws(() => entityType.FindProperty("Up")!.GetValueGeneratorFactory()!(null!, null!)) + .Message); Assert.Equal( CoreStrings.CannotCreateValueGenerator(nameof(BadCustomValueGenerator2), "HasValueGenerator"), - Assert.Throws( - () => entityType.FindProperty("Down")!.GetValueGeneratorFactory()!(null!, null!)).Message); + Assert.Throws(() => entityType.FindProperty("Down")!.GetValueGeneratorFactory()!(null!, null!)) + .Message); } [ConditionalFact] @@ -2889,16 +2792,15 @@ public virtual void Can_set_unicode_for_primitive_collections() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).IsUnicode(); - b.PrimitiveCollection(e => e.Down).IsUnicode(false); - b.PrimitiveCollection("Charm").IsUnicode(); - b.PrimitiveCollection>("Strange").IsUnicode(false); - b.PrimitiveCollection("Top").IsUnicode(); - b.PrimitiveCollection?>("Bottom").IsUnicode(false); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).IsUnicode(); + b.PrimitiveCollection(e => e.Down).IsUnicode(false); + b.PrimitiveCollection("Charm").IsUnicode(); + b.PrimitiveCollection>("Strange").IsUnicode(false); + b.PrimitiveCollection("Top").IsUnicode(); + b.PrimitiveCollection?>("Bottom").IsUnicode(false); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; @@ -2917,23 +2819,22 @@ public virtual void PrimitiveCollectionBuilder_methods_can_be_chained() => CreateModelBuilder() .Entity() .PrimitiveCollection(e => e.Up) - .ElementType( - t => t - .HasAnnotation("B", "C") - .HasConversion(typeof(long)) - .HasConversion(new CastingConverter()) - .HasConversion(typeof(long), typeof(CustomValueComparer)) - .HasConversion(typeof(long), new CustomValueComparer()) - .HasConversion(new CastingConverter()) - .HasConversion(new CastingConverter(), new CustomValueComparer()) - .HasConversion() - .HasConversion(new CustomValueComparer()) - .HasConversion>() - .HasMaxLength(2) - .HasPrecision(1) - .HasPrecision(1, 2) - .IsRequired() - .IsUnicode()) + .ElementType(t => t + .HasAnnotation("B", "C") + .HasConversion(typeof(long)) + .HasConversion(new CastingConverter()) + .HasConversion(typeof(long), typeof(CustomValueComparer)) + .HasConversion(typeof(long), new CustomValueComparer()) + .HasConversion(new CastingConverter()) + .HasConversion(new CastingConverter(), new CustomValueComparer()) + .HasConversion() + .HasConversion(new CustomValueComparer()) + .HasConversion>() + .HasMaxLength(2) + .HasPrecision(1) + .HasPrecision(1, 2) + .IsRequired() + .IsUnicode()) .IsRequired() .IsRequired(false) .HasAnnotation("A", "V") @@ -2965,7 +2866,7 @@ public virtual void Can_set_primary_key_by_convention_for_user_specified_shadow_ entityBuilder.PrimitiveCollection>("Id"); Assert.NotNull(entityType.FindPrimaryKey()); - Assert.Equal(new[] { "Id" }, entityType.FindPrimaryKey()!.Properties.Select(p => p.Name)); + Assert.Equal(["Id"], entityType.FindPrimaryKey()!.Properties.Select(p => p.Name)); } [ConditionalFact] @@ -2990,13 +2891,12 @@ public virtual void Can_set_composite_key_for_primitive_collection_on_an_entity_ { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.CollectionCompanyId); // Issue #31417 - b.PrimitiveCollection(e => e.CollectionTenantId); - b.HasKey(e => new { e.CollectionCompanyId, e.CollectionTenantId }); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.CollectionCompanyId); // Issue #31417 + b.PrimitiveCollection(e => e.CollectionTenantId); + b.HasKey(e => new { e.CollectionCompanyId, e.CollectionTenantId }); + }); var model = modelBuilder.FinalizeModel(); var entity = model.FindEntityType(typeof(EntityWithFields))!; @@ -3019,14 +2919,13 @@ public virtual void Can_set_alternate_key_for_primitive_collection_on_an_entity_ { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.CollectionCompanyId); - b.HasAlternateKey(e => e.CollectionCompanyId); - b.HasAlternateKey(e => e.CollectionId); - b.HasKey(e => e.Id); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.CollectionCompanyId); + b.HasAlternateKey(e => e.CollectionCompanyId); + b.HasAlternateKey(e => e.CollectionId); + b.HasKey(e => e.Id); + }); var model = modelBuilder.FinalizeModel(); AssertEqual(modelBuilder.Model, model); @@ -3081,15 +2980,14 @@ public virtual void Element_types_are_nullable_by_default_if_the_type_is_nullabl { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up); - b.PrimitiveCollection(e => e.Down); - b.PrimitiveCollection>("Charm"); - b.PrimitiveCollection>("Strange"); - b.PrimitiveCollection>("Stranger"); // Still optional since no NRT metadata available - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up); + b.PrimitiveCollection(e => e.Down); + b.PrimitiveCollection>("Charm"); + b.PrimitiveCollection>("Strange"); + b.PrimitiveCollection>("Stranger"); // Still optional since no NRT metadata available + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; @@ -3105,16 +3003,15 @@ public virtual void Element_types_can_be_made_required() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).ElementType().IsRequired(); - b.PrimitiveCollection(e => e.Down).ElementType().IsRequired(false); - b.PrimitiveCollection>("Charm").ElementType().IsRequired(); - b.PrimitiveCollection>("Strange").ElementType().IsRequired(); - b.PrimitiveCollection>("Stranger").ElementType() - .IsRequired(); // Still optional since no NRT metadata available - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).ElementType().IsRequired(); + b.PrimitiveCollection(e => e.Down).ElementType().IsRequired(false); + b.PrimitiveCollection>("Charm").ElementType().IsRequired(); + b.PrimitiveCollection>("Strange").ElementType().IsRequired(); + b.PrimitiveCollection>("Stranger").ElementType() + .IsRequired(); // Still optional since no NRT metadata available + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; @@ -3130,13 +3027,12 @@ public virtual void Element_types_have_no_max_length_by_default() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection>("Charm"); - b.PrimitiveCollection>("Strange"); - b.PrimitiveCollection>("Stranger"); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection>("Charm"); + b.PrimitiveCollection>("Strange"); + b.PrimitiveCollection>("Stranger"); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; @@ -3152,14 +3048,13 @@ public virtual void Element_types_can_have_max_length() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Down).ElementType().HasMaxLength(-1); - b.PrimitiveCollection>("Charm"); - b.PrimitiveCollection>("Strange").ElementType().HasMaxLength(512); - b.PrimitiveCollection>("Stranger").ElementType().HasMaxLength(int.MaxValue); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Down).ElementType().HasMaxLength(-1); + b.PrimitiveCollection>("Charm"); + b.PrimitiveCollection>("Strange").ElementType().HasMaxLength(512); + b.PrimitiveCollection>("Stranger").ElementType().HasMaxLength(int.MaxValue); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; @@ -3175,13 +3070,12 @@ public virtual void Element_types_have_default_precision_and_scale() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection>("Charm"); - b.PrimitiveCollection>("Strange"); - b.PrimitiveCollection>("Stranger"); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection>("Charm"); + b.PrimitiveCollection>("Strange"); + b.PrimitiveCollection>("Stranger"); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; @@ -3207,13 +3101,12 @@ public virtual void Element_types_can_have_precision_and_scale() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection>("Charm").ElementType(b => b.HasPrecision(5, 6)); - b.PrimitiveCollection>("Strange").ElementType(b => b.HasPrecision(12)); - b.PrimitiveCollection>("Stranger"); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection>("Charm").ElementType(b => b.HasPrecision(5, 6)); + b.PrimitiveCollection>("Strange").ElementType(b => b.HasPrecision(12)); + b.PrimitiveCollection>("Stranger"); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; @@ -3243,13 +3136,12 @@ public virtual void Element_types_have_default_unicode() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection>("Charm"); - b.PrimitiveCollection>("Strange"); - b.PrimitiveCollection>("Stranger"); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection>("Charm"); + b.PrimitiveCollection>("Strange"); + b.PrimitiveCollection>("Stranger"); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; @@ -3265,14 +3157,13 @@ public virtual void Element_types_can_have_unicode_set() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Down).ElementType().IsUnicode(false); - b.PrimitiveCollection>("Charm"); - b.PrimitiveCollection>("Strange").ElementType().IsUnicode(); - b.PrimitiveCollection>("Stranger").ElementType().IsUnicode(false); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Down).ElementType().IsUnicode(false); + b.PrimitiveCollection>("Charm"); + b.PrimitiveCollection>("Strange").ElementType().IsUnicode(); + b.PrimitiveCollection>("Stranger").ElementType().IsUnicode(false); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; @@ -3288,13 +3179,12 @@ public virtual void Conversion_on_base_property_prevents_primitive_collection() { var modelBuilder = CreateModelBuilder(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.Property(c => c.Down).HasConversion( - gs => string.Join(',', gs!), - s => new ObservableCollection(s.Split(',', StringSplitOptions.RemoveEmptyEntries))); - }); + modelBuilder.Entity(b => + { + b.Property(c => c.Down).HasConversion( + gs => string.Join(',', gs!), + s => new ObservableCollection(s.Split(',', StringSplitOptions.RemoveEmptyEntries))); + }); var model = modelBuilder.FinalizeModel(); @@ -3307,13 +3197,12 @@ public virtual void Conversion_on_base_property_prevents_primitive_collection() public virtual void Conversion_on_base_property_prevents_primitive_collection_when_base_first() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(c => c.Down).HasConversion( - gs => string.Join(',', gs!), - s => new ObservableCollection(s.Split(',', StringSplitOptions.RemoveEmptyEntries))); - }); + modelBuilder.Entity(b => + { + b.Property(c => c.Down).HasConversion( + gs => string.Join(',', gs!), + s => new ObservableCollection(s.Split(',', StringSplitOptions.RemoveEmptyEntries))); + }); var property = (IProperty)modelBuilder.Model.FindEntityType(typeof(CollectionQuarks))!.FindProperty(nameof(CollectionQuarks.Down))!; @@ -3332,25 +3221,24 @@ public virtual void Element_types_can_have_provider_type_set() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up); - b.PrimitiveCollection(e => e.Down).ElementType().HasConversion(); - b.PrimitiveCollection>("Charm").ElementType().HasConversion>(); - b.PrimitiveCollection("Strange").ElementType().HasConversion((ValueConverter?)null); - b.PrimitiveCollection>("Top").ElementType().HasConversion(new CustomValueComparer()); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up); + b.PrimitiveCollection(e => e.Down).ElementType().HasConversion(); + b.PrimitiveCollection>("Charm").ElementType().HasConversion>(); + b.PrimitiveCollection("Strange").ElementType().HasConversion((ValueConverter?)null); + b.PrimitiveCollection>("Top").ElementType().HasConversion(new CustomValueComparer()); + }); var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(CollectionQuarks))!; var up = entityType.FindProperty("Up")!.GetElementType()!; Assert.Null(up.GetProviderClrType()); - Assert.True(up.GetValueComparer()?.IsDefault()); + Assert.True(up.GetValueComparer().IsDefault()); var down = entityType.FindProperty("Down")!.GetElementType()!; Assert.Same(typeof(byte[]), down.GetProviderClrType()); - Assert.True(down.GetValueComparer()?.IsDefault()); + Assert.True(down.GetValueComparer().IsDefault()); var charm = entityType.FindProperty("Charm")!.GetElementType()!; Assert.Same(typeof(long), charm.GetProviderClrType()); @@ -3358,7 +3246,7 @@ public virtual void Element_types_can_have_provider_type_set() var strange = entityType.FindProperty("Strange")!.GetElementType()!; Assert.Null(strange.GetProviderClrType()); - Assert.True(strange.GetValueComparer()?.IsDefault()); + Assert.True(strange.GetValueComparer().IsDefault()); var top = entityType.FindProperty("Top")!.GetElementType()!; Assert.Same(typeof(string), top.GetProviderClrType()); @@ -3373,15 +3261,14 @@ public virtual void Element_types_can_have_non_generic_value_converter_set() ValueConverter stringConverter = new StringToBytesConverter(Encoding.UTF8); ValueConverter intConverter = new CastingConverter(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up); - b.PrimitiveCollection(e => e.Down).ElementType().HasConversion(stringConverter); - b.PrimitiveCollection("Charm").ElementType().HasConversion(intConverter, null); - b.PrimitiveCollection>("Strange").ElementType().HasConversion(stringConverter); - b.PrimitiveCollection>("Strange").ElementType().HasConversion((ValueConverter?)null); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up); + b.PrimitiveCollection(e => e.Down).ElementType().HasConversion(stringConverter); + b.PrimitiveCollection("Charm").ElementType().HasConversion(intConverter, null); + b.PrimitiveCollection>("Strange").ElementType().HasConversion(stringConverter); + b.PrimitiveCollection>("Strange").ElementType().HasConversion((ValueConverter?)null); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(CollectionQuarks))!; @@ -3404,19 +3291,18 @@ public virtual void Element_types_can_have_custom_type_value_converter_type_set( { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).ElementType().HasConversion>(); - b.PrimitiveCollection(e => e.Down).ElementType() - .HasConversion>(); - b.PrimitiveCollection("Charm").ElementType() - .HasConversion, CustomValueComparer>(); - b.PrimitiveCollection>("Strange").ElementType() - .HasConversion>(); - b.PrimitiveCollection>("Strange").ElementType().HasConversion((ValueConverter?)null); - b.PrimitiveCollection("Top").ElementType().HasConversion(new CustomValueComparer()); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).ElementType().HasConversion>(); + b.PrimitiveCollection(e => e.Down).ElementType() + .HasConversion>(); + b.PrimitiveCollection("Charm").ElementType() + .HasConversion, CustomValueComparer>(); + b.PrimitiveCollection>("Strange").ElementType() + .HasConversion>(); + b.PrimitiveCollection>("Strange").ElementType().HasConversion((ValueConverter?)null); + b.PrimitiveCollection("Top").ElementType().HasConversion(new CustomValueComparer()); + }); var model = modelBuilder.FinalizeModel(); var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(CollectionQuarks))!; @@ -3448,17 +3334,16 @@ public virtual void Primitive_collections_can_have_value_converter_set() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up); - b.PrimitiveCollection(e => e.Down).ElementType().HasConversion( - new ValueConverter(v => int.Parse(v), v => v.ToString())!); - b.PrimitiveCollection>("Charm").ElementType().HasConversion( - new ValueConverter(v => v, v => (int)v), new CustomValueComparer()); - b.PrimitiveCollection("Strange").ElementType().HasConversion( - new ValueConverter(v => v, v => (float)v), new CustomValueComparer()); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up); + b.PrimitiveCollection(e => e.Down).ElementType().HasConversion( + new ValueConverter(v => int.Parse(v), v => v.ToString())!); + b.PrimitiveCollection>("Charm").ElementType().HasConversion( + new ValueConverter(v => v, v => (int)v), new CustomValueComparer()); + b.PrimitiveCollection("Strange").ElementType().HasConversion( + new ValueConverter(v => v, v => (float)v), new CustomValueComparer()); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; @@ -3486,15 +3371,13 @@ public virtual void Value_converter_type_on_primitive_collection_is_checked() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - Assert.Equal( - CoreStrings.ConverterPropertyMismatchElement("string", "CollectionQuarks", "Up", "int"), - Assert.Throws( - () => b.PrimitiveCollection(e => e.Up).ElementType().HasConversion( - new StringToBytesConverter(Encoding.UTF8))).Message); - }); + modelBuilder.Entity(b => + { + Assert.Equal( + CoreStrings.ConverterPropertyMismatchElement("string", "CollectionQuarks", "Up", "int"), + Assert.Throws(() => b.PrimitiveCollection(e => e.Up).ElementType().HasConversion( + new StringToBytesConverter(Encoding.UTF8))).Message); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OneToMany.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OneToMany.cs index a72255fd709..abe9823f6bc 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OneToMany.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OneToMany.cs @@ -67,24 +67,22 @@ public virtual void Finds_existing_navigations_and_uses_associated_FK_with_field var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - e => - { - e.Property(p => p.Id); - e.Property(p => p.AlternateKey); - e.Property(p => p.Name); - e.HasKey(p => p.Id); - }); - modelBuilder.Entity( - e => - { - e.Property(d => d.DependentWithFieldId); - e.Property(d => d.OneToManyPrincipalId); - e.Property(d => d.AnotherOneToManyPrincipalId); - e.Ignore(d => d.ManyToManyPrincipals); - e.Ignore(d => d.OneToOnePrincipal); - e.HasKey(d => d.DependentWithFieldId); - }); + modelBuilder.Entity(e => + { + e.Property(p => p.Id); + e.Property(p => p.AlternateKey); + e.Property(p => p.Name); + e.HasKey(p => p.Id); + }); + modelBuilder.Entity(e => + { + e.Property(d => d.DependentWithFieldId); + e.Property(d => d.OneToManyPrincipalId); + e.Property(d => d.AnotherOneToManyPrincipalId); + e.Ignore(d => d.ManyToManyPrincipals); + e.Ignore(d => d.OneToOnePrincipal); + e.HasKey(d => d.DependentWithFieldId); + }); modelBuilder.Entity() .HasOne(d => d.OneToManyPrincipal) @@ -1128,11 +1126,10 @@ public virtual void Throws_on_keyless_type_as_principal() nameof(Customer), nameof(Customer) + "." + nameof(Customer.Orders), nameof(Order)), - Assert.Throws( - () => - modelBuilder.Entity().HasNoKey() - .HasMany(c => c.Orders) - .WithOne(o => o.Customer)).Message); + Assert.Throws(() => + modelBuilder.Entity().HasNoKey() + .HasMany(c => c.Orders) + .WithOne(o => o.Customer)).Message); } [ConditionalFact] @@ -1818,8 +1815,7 @@ public virtual void Creates_both_navigations_and_creates_composite_FK_specified( { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => b.HasKey(c => new { c.Id1, c.Id2 })); + modelBuilder.Entity(b => b.HasKey(c => new { c.Id1, c.Id2 })); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1869,8 +1865,7 @@ public virtual void Can_use_alternate_composite_key() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => b.HasKey(c => new { c.Id1, c.Id2 })); + modelBuilder.Entity(b => b.HasKey(c => new { c.Id1, c.Id2 })); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1930,8 +1925,7 @@ public virtual void Can_use_alternate_composite_key_in_any_order() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => b.HasKey(c => new { c.Id1, c.Id2 })); + modelBuilder.Entity(b => b.HasKey(c => new { c.Id1, c.Id2 })); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -1992,12 +1986,11 @@ public virtual void Creates_specified_composite_FK_with_navigation_to_dependent( var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); - modelBuilder.Entity( - b => - { - b.Property(e => e.BurgerId1); - b.Property(e => e.BurgerId2); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.BurgerId1); + b.Property(e => e.BurgerId2); + }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2240,25 +2233,23 @@ public virtual void Creates_overlapping_foreign_keys_with_different_nullability( var model = modelBuilder.Model; modelBuilder.Ignore(); modelBuilder.Entity(); - modelBuilder.Entity( - eb => - { - eb.HasKey(c => new { c.OrderId, c.CustomerId }); - }); + modelBuilder.Entity(eb => + { + eb.HasKey(c => new { c.OrderId, c.CustomerId }); + }); modelBuilder.Ignore(); modelBuilder.Entity(eb => { eb.HasKey(c => new { c.Id, c.Name }); }); - modelBuilder.Entity( - eb => - { - eb.Ignore(p => p.Categories); - eb.HasOne(p => p.Order).WithMany(o => o.Products).HasForeignKey("CommonId", "OrderId"); - eb.HasOne().WithMany(c => c.Products).HasForeignKey("CommonId", "Category").IsRequired(); + modelBuilder.Entity(eb => + { + eb.Ignore(p => p.Categories); + eb.HasOne(p => p.Order).WithMany(o => o.Products).HasForeignKey("CommonId", "OrderId"); + eb.HasOne().WithMany(c => c.Products).HasForeignKey("CommonId", "Category").IsRequired(); - eb.HasIndex("Id", "OrderId").IsUnique(); - eb.HasKey("Id", "CommonId"); - }); + eb.HasIndex("Id", "OrderId").IsUnique(); + eb.HasKey("Id", "CommonId"); + }); modelBuilder.FinalizeModel(); @@ -2275,7 +2266,7 @@ public virtual void Creates_overlapping_foreign_keys_with_different_nullability( var dependentKey = dependentType.FindPrimaryKey(); Assert.True(dependentKey.Properties.All(p => p.ValueGenerated == ValueGenerated.Never)); - var index = dependentType.FindIndex(new[] { dependentKey.Properties[0], optionalFk.Properties[1] }); + var index = dependentType.FindIndex([dependentKey.Properties[0], optionalFk.Properties[1]]); Assert.True(index.IsUnique); } @@ -2295,9 +2286,8 @@ public virtual void Throws_on_existing_many_to_many() nameof(Product), nameof(Category) + "." + nameof(Category.Products), nameof(Product) + "." + nameof(Product.Categories)), - Assert.Throws( - () => modelBuilder.Entity() - .HasMany(o => o.Products).WithOne()).Message); + Assert.Throws(() => modelBuilder.Entity() + .HasMany(o => o.Products).WithOne()).Message); } [ConditionalFact] @@ -2325,9 +2315,8 @@ public virtual void Throws_on_existing_one_to_one_relationship() dependentType.DisplayName() + "." + nameof(Hob.Nob), dependentType.DisplayName() + "." + nameof(Hob.Nob), principalType.DisplayName() + "." + nameof(Nob.Hob)), - Assert.Throws( - () => - modelBuilder.Entity().HasMany(e => e.Hobs).WithOne(e => e.Nob)).Message); + Assert.Throws(() => + modelBuilder.Entity().HasMany(e => e.Hobs).WithOne(e => e.Nob)).Message); } [ConditionalFact] @@ -2430,8 +2419,7 @@ public virtual void Nullable_FK_are_optional_by_default() modelBuilder .Entity().HasMany(e => e.Nobs).WithOne(e => e.Hob) - .HasForeignKey( - e => new { e.HobId1, e.HobId2 }); + .HasForeignKey(e => new { e.HobId1, e.HobId2 }); modelBuilder.FinalizeModel(); @@ -2453,8 +2441,7 @@ public virtual void Non_nullable_FK_are_required_by_default() modelBuilder .Entity().HasMany(e => e.Hobs).WithOne(e => e.Nob) - .HasForeignKey( - e => new { e.NobId1, e.NobId2 }); + .HasForeignKey(e => new { e.NobId1, e.NobId2 }); modelBuilder.FinalizeModel(); @@ -2476,8 +2463,7 @@ public virtual void Nullable_FK_can_be_made_required() modelBuilder .Entity().HasMany(e => e.Nobs).WithOne(e => e.Hob) - .HasForeignKey( - e => new { e.HobId1, e.HobId2 }) + .HasForeignKey(e => new { e.HobId1, e.HobId2 }) .IsRequired(); modelBuilder.FinalizeModel(); @@ -2546,13 +2532,12 @@ public virtual void Non_nullable_FK_can_be_made_optional_separately() public virtual void Nullable_FK_overrides_NRT_navigation() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - eb => - { - eb.Property(d => d.PrincipalEntityId); - eb.Ignore(d => d.Nav); - eb.HasOne(d => d.Nav).WithMany(p => p.InverseNav); - }); + modelBuilder.Entity(eb => + { + eb.Property(d => d.PrincipalEntityId); + eb.Ignore(d => d.Nav); + eb.HasOne(d => d.Nav).WithMany(p => p.InverseNav); + }); var model = modelBuilder.FinalizeModel(); @@ -2636,13 +2621,12 @@ public virtual void Creates_shadow_FK_property_with_non_shadow_PK() var modelBuilder = CreateModelBuilder(); modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.HasOne(e => e.FirstNav) - .WithMany() - .HasForeignKey("ShadowId"); - }); + modelBuilder.Entity(b => + { + b.HasOne(e => e.FirstNav) + .WithMany() + .HasForeignKey("ShadowId"); + }); modelBuilder.FinalizeModel(); @@ -2695,8 +2679,8 @@ public virtual void Throws_when_foreign_key_references_shadow_key() Assert.Equal( CoreStrings.ReferencedShadowKey( - typeof(Order).Name + "." + nameof(Order.Customer), - typeof(Customer).Name + "." + nameof(Customer.Orders), + nameof(Order) + "." + nameof(Order.Customer), + nameof(Customer) + "." + nameof(Customer.Orders), "{'AnotherCustomerId' : Guid}", "{'Id' : int}"), Assert.Throws(() => modelBuilder.FinalizeModel()).Message); @@ -2787,18 +2771,16 @@ public virtual void Creates_one_to_many_relationship_with_single_ref_as_dependent_to_principal_if_no_matching_properties_either_side() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.NavOneToOneDependentEntityId); - b.Ignore(e => e.OneToOneDependentEntityId); - }); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.NavOneToOnePrincipalEntityId); - b.Ignore(e => e.OneToOnePrincipalEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.NavOneToOneDependentEntityId); + b.Ignore(e => e.OneToOneDependentEntityId); + }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.NavOneToOnePrincipalEntityId); + b.Ignore(e => e.OneToOnePrincipalEntityId); + }); modelBuilder.Entity().HasOne(e => e.NavOneToOnePrincipalEntity); @@ -2819,12 +2801,11 @@ public virtual void Creates_one_to_many_relationship_with_single_ref_as_dependent_to_principal_if_matching_navigation_name_properties_are_on_navigation_side() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.NavOneToOneDependentEntityId); - b.Ignore(e => e.OneToOneDependentEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.NavOneToOneDependentEntityId); + b.Ignore(e => e.OneToOneDependentEntityId); + }); modelBuilder.Entity(b => b.Ignore(e => e.OneToOnePrincipalEntityId)); modelBuilder.Entity().HasOne(e => e.NavOneToOnePrincipalEntity); @@ -2847,12 +2828,11 @@ public virtual void Creates_one_to_many_relationship_with_single_ref_as_dependent_to_principal_if_matching_entity_name_properties_are_on_navigation_side() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.NavOneToOneDependentEntityId); - b.Ignore(e => e.OneToOneDependentEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.NavOneToOneDependentEntityId); + b.Ignore(e => e.OneToOneDependentEntityId); + }); modelBuilder.Entity(b => b.Ignore(e => e.NavOneToOnePrincipalEntityId)); modelBuilder.Entity().HasOne(e => e.NavOneToOnePrincipalEntity); @@ -3024,10 +3004,9 @@ public virtual void Attempt_to_configure_Navigation_property_which_is_actually_a Assert.Equal( CoreStrings.CanOnlyConfigureExistingNavigations("Name", "NavDependent"), - Assert.Throws( - () => modelBuilder.Entity() - .Navigation(e => e.Name) - .UsePropertyAccessMode(PropertyAccessMode.Property) + Assert.Throws(() => modelBuilder.Entity() + .Navigation(e => e.Name) + .UsePropertyAccessMode(PropertyAccessMode.Property) ).Message); } @@ -3053,8 +3032,8 @@ public virtual void WithMany_call_on_keyless_entity_throws() nameof(KeylessCollectionNavigation), nameof(KeylessCollectionNavigation) + "." + nameof(KeylessCollectionNavigation.Stores), nameof(Store)), - Assert.Throws( - () => modelBuilder.Entity().HasNoKey().HasMany(e => e.Stores)).Message); + Assert.Throws(() + => modelBuilder.Entity().HasNoKey().HasMany(e => e.Stores)).Message); } [ConditionalFact] @@ -3066,9 +3045,8 @@ public virtual void WithMany_pointing_to_keyless_entity_throws() CoreStrings.NavigationToKeylessType( nameof(KeylessReferenceNavigation.Collection), nameof(KeylessCollectionNavigation)), - Assert.Throws( - () => modelBuilder.Entity().HasNoKey() - .HasOne(e => e.Reference).WithMany(e => e.Collection)).Message); + Assert.Throws(() => modelBuilder.Entity().HasNoKey() + .HasOne(e => e.Reference).WithMany(e => e.Collection)).Message); } [ConditionalFact] @@ -3081,8 +3059,7 @@ public virtual void HasNoKey_call_on_principal_entity_throws() nameof(KeylessCollectionNavigation), nameof(KeylessCollectionNavigation) + "." + nameof(KeylessCollectionNavigation.Stores), nameof(Store)), - Assert.Throws( - () => modelBuilder.Entity().HasNoKey()).Message); + Assert.Throws(() => modelBuilder.Entity().HasNoKey()).Message); } [ConditionalFact] @@ -3098,8 +3075,7 @@ public virtual void HasNoKey_call_on_principal_with_navigation_throws() CoreStrings.NavigationToKeylessType( nameof(KeylessReferenceNavigation.Collection), nameof(KeylessCollectionNavigation)), - Assert.Throws( - () => modelBuilder.Entity().HasNoKey()).Message); + Assert.Throws(() => modelBuilder.Entity().HasNoKey()).Message); } [ConditionalFact] @@ -3107,13 +3083,12 @@ public virtual void Reference_navigation_from_keyless_entity_type_works() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - entity => - { - entity.HasNoKey(); + modelBuilder.Entity(entity => + { + entity.HasNoKey(); - entity.HasOne(d => d.Store).WithMany(); - }); + entity.HasOne(d => d.Store).WithMany(); + }); var model = modelBuilder.FinalizeModel(); diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OneToOne.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OneToOne.cs index c491b3d864a..5c446e28541 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OneToOne.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OneToOne.cs @@ -53,22 +53,20 @@ public virtual void Finds_existing_navigations_and_uses_associated_FK_with_field var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - e => - { - e.Property(p => p.Id); - e.Property(p => p.Name); - e.HasKey(p => p.Id); - }); - modelBuilder.Entity( - e => - { - e.Property(d => d.DependentWithFieldId); - e.Property(d => d.OneToOnePrincipalId); - e.Ignore(d => d.ManyToManyPrincipals); - e.Ignore(d => d.OneToManyPrincipal); - e.HasKey(d => d.DependentWithFieldId); - }); + modelBuilder.Entity(e => + { + e.Property(p => p.Id); + e.Property(p => p.Name); + e.HasKey(p => p.Id); + }); + modelBuilder.Entity(e => + { + e.Property(d => d.DependentWithFieldId); + e.Property(d => d.OneToOnePrincipalId); + e.Ignore(d => d.ManyToManyPrincipals); + e.Ignore(d => d.OneToManyPrincipal); + e.HasKey(d => d.DependentWithFieldId); + }); modelBuilder.Entity() .HasOne(d => d.OneToOnePrincipal) @@ -1885,11 +1883,10 @@ public virtual void Principal_and_dependent_cannot_be_flipped_twice() Assert.Equal( CoreStrings.RelationshipCannotBeInverted, - Assert.Throws( - () => modelBuilder - .Entity().HasOne(e => e.Order).WithOne(e => e.Details) - .HasForeignKey(e => e.OrderId) - .HasPrincipalKey(e => e.OrderId)).Message); + Assert.Throws(() => modelBuilder + .Entity().HasOne(e => e.Order).WithOne(e => e.Details) + .HasForeignKey(e => e.OrderId) + .HasPrincipalKey(e => e.OrderId)).Message); } [ConditionalFact] @@ -1950,11 +1947,10 @@ public virtual void Principal_and_dependent_cannot_be_flipped_twice_in_reverse_o Assert.Equal( CoreStrings.RelationshipCannotBeInverted, - Assert.Throws( - () => modelBuilder - .Entity().HasOne(e => e.Order).WithOne(e => e.Details) - .HasPrincipalKey(e => e.OrderId) - .HasForeignKey(e => e.OrderId)).Message); + Assert.Throws(() => modelBuilder + .Entity().HasOne(e => e.Order).WithOne(e => e.Details) + .HasPrincipalKey(e => e.OrderId) + .HasForeignKey(e => e.OrderId)).Message); } [ConditionalFact] @@ -2005,18 +2001,16 @@ public virtual void IsRequired_throws_principal_end_is_ambiguous() nameof(OrderDetails), nameof(OrderDetails.Order), "{'OrderId'}"), - Assert.Throws( - () => modelBuilder - .Entity().Navigation(e => e.Order).IsRequired()).Message); + Assert.Throws(() => modelBuilder + .Entity().Navigation(e => e.Order).IsRequired()).Message); Assert.Equal( CoreStrings.AmbiguousEndRequiredDependentNavigation( nameof(Order), nameof(Order.Details), "{'OrderId'}"), - Assert.Throws( - () => modelBuilder - .Entity().Navigation(e => e.Details).IsRequired()).Message); + Assert.Throws(() => modelBuilder + .Entity().Navigation(e => e.Details).IsRequired()).Message); } [ConditionalFact] @@ -2090,8 +2084,7 @@ public virtual void Configuring_principal_type_as_keyless_throws_if_not_invertib nameof(Order), nameof(Order) + "." + nameof(Order.Details), nameof(OrderDetails)), - Assert.Throws( - () => modelBuilder.Entity().HasNoKey()).Message); + Assert.Throws(() => modelBuilder.Entity().HasNoKey()).Message); } [ConditionalFact] @@ -2111,8 +2104,7 @@ public virtual void Configuring_principal_type_as_keyless_throws_when_there_is_a CoreStrings.NavigationToKeylessType( nameof(OrderDetails.Order), nameof(Order)), - Assert.Throws( - () => modelBuilder.Entity().HasNoKey()).Message); + Assert.Throws(() => modelBuilder.Entity().HasNoKey()).Message); } [ConditionalFact] @@ -2371,12 +2363,10 @@ public virtual void Creates_both_navigations_and_uses_existing_composite_FK() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); var dependentType = model.FindEntityType(typeof(ToastedBun)); modelBuilder.Entity().HasOne().WithOne() - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2387,8 +2377,7 @@ public virtual void Creates_both_navigations_and_uses_existing_composite_FK() modelBuilder .Entity().HasOne(e => e.ToastedBun).WithOne(e => e.Whoopper) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.FinalizeModel(); @@ -2419,8 +2408,7 @@ public virtual void Creates_both_navigations_and_creates_composite_FK_specified( { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2436,8 +2424,7 @@ public virtual void Creates_both_navigations_and_creates_composite_FK_specified( modelBuilder .Entity().HasOne(e => e.ToastedBun).WithOne(e => e.Whoopper) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); var fk = dependentType.GetForeignKeys().Single(); Assert.Same(fkProperty1, fk.Properties[0]); @@ -2468,9 +2455,7 @@ public virtual void Can_use_alternate_composite_key() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => b.HasKey( - c => new { c.Id1, c.Id2 })); + modelBuilder.Entity(b => b.HasKey(c => new { c.Id1, c.Id2 })); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2488,10 +2473,8 @@ public virtual void Can_use_alternate_composite_key() modelBuilder .Entity().HasOne(e => e.ToastedBun).WithOne(e => e.Whoopper) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }) - .HasPrincipalKey( - e => new { e.AlternateKey1, e.AlternateKey2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }) + .HasPrincipalKey(e => new { e.AlternateKey1, e.AlternateKey2 }); var fk = dependentType.GetForeignKeys().Single(); Assert.Same(fkProperty1, fk.Properties[0]); @@ -2530,9 +2513,7 @@ public virtual void Can_use_alternate_composite_key_in_any_order() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - b => b.HasKey( - c => new { c.Id1, c.Id2 })); + modelBuilder.Entity(b => b.HasKey(c => new { c.Id1, c.Id2 })); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2550,10 +2531,8 @@ public virtual void Can_use_alternate_composite_key_in_any_order() modelBuilder .Entity().HasOne(e => e.ToastedBun).WithOne(e => e.Whoopper) - .HasPrincipalKey( - e => new { e.AlternateKey1, e.AlternateKey2 }) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasPrincipalKey(e => new { e.AlternateKey1, e.AlternateKey2 }) + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); var fk = dependentType.GetForeignKeys().Single(); Assert.Same(fkProperty1, fk.Properties[0]); @@ -2592,10 +2571,8 @@ public virtual void Uses_composite_PK_for_FK_by_convention() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2635,10 +2612,8 @@ public virtual void Principal_and_dependent_can_be_flipped_and_composite_PK_is_s { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2677,10 +2652,8 @@ public virtual void Principal_and_dependent_can_be_flipped_using_principal_and_c { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2695,8 +2668,7 @@ public virtual void Principal_and_dependent_can_be_flipped_using_principal_and_c modelBuilder .Entity().HasOne(e => e.Whoopper).WithOne(e => e.Mustard) - .HasPrincipalKey( - e => new { e.Id1, e.Id2 }) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) .IsRequired(); var fk = dependentType.GetForeignKeys().Single(); @@ -2720,8 +2692,7 @@ public virtual void Creates_composite_FK_when_specified_on_principal_with_naviga { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2737,8 +2708,7 @@ public virtual void Creates_composite_FK_when_specified_on_principal_with_naviga modelBuilder .Entity().HasOne(e => e.ToastedBun).WithOne() - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); var fk = principalType.GetNavigations().Single().ForeignKey; Assert.Same(fkProperty1, fk.Properties[0]); @@ -2768,8 +2738,7 @@ public virtual void Creates_composite_FK_when_specified_on_principal_with_naviga { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Entity(); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2785,8 +2754,7 @@ public virtual void Creates_composite_FK_when_specified_on_principal_with_naviga modelBuilder .Entity().HasOne().WithOne(e => e.Whoopper) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); var fk = dependentType.GetNavigations().Single().ForeignKey; Assert.Same(fkProperty1, fk.Properties[0]); @@ -2819,8 +2787,7 @@ public virtual void Creates_composite_FK_when_specified_on_principal_with_no_nav var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; modelBuilder.Entity().HasOne(b => b.Whoopper).WithOne(w => w.ToastedBun).HasPrincipalKey(); - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -2835,8 +2802,7 @@ public virtual void Creates_composite_FK_when_specified_on_principal_with_no_nav modelBuilder .Entity().HasOne().WithOne() - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); modelBuilder.FinalizeModel(); @@ -2906,12 +2872,11 @@ public virtual void Principal_and_dependent_can_be_flipped_when_self_referencing public virtual void Creates_self_referencing_FK_with_navigation_to_principal() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - eb => - { - eb.HasKey(e => e.Id); - eb.Property(e => e.SelfRefId); - }); + modelBuilder.Entity(eb => + { + eb.HasKey(e => e.Id); + eb.Property(e => e.SelfRefId); + }); var entityType = modelBuilder.Model.FindEntityType(typeof(SelfRef)); @@ -2942,12 +2907,11 @@ public virtual void Creates_self_referencing_FK_with_navigation_to_principal() public virtual void Creates_self_referencing_FK_with_navigation_to_dependent() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - eb => - { - eb.HasKey(e => e.Id); - eb.Property(e => e.SelfRefId); - }); + modelBuilder.Entity(eb => + { + eb.HasKey(e => e.Id); + eb.Property(e => e.SelfRefId); + }); var entityType = modelBuilder.Model.FindEntityType(typeof(SelfRef)); @@ -2978,8 +2942,7 @@ public virtual void Creates_self_referencing_FK_with_navigation_to_dependent() public virtual void Creates_self_referencing_FK_on_PK() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - eb => eb.HasKey(e => e.Id)); + modelBuilder.Entity(eb => eb.HasKey(e => e.Id)); var entityType = modelBuilder.Model.FindEntityType(typeof(SelfRef)); @@ -3087,9 +3050,9 @@ public virtual void Throws_on_duplicate_navigation_when_self_referencing() var modelBuilder = CreateModelBuilder(); Assert.Equal( - CoreStrings.ConflictingPropertyOrNavigation("SelfRef1", typeof(SelfRef).Name, typeof(SelfRef).Name), - Assert.Throws( - () => modelBuilder.Entity().HasOne(e => e.SelfRef1).WithOne(e => e.SelfRef1)).Message); + CoreStrings.ConflictingPropertyOrNavigation("SelfRef1", nameof(SelfRef), nameof(SelfRef)), + Assert.Throws(() + => modelBuilder.Entity().HasOne(e => e.SelfRef1).WithOne(e => e.SelfRef1)).Message); } [ConditionalFact] @@ -3209,11 +3172,9 @@ public virtual void Can_specify_shadow_fk_before_configuring_principal_PK() .HasForeignKey("Fk1"); modelBuilder.Entity() - .HasKey( - e => new { e.NobId1 }); + .HasKey(e => new { e.NobId1 }); modelBuilder.Entity() - .HasKey( - e => new { e.HobId1 }); + .HasKey(e => new { e.HobId1 }); modelBuilder.FinalizeModel(); @@ -3228,11 +3189,9 @@ public virtual void Can_specify_shadow_fk_before_reconfiguring_principal_PK() { var modelBuilder = CreateModelBuilder(); modelBuilder.Entity() - .HasKey( - e => new { e.Id1 }); + .HasKey(e => new { e.Id1 }); modelBuilder.Entity() - .HasKey( - e => new { e.Id1 }); + .HasKey(e => new { e.Id1 }); modelBuilder.Entity() .HasMany(c => c.Nobs) @@ -3240,11 +3199,9 @@ public virtual void Can_specify_shadow_fk_before_reconfiguring_principal_PK() .HasForeignKey("Fk1"); modelBuilder.Entity() - .HasKey( - e => new { e.NobId1 }); + .HasKey(e => new { e.NobId1 }); modelBuilder.Entity() - .HasKey( - e => new { e.HobId1 }); + .HasKey(e => new { e.HobId1 }); modelBuilder.FinalizeModel(); @@ -3258,32 +3215,30 @@ public virtual void Can_specify_shadow_fk_before_reconfiguring_principal_PK() public virtual void Can_specify_shadow_identifying_fk() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - eb => - { - eb.Ignore(e => e.Hobs); - eb.Ignore(e => e.Hob); + modelBuilder.Entity(eb => + { + eb.Ignore(e => e.Hobs); + eb.Ignore(e => e.Hob); - eb.Property("Id"); - eb.HasKey("Id"); - }); + eb.Property("Id"); + eb.HasKey("Id"); + }); - modelBuilder.Entity( - eb => - { - eb.Ignore(e => e.Nobs); + modelBuilder.Entity(eb => + { + eb.Ignore(e => e.Nobs); - eb.HasOne(c => c.Nob) - .WithOne() - .HasForeignKey("NobId"); + eb.HasOne(c => c.Nob) + .WithOne() + .HasForeignKey("NobId"); - eb.HasKey("NobId"); + eb.HasKey("NobId"); - eb.HasOne(c => c.Nob) - .WithOne() - .HasForeignKey("NobId") - .IsRequired(); - }); + eb.HasOne(c => c.Nob) + .WithOne() + .HasForeignKey("NobId") + .IsRequired(); + }); modelBuilder.FinalizeModel(); @@ -3303,11 +3258,10 @@ public virtual void Throws_if_specified_FK_types_do_not_match() Assert.Equal( CoreStrings.ForeignKeyTypeMismatch( "{'GuidProperty' : Guid}", nameof(CustomerDetails), "{'Id' : int}", nameof(Customer)), - Assert.Throws( - () => modelBuilder - .Entity().HasOne(c => c.Details).WithOne(d => d.Customer) - .HasPrincipalKey("Id") - .HasForeignKey("GuidProperty")).Message); + Assert.Throws(() => modelBuilder + .Entity().HasOne(c => c.Details).WithOne(d => d.Customer) + .HasPrincipalKey("Id") + .HasForeignKey("GuidProperty")).Message); } [ConditionalFact] @@ -3344,12 +3298,11 @@ public virtual void Throws_if_specified_PK_types_do_not_match() Assert.Equal( CoreStrings.ForeignKeyTypeMismatch( "{'GuidProperty' : Guid}", nameof(CustomerDetails), "{'Id' : int}", nameof(Customer)), - Assert.Throws( - () => - modelBuilder - .Entity().HasOne(c => c.Details).WithOne(d => d.Customer) - .HasForeignKey("GuidProperty") - .HasPrincipalKey("Id")).Message); + Assert.Throws(() => + modelBuilder + .Entity().HasOne(c => c.Details).WithOne(d => d.Customer) + .HasForeignKey("GuidProperty") + .HasPrincipalKey("Id")).Message); } [ConditionalFact] @@ -3387,12 +3340,11 @@ public virtual void Throws_if_specified_FK_count_does_not_match() Assert.Equal( CoreStrings.ForeignKeyCountMismatch("{'Id', 'GuidProperty'}", nameof(CustomerDetails), "{'Id'}", nameof(Customer)), - Assert.Throws( - () => - modelBuilder - .Entity().HasOne(c => c.Details).WithOne(d => d.Customer) - .HasPrincipalKey("Id") - .HasForeignKey("Id", "GuidProperty")).Message); + Assert.Throws(() => + modelBuilder + .Entity().HasOne(c => c.Details).WithOne(d => d.Customer) + .HasPrincipalKey("Id") + .HasForeignKey("Id", "GuidProperty")).Message); } [ConditionalFact] @@ -3414,7 +3366,7 @@ public virtual void Overrides_PK_if_specified_FK_count_does_not_match_separately var dependentType = model.FindEntityType(typeof(CustomerDetails)); var fk = dependentType.GetForeignKeys().Single(); - AssertEqual(new[] { dependentType.FindProperty(nameof(CustomerDetails.Id)), guidProperty }, fk.Properties); + AssertEqual([dependentType.FindProperty(nameof(CustomerDetails.Id)), guidProperty], fk.Properties); Assert.Equal(2, fk.PrincipalKey.Properties.Count); } @@ -3428,12 +3380,11 @@ public virtual void Throws_if_specified_PK_count_does_not_match() Assert.Equal( CoreStrings.ForeignKeyCountMismatch("{'Id', 'GuidProperty'}", nameof(CustomerDetails), "{'Id'}", nameof(Customer)), - Assert.Throws( - () => - modelBuilder - .Entity().HasOne(c => c.Details).WithOne(d => d.Customer) - .HasForeignKey("Id", "GuidProperty") - .HasPrincipalKey("Id")).Message); + Assert.Throws(() => + modelBuilder + .Entity().HasOne(c => c.Details).WithOne(d => d.Customer) + .HasForeignKey("Id", "GuidProperty") + .HasPrincipalKey("Id")).Message); } [ConditionalFact] @@ -3477,8 +3428,8 @@ public virtual void Foreign_key_properties_are_not_discovered_for_one_to_one_rel Assert.Equal( CoreStrings.AmbiguousOneToOneRelationship( - typeof(Nob).Name + "." + nameof(Nob.Hob), - typeof(Hob).Name + "." + nameof(Hob.Nob)), + nameof(Nob) + "." + nameof(Nob.Hob), + nameof(Hob) + "." + nameof(Hob.Nob)), Assert.Throws(() => modelBuilder.FinalizeModel()).Message); } @@ -3487,12 +3438,10 @@ public virtual void Creates_relationship_on_existing_FK_if_using_different_princ { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder .Entity().HasOne(e => e.Whoopper).WithMany(e => e.Tomatoes) - .HasForeignKey( - c => new { c.BurgerId1, c.BurgerId2 }); + .HasForeignKey(c => new { c.BurgerId1, c.BurgerId2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -3504,10 +3453,8 @@ public virtual void Creates_relationship_on_existing_FK_if_using_different_princ modelBuilder .Entity().HasOne().WithOne() - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }) - .HasPrincipalKey( - e => new { e.AlternateKey1, e.AlternateKey2 }); + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }) + .HasPrincipalKey(e => new { e.AlternateKey1, e.AlternateKey2 }); var existingFk = dependentType.GetNavigations().Single().ForeignKey; Assert.Same(existingFk, principalType.GetNavigations().Single().ForeignKey); @@ -3540,12 +3487,10 @@ public virtual void Creates_relationship_on_existing_FK_if_using_different_princ { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); modelBuilder .Entity().HasOne(e => e.Whoopper).WithMany(e => e.Tomatoes) - .HasForeignKey( - c => new { c.BurgerId1, c.BurgerId2 }); + .HasForeignKey(c => new { c.BurgerId1, c.BurgerId2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -3557,10 +3502,8 @@ public virtual void Creates_relationship_on_existing_FK_if_using_different_princ modelBuilder .Entity().HasOne().WithOne() - .HasPrincipalKey( - e => new { e.AlternateKey1, e.AlternateKey2 }) - .HasForeignKey( - e => new { e.BurgerId1, e.BurgerId2 }); + .HasPrincipalKey(e => new { e.AlternateKey1, e.AlternateKey2 }) + .HasForeignKey(e => new { e.BurgerId1, e.BurgerId2 }); var existingFk = dependentType.GetNavigations().Single().ForeignKey; Assert.Same(existingFk, principalType.GetNavigations().Single().ForeignKey); @@ -3592,10 +3535,8 @@ public virtual void Creates_index_even_if_covered_by_an_alternate_key() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity().HasKey( - c => new { c.Id1, c.Id2 }); - modelBuilder.Entity().HasAlternateKey( - c => new { c.BurgerId1, c.BurgerId2 }); + modelBuilder.Entity().HasKey(c => new { c.Id1, c.Id2 }); + modelBuilder.Entity().HasAlternateKey(c => new { c.BurgerId1, c.BurgerId2 }); modelBuilder.Ignore(); modelBuilder.Ignore(); @@ -3604,10 +3545,8 @@ public virtual void Creates_index_even_if_covered_by_an_alternate_key() modelBuilder .Entity().HasOne().WithOne() - .HasForeignKey( - e => new { e.BurgerId1 }) - .HasPrincipalKey( - e => new { e.AlternateKey1 }); + .HasForeignKey(e => new { e.BurgerId1 }) + .HasPrincipalKey(e => new { e.AlternateKey1 }); var existingFk = dependentType.GetNavigations().Single().ForeignKey; Assert.Empty(principalType.GetForeignKeys()); @@ -3654,9 +3593,8 @@ public virtual void Throws_on_existing_many_to_one_relationship() dependentType.DisplayName() + "." + nameof(Nob.Hob), dependentType.DisplayName() + "." + nameof(Nob.Hobs), principalType.DisplayName() + "." + nameof(Hob.Nob)), - Assert.Throws( - () => - modelBuilder.Entity().HasOne(e => e.Hob).WithOne(e => e.Nob)).Message); + Assert.Throws(() => + modelBuilder.Entity().HasOne(e => e.Hob).WithOne(e => e.Nob)).Message); } [ConditionalFact] @@ -3701,9 +3639,8 @@ public virtual void Throws_on_existing_one_to_many_relationship() dependentType.DisplayName() + "." + nameof(Nob.Hob), principalType.DisplayName() + "." + nameof(Hob.Nobs), dependentType.DisplayName() + "." + nameof(Nob.Hob)), - Assert.Throws( - () => - modelBuilder.Entity().HasOne(e => e.Hob).WithOne(e => e.Nob)).Message); + Assert.Throws(() => + modelBuilder.Entity().HasOne(e => e.Hob).WithOne(e => e.Nob)).Message); } [ConditionalFact] @@ -3760,8 +3697,7 @@ public virtual void Nullable_FK_are_optional_by_default() modelBuilder .Entity().HasOne(e => e.Nob).WithOne(e => e.Hob) - .HasForeignKey( - e => new { e.HobId1, e.HobId2 }); + .HasForeignKey(e => new { e.HobId1, e.HobId2 }); var entityType = (IReadOnlyEntityType)modelBuilder.Model.FindEntityType(typeof(Nob)); @@ -3778,8 +3714,7 @@ public virtual void Non_nullable_FK_are_required_by_default() modelBuilder .Entity().HasOne(e => e.Hob).WithOne(e => e.Nob) - .HasForeignKey( - e => new { e.NobId1, e.NobId2 }); + .HasForeignKey(e => new { e.NobId1, e.NobId2 }); var entityType = (IReadOnlyEntityType)modelBuilder.Model.FindEntityType(typeof(Hob)); @@ -3806,8 +3741,7 @@ public virtual void Nullable_FK_can_be_made_required() .Entity() .Ignore(e => e.Nobs) .HasOne(e => e.Nob).WithOne(e => e.Hob) - .HasForeignKey( - e => new { e.HobId1, e.HobId2 }) + .HasForeignKey(e => new { e.HobId1, e.HobId2 }) .IsRequired(); modelBuilder.FinalizeModel(); @@ -3823,7 +3757,7 @@ public virtual void Nullable_FK_can_be_made_required() Assert.True(fk.IsRequired); Assert.True(fkProperty1.IsNullable); Assert.True(fkProperty2.IsNullable); - AssertEqual(new[] { fkProperty1, fkProperty2 }, fk.Properties); + AssertEqual([fkProperty1, fkProperty2], fk.Properties); AssertEqual(expectedDependentProperties, dependentType.GetProperties()); } @@ -3944,8 +3878,7 @@ public virtual void Unspecified_FK_can_be_made_required() modelBuilder .Entity().HasOne(e => e.Nob).WithOne(e => e.Hob) - .HasPrincipalKey( - e => new { e.Id1, e.Id2 }) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) .IsRequired(); var fk = dependentType.GetForeignKeys().Single(); @@ -3970,12 +3903,11 @@ public virtual void Throws_if_ambiguous_FK_made_required() modelBuilder.ModelLoggerFactory.Log, l => l.Level == LogLevel.Warning && l.Message == CoreResources.LogAmbiguousEndRequired(new TestLogger()) - .GenerateMessage("{'NobId11', 'NobId21'}", typeof(Hob).Name)); + .GenerateMessage("{'NobId11', 'NobId21'}", nameof(Hob))); Assert.Equal( - CoreStrings.AmbiguousEndRequiredInverted("{'NobId11', 'NobId21'}", typeof(Hob).Name, typeof(Nob).Name), - Assert.Throws( - () => foreignKeyBuilder.HasForeignKey()).Message); + CoreStrings.AmbiguousEndRequiredInverted("{'NobId11', 'NobId21'}", nameof(Hob), nameof(Nob)), + Assert.Throws(() => foreignKeyBuilder.HasForeignKey()).Message); } [ConditionalFact] @@ -3985,25 +3917,20 @@ public virtual void Can_be_defined_before_the_PK_from_principal() modelBuilder.Entity(); modelBuilder - .Entity( - eb => - { - eb.HasOne(e => e.Nob).WithOne(e => e.Hob) - .HasForeignKey( - e => new { e.HobId1, e.HobId2 }) - .HasPrincipalKey( - e => new { e.Id1, e.Id2 }); - eb.HasKey( - e => new { e.Id1, e.Id2 }); - }); - - modelBuilder.Entity().HasKey( - e => new { e.Id1, e.Id2 }); + .Entity(eb => + { + eb.HasOne(e => e.Nob).WithOne(e => e.Hob) + .HasForeignKey(e => new { e.HobId1, e.HobId2 }) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }); + eb.HasKey(e => new { e.Id1, e.Id2 }); + }); + + modelBuilder.Entity().HasKey(e => new { e.Id1, e.Id2 }); var dependentEntityType = modelBuilder.Model.FindEntityType(typeof(Nob)); var fk = dependentEntityType.GetForeignKeys().Single(); AssertEqual( - new[] { dependentEntityType.FindProperty("HobId1"), dependentEntityType.FindProperty("HobId2") }, fk.Properties); + [dependentEntityType.FindProperty("HobId1"), dependentEntityType.FindProperty("HobId2")], fk.Properties); Assert.False(fk.IsRequired); var principalEntityType = modelBuilder.Model.FindEntityType(typeof(Hob)); AssertEqual(fk.PrincipalKey.Properties, principalEntityType.FindPrimaryKey().Properties); @@ -4016,25 +3943,20 @@ public virtual void Can_be_defined_before_the_PK_from_dependent() modelBuilder.Entity(); modelBuilder - .Entity( - eb => - { - eb.HasOne(e => e.Nob).WithOne(e => e.Hob) - .HasForeignKey( - e => new { e.NobId1, e.NobId2 }) - .HasPrincipalKey( - e => new { e.Id1, e.Id2 }); - eb.HasKey( - e => new { e.Id1, e.Id2 }); - }); - - modelBuilder.Entity().HasKey( - e => new { e.Id1, e.Id2 }); + .Entity(eb => + { + eb.HasOne(e => e.Nob).WithOne(e => e.Hob) + .HasForeignKey(e => new { e.NobId1, e.NobId2 }) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }); + eb.HasKey(e => new { e.Id1, e.Id2 }); + }); + + modelBuilder.Entity().HasKey(e => new { e.Id1, e.Id2 }); var dependentEntityType = modelBuilder.Model.FindEntityType(typeof(Hob)); var fk = dependentEntityType.GetForeignKeys().Single(); AssertEqual( - new[] { dependentEntityType.FindProperty("NobId1"), dependentEntityType.FindProperty("NobId2") }, fk.Properties); + [dependentEntityType.FindProperty("NobId1"), dependentEntityType.FindProperty("NobId2")], fk.Properties); Assert.True(fk.IsRequired); var principalEntityType = modelBuilder.Model.FindEntityType(typeof(Nob)); AssertEqual(fk.PrincipalKey.Properties, principalEntityType.FindPrimaryKey().Properties); @@ -4091,13 +4013,12 @@ public virtual void Creates_shadow_FK_property_with_non_shadow_PK() // For NonGenericStringTest modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.HasOne(e => e.FirstNav) - .WithOne() - .HasForeignKey("ShadowId"); - }); + modelBuilder.Entity(b => + { + b.HasOne(e => e.FirstNav) + .WithOne() + .HasForeignKey("ShadowId"); + }); Assert.Equal( "ShadowId", @@ -4130,8 +4051,7 @@ public virtual void Creates_field_backed_FK_property() modelBuilder.Ignore(); - modelBuilder.Entity( - b => b.HasOne().WithOne().HasForeignKey("_forUp").IsRequired()); + modelBuilder.Entity(b => b.HasOne().WithOne().HasForeignKey("_forUp").IsRequired()); var fkProperty = modelBuilder.Model.FindEntityType(typeof(Quarks)).GetForeignKeys().Single().Properties.Single(); Assert.Equal("_forUp", fkProperty.Name); @@ -4155,7 +4075,7 @@ public virtual void Throws_if_multiple_navigations_are_pointing_to_same_foreign_ { var modelBuilder = CreateModelBuilder(); Assert.Equal( - CoreStrings.MultipleNavigationsSameFk(typeof(Zeta).Name, "CommonFkProperty", "'AlphaOne', 'AlphaTwo'"), + CoreStrings.MultipleNavigationsSameFk(nameof(Zeta), "CommonFkProperty", "'AlphaOne', 'AlphaTwo'"), Assert.Throws(() => modelBuilder.Entity().HasOne().WithOne()).Message); } @@ -4163,12 +4083,11 @@ public virtual void Throws_if_multiple_navigations_are_pointing_to_same_foreign_ public virtual void Can_create_self_referencing_relationship_without_navigations() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.SelfRef1); - b.Ignore(e => e.SelfRef2); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.SelfRef1); + b.Ignore(e => e.SelfRef2); + }); var relationship = modelBuilder.Entity() .HasOne() .WithOne() @@ -4185,12 +4104,11 @@ public virtual void Can_create_self_referencing_relationship_without_navigations public virtual void Can_create_relationship_if_dependent_has_matching_property_with_navigation_name() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.OneToOneDependentEntityId); - b.Ignore(e => e.NavOneToOneDependentEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.OneToOneDependentEntityId); + b.Ignore(e => e.NavOneToOneDependentEntityId); + }); modelBuilder.Entity(b => b.Ignore(e => e.OneToOnePrincipalEntityId)); modelBuilder.Entity().HasOne(e => e.NavOneToOneDependentEntity) @@ -4210,12 +4128,11 @@ public virtual void Can_create_relationship_if_dependent_has_matching_property_w public virtual void Can_create_relationship_if_dependent_has_matching_property_with_entity_type_name() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.OneToOneDependentEntityId); - b.Ignore(e => e.NavOneToOneDependentEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.OneToOneDependentEntityId); + b.Ignore(e => e.NavOneToOneDependentEntityId); + }); modelBuilder.Entity(b => b.Ignore(e => e.NavOneToOnePrincipalEntityId)); modelBuilder.Entity().HasOne(e => e.NavOneToOneDependentEntity) @@ -4236,12 +4153,11 @@ public virtual void Can_invert_relationship_if_principal_has_matching_property_w { var modelBuilder = CreateModelBuilder(); modelBuilder.Entity(b => b.Ignore(e => e.OneToOneDependentEntityId)); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.OneToOnePrincipalEntityId); - b.Ignore(e => e.NavOneToOnePrincipalEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.OneToOnePrincipalEntityId); + b.Ignore(e => e.NavOneToOnePrincipalEntityId); + }); modelBuilder.Entity().HasOne(e => e.NavOneToOneDependentEntity) .WithOne(e => e.NavOneToOnePrincipalEntity); @@ -4261,12 +4177,11 @@ public virtual void Can_invert_relationship_if_principal_has_matching_property_w { var modelBuilder = CreateModelBuilder(); modelBuilder.Entity(b => b.Ignore(e => e.NavOneToOneDependentEntityId)); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.OneToOnePrincipalEntityId); - b.Ignore(e => e.NavOneToOnePrincipalEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.OneToOnePrincipalEntityId); + b.Ignore(e => e.NavOneToOnePrincipalEntityId); + }); modelBuilder.Entity().HasOne(e => e.NavOneToOneDependentEntity) .WithOne(e => e.NavOneToOnePrincipalEntity); @@ -4286,18 +4201,16 @@ public virtual void Ignoring_properties_resolves_ambiguity() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.OneToOnePrincipalEntityId); - b.Ignore(e => e.NavOneToOnePrincipalEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.OneToOnePrincipalEntityId); + b.Ignore(e => e.NavOneToOnePrincipalEntityId); + }); modelBuilder.Entity().HasOne(e => e.NavOneToOneDependentEntity) .WithOne(e => e.NavOneToOnePrincipalEntity).IsRequired(); - modelBuilder.Entity( - b => b.Ignore(e => e.NavOneToOneDependentEntityId)); + modelBuilder.Entity(b => b.Ignore(e => e.NavOneToOneDependentEntityId)); modelBuilder.FinalizeModel(); } @@ -4307,18 +4220,16 @@ public virtual void Ignoring_properties_on_principal_resolves_ambiguity() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => b.Ignore(e => e.OneToOnePrincipalEntityId)); + modelBuilder.Entity(b => b.Ignore(e => e.OneToOnePrincipalEntityId)); modelBuilder.Entity().HasOne(e => e.NavOneToOneDependentEntity) .WithOne(e => e.NavOneToOnePrincipalEntity); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.OneToOneDependentEntityId); - b.Ignore(e => e.NavOneToOneDependentEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.OneToOneDependentEntityId); + b.Ignore(e => e.NavOneToOneDependentEntityId); + }); modelBuilder.FinalizeModel(); } @@ -4327,26 +4238,24 @@ public virtual void Ignoring_properties_on_principal_resolves_ambiguity() public virtual void Throws_for_one_to_one_relationship_if_no_side_has_matching_property() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.OneToOneDependentEntityId); - b.Ignore(e => e.NavOneToOneDependentEntityId); - }); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.OneToOnePrincipalEntityId); - b.Ignore(e => e.NavOneToOnePrincipalEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.OneToOneDependentEntityId); + b.Ignore(e => e.NavOneToOneDependentEntityId); + }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.OneToOnePrincipalEntityId); + b.Ignore(e => e.NavOneToOnePrincipalEntityId); + }); modelBuilder.Entity().HasOne(e => e.NavOneToOneDependentEntity) .WithOne(e => e.NavOneToOnePrincipalEntity); Assert.Equal( CoreStrings.AmbiguousOneToOneRelationship( - typeof(OneToOnePrincipalEntity).Name + "." + OneToOnePrincipalEntity.NavigationProperty.Name, - typeof(OneToOneDependentEntity).Name + "." + OneToOneDependentEntity.NavigationProperty.Name), + nameof(OneToOnePrincipalEntity) + "." + OneToOnePrincipalEntity.NavigationProperty.Name, + nameof(OneToOneDependentEntity) + "." + OneToOneDependentEntity.NavigationProperty.Name), Assert.Throws(() => modelBuilder.FinalizeModel()).Message); } @@ -4355,27 +4264,25 @@ public virtual void Throws_for_one_to_one_relationship_if_no_side_has_matching_p { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.OneToOnePrincipalEntityId); - b.Ignore(e => e.NavOneToOnePrincipalEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.OneToOnePrincipalEntityId); + b.Ignore(e => e.NavOneToOnePrincipalEntityId); + }); modelBuilder.Entity().HasOne(e => e.NavOneToOneDependentEntity) .WithOne(e => e.NavOneToOnePrincipalEntity).IsRequired(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.OneToOneDependentEntityId); - b.Ignore(e => e.NavOneToOneDependentEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.OneToOneDependentEntityId); + b.Ignore(e => e.NavOneToOneDependentEntityId); + }); Assert.Equal( CoreStrings.AmbiguousOneToOneRelationship( - typeof(OneToOnePrincipalEntity).Name + "." + OneToOnePrincipalEntity.NavigationProperty.Name, - typeof(OneToOneDependentEntity).Name + "." + OneToOneDependentEntity.NavigationProperty.Name), + nameof(OneToOnePrincipalEntity) + "." + OneToOnePrincipalEntity.NavigationProperty.Name, + nameof(OneToOneDependentEntity) + "." + OneToOneDependentEntity.NavigationProperty.Name), Assert.Throws(() => modelBuilder.FinalizeModel()).Message); } @@ -4391,8 +4298,8 @@ public virtual void Throws_for_one_to_one_relationship_if_both_sides_have_matchi Assert.Equal( CoreStrings.AmbiguousOneToOneRelationship( - typeof(OneToOnePrincipalEntity).Name + "." + OneToOnePrincipalEntity.NavigationProperty.Name, - typeof(OneToOneDependentEntity).Name + "." + OneToOneDependentEntity.NavigationProperty.Name), + nameof(OneToOnePrincipalEntity) + "." + OneToOnePrincipalEntity.NavigationProperty.Name, + nameof(OneToOneDependentEntity) + "." + OneToOneDependentEntity.NavigationProperty.Name), Assert.Throws(() => modelBuilder.FinalizeModel()).Message); } @@ -4408,8 +4315,8 @@ public virtual void Throws_for_one_to_one_relationship_if_both_sides_have_matchi Assert.Equal( CoreStrings.AmbiguousOneToOneRelationship( - typeof(OneToOnePrincipalEntity).Name + "." + OneToOnePrincipalEntity.NavigationProperty.Name, - typeof(OneToOneDependentEntity).Name + "." + OneToOneDependentEntity.NavigationProperty.Name), + nameof(OneToOnePrincipalEntity) + "." + OneToOnePrincipalEntity.NavigationProperty.Name, + nameof(OneToOneDependentEntity) + "." + OneToOneDependentEntity.NavigationProperty.Name), Assert.Throws(() => modelBuilder.FinalizeModel()).Message); } @@ -4425,8 +4332,8 @@ public virtual void Throws_for_one_to_one_relationship_if_both_sides_have_matchi Assert.Equal( CoreStrings.AmbiguousOneToOneRelationship( - typeof(OneToOnePrincipalEntity).Name + "." + OneToOnePrincipalEntity.NavigationProperty.Name, - typeof(OneToOneDependentEntity).Name + "." + OneToOneDependentEntity.NavigationProperty.Name), + nameof(OneToOnePrincipalEntity) + "." + OneToOnePrincipalEntity.NavigationProperty.Name, + nameof(OneToOneDependentEntity) + "." + OneToOneDependentEntity.NavigationProperty.Name), Assert.Throws(() => modelBuilder.FinalizeModel()).Message); } @@ -4434,32 +4341,30 @@ public virtual void Throws_for_one_to_one_relationship_if_both_sides_have_matchi public virtual void Throws_for_one_to_one_relationship_if_both_sides_have_matching_PKs() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.Id); - b.Ignore(e => e.NavOneToOneDependentEntityId); - b.Ignore(e => e.OneToOneDependentEntityId); - b.Property("Key"); - b.HasKey("Key"); - }); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.Id); - b.Ignore(e => e.NavOneToOnePrincipalEntityId); - b.Ignore(e => e.OneToOnePrincipalEntityId); - b.Property("Key"); - b.HasKey("Key"); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.Id); + b.Ignore(e => e.NavOneToOneDependentEntityId); + b.Ignore(e => e.OneToOneDependentEntityId); + b.Property("Key"); + b.HasKey("Key"); + }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.Id); + b.Ignore(e => e.NavOneToOnePrincipalEntityId); + b.Ignore(e => e.OneToOnePrincipalEntityId); + b.Property("Key"); + b.HasKey("Key"); + }); modelBuilder.Entity().HasOne(e => e.NavOneToOneDependentEntity) .WithOne(e => e.NavOneToOnePrincipalEntity); Assert.Equal( CoreStrings.AmbiguousOneToOneRelationship( - typeof(OneToOnePrincipalEntity).Name + "." + OneToOnePrincipalEntity.NavigationProperty.Name, - typeof(OneToOneDependentEntity).Name + "." + OneToOneDependentEntity.NavigationProperty.Name), + nameof(OneToOnePrincipalEntity) + "." + OneToOnePrincipalEntity.NavigationProperty.Name, + nameof(OneToOneDependentEntity) + "." + OneToOneDependentEntity.NavigationProperty.Name), Assert.Throws(() => modelBuilder.FinalizeModel()).Message); } @@ -4560,12 +4465,11 @@ public virtual void { var modelBuilder = CreateModelBuilder(); modelBuilder.Entity(b => b.Ignore(e => e.NavOneToOneDependentEntityId)); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.NavOneToOnePrincipalEntityId); - b.Ignore(e => e.OneToOnePrincipalEntityId); - }); + modelBuilder.Entity(b => + { + b.Ignore(e => e.NavOneToOnePrincipalEntityId); + b.Ignore(e => e.OneToOnePrincipalEntityId); + }); modelBuilder.Entity().HasOne(e => e.NavOneToOnePrincipalEntity); diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OwnedTypes.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OwnedTypes.cs index 57ee7f3e2e3..d157758611e 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OwnedTypes.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.OwnedTypes.cs @@ -72,14 +72,13 @@ public virtual void Can_configure_one_to_one_owned_type_with_fields() modelBuilder.Ignore(); modelBuilder.Owned(); - modelBuilder.Entity( - e => - { - e.Property(p => p.Id); - e.Property(p => p.AlternateKey); - e.Property(p => p.Description); - e.HasKey(p => p.Id); - }); + modelBuilder.Entity(e => + { + e.Property(p => p.Id); + e.Property(p => p.AlternateKey); + e.Property(p => p.Description); + e.HasKey(p => p.Id); + }); modelBuilder.Entity() .OwnsOne( @@ -118,14 +117,13 @@ public virtual void Can_configure_one_to_many_owned_type_with_fields() var modelBuilder = CreateModelBuilder(); modelBuilder.Owned(); - modelBuilder.Entity( - e => - { - e.Property(p => p.Id); - e.Property(p => p.AlternateKey); - e.Property(p => p.Description); - e.HasKey(p => p.Id); - }); + modelBuilder.Entity(e => + { + e.Property(p => p.Id); + e.Property(p => p.AlternateKey); + e.Property(p => p.Description); + e.HasKey(p => p.Id); + }); modelBuilder.Entity() .OwnsMany( @@ -286,14 +284,13 @@ public virtual void Changing_ownership_uniqueness_throws() false, nameof(Customer.Details), nameof(Customer)), - Assert.Throws( - () => customerBuilder.OwnsOne( - c => c.Details, - r => - { - r.HasOne(d => d.Customer) - .WithMany(); - })).Message); + Assert.Throws(() => customerBuilder.OwnsOne( + c => c.Details, + r => + { + r.HasOne(d => d.Customer) + .WithMany(); + })).Message); } [ConditionalFact] @@ -374,9 +371,8 @@ public virtual void Can_configure_one_to_one_relationship_from_an_owned_type() var ownership = model.FindEntityType(typeof(OtherCustomer)).FindNavigation(nameof(Customer.Details)).ForeignKey; var foreignKey = model.FindEntityType(typeof(SpecialCustomer)).GetReferencingForeignKeys() - .Single( - fk => fk.DeclaringEntityType.ClrType == typeof(CustomerDetails) - && fk.PrincipalToDependent == null); + .Single(fk => fk.DeclaringEntityType.ClrType == typeof(CustomerDetails) + && fk.PrincipalToDependent == null); Assert.Same(ownership.DeclaringEntityType, foreignKey.DeclaringEntityType); Assert.NotEqual(ownership.Properties.Single().Name, foreignKey.Properties.Single().Name); Assert.Equal(2, model.FindEntityTypes(typeof(CustomerDetails)).Count()); @@ -399,7 +395,7 @@ public virtual void Can_configure_owned_type_collection_from_an_owned_type() var chainedOwnership = owned.FindNavigation(nameof(Customer.Orders)).ForeignKey; var chainedOwned = chainedOwnership.DeclaringEntityType; Assert.Equal( - new[] { nameof(Order.CustomerId), nameof(Order.OrderId) }, + [nameof(Order.CustomerId), nameof(Order.OrderId)], chainedOwned.FindPrimaryKey().Properties.Select(p => p.Name)); entityBuilder.HasKey(o => o.OrderId); @@ -575,9 +571,8 @@ public virtual void Can_configure_one_to_one_relationship_from_an_owned_type_col Assert.Equal("CustomerId", ownership2.Properties.Single().Name); var foreignKey = model.FindEntityType(typeof(SpecialCustomer)).GetReferencingForeignKeys() - .Single( - fk => fk.DeclaringEntityType.ClrType == typeof(Order) - && fk.PrincipalToDependent == null); + .Single(fk => fk.DeclaringEntityType.ClrType == typeof(Order) + && fk.PrincipalToDependent == null); Assert.Same(ownership1.DeclaringEntityType, foreignKey.DeclaringEntityType); Assert.Null(foreignKey.PrincipalToDependent); Assert.NotEqual(ownership1.Properties.Single().Name, foreignKey.Properties.Single().Name); @@ -616,13 +611,10 @@ public enum HasDataOverload Params = 4 } - [ConditionalTheory] - [InlineData(HasDataOverload.Array)] - [InlineData(HasDataOverload.Array | HasDataOverload.Params)] - [InlineData(HasDataOverload.Array | HasDataOverload.Generic)] - [InlineData(HasDataOverload.Array | HasDataOverload.Params | HasDataOverload.Generic)] - [InlineData(HasDataOverload.Enumerable)] - [InlineData(HasDataOverload.Enumerable | HasDataOverload.Generic)] + [ConditionalTheory, InlineData(HasDataOverload.Array), InlineData(HasDataOverload.Array | HasDataOverload.Params), + InlineData(HasDataOverload.Array | HasDataOverload.Generic), + InlineData(HasDataOverload.Array | HasDataOverload.Params | HasDataOverload.Generic), InlineData(HasDataOverload.Enumerable), + InlineData(HasDataOverload.Enumerable | HasDataOverload.Generic)] public virtual void Can_configure_owned_type_from_an_owned_type_collection(HasDataOverload hasDataOverload) { var modelBuilder = CreateModelBuilder(); @@ -761,7 +753,7 @@ public virtual void Can_configure_owned_type_collection_without_explicit_key() Assert.Equal(nameof(Order.CustomerId), ownership.Properties.Single().Name); Assert.Single(owned.GetForeignKeys()); var pk = owned.FindPrimaryKey(); - Assert.Equal(new[] { nameof(Order.CustomerId), nameof(Order.OrderId) }, pk.Properties.Select(p => p.Name)); + Assert.Equal([nameof(Order.CustomerId), nameof(Order.OrderId)], pk.Properties.Select(p => p.Name)); Assert.Empty(owned.GetIndexes()); var chainedOwnership = owned.FindNavigation(nameof(Order.Products)).ForeignKey; @@ -769,9 +761,9 @@ public virtual void Can_configure_owned_type_collection_without_explicit_key() Assert.True(chainedOwnership.IsOwnership); Assert.False(chainedOwnership.IsUnique); Assert.Equal(nameof(Product.Order), chainedOwnership.DependentToPrincipal.Name); - Assert.Equal(new[] { "OrderCustomerId", "OrderId" }, chainedOwnership.Properties.Select(p => p.Name)); + Assert.Equal(["OrderCustomerId", "OrderId"], chainedOwnership.Properties.Select(p => p.Name)); var chainedPk = chainedOwned.FindPrimaryKey(); - Assert.Equal(new[] { "OrderCustomerId", "OrderId", nameof(Product.Id) }, chainedPk.Properties.Select(p => p.Name)); + Assert.Equal(["OrderCustomerId", "OrderId", nameof(Product.Id)], chainedPk.Properties.Select(p => p.Name)); Assert.Empty(chainedOwned.GetIndexes()); Assert.Equal(4, model.GetEntityTypes().Count()); @@ -808,7 +800,7 @@ public virtual void Can_configure_owned_type_collection_without_explicit_key_or_ Assert.Equal(nameof(Order.CustomerId), ownership.Properties.Single().Name); Assert.Single(owned.GetForeignKeys()); var pk = owned.FindPrimaryKey(); - Assert.Equal(new[] { nameof(Order.CustomerId), "Id" }, pk.Properties.Select(p => p.Name)); + Assert.Equal([nameof(Order.CustomerId), "Id"], pk.Properties.Select(p => p.Name)); Assert.Empty(owned.GetIndexes()); var chainedOwnership = owned.FindNavigation(nameof(Order.Products)).ForeignKey; @@ -816,9 +808,9 @@ public virtual void Can_configure_owned_type_collection_without_explicit_key_or_ Assert.True(chainedOwnership.IsOwnership); Assert.False(chainedOwnership.IsUnique); Assert.Equal(nameof(Product.Order), chainedOwnership.DependentToPrincipal.Name); - Assert.Equal(new[] { "OrderCustomerId", "OrderId" }, chainedOwnership.Properties.Select(p => p.Name)); + Assert.Equal(["OrderCustomerId", "OrderId"], chainedOwnership.Properties.Select(p => p.Name)); var chainedPk = chainedOwned.FindPrimaryKey(); - Assert.Equal(new[] { "OrderCustomerId", "OrderId", "Id1" }, chainedPk.Properties.Select(p => p.Name)); + Assert.Equal(["OrderCustomerId", "OrderId", "Id1"], chainedPk.Properties.Select(p => p.Name)); Assert.Empty(chainedOwned.GetIndexes()); Assert.Equal(4, model.GetEntityTypes().Count()); @@ -1075,12 +1067,11 @@ public virtual void Can_map_derived_of_owned_type() var owned = owner.FindNavigation(nameof(OrderCombination.Details)).ForeignKey.DeclaringEntityType; Assert.Empty(owned.GetDirectlyDerivedTypes()); Assert.Null(owned.GetDiscriminatorPropertyName()); - var navToCustomerDetails = model.GetEntityTypes().SelectMany(e => e.GetDeclaredNavigations()).Where( - n => - { - var targetType = n.TargetEntityType.ClrType; - return targetType != typeof(DetailsBase) && typeof(DetailsBase).IsAssignableFrom(targetType); - }).Single(); + var navToCustomerDetails = model.GetEntityTypes().SelectMany(e => e.GetDeclaredNavigations()).Where(n => + { + var targetType = n.TargetEntityType.ClrType; + return targetType != typeof(DetailsBase) && typeof(DetailsBase).IsAssignableFrom(targetType); + }).Single(); Assert.Single(owned.GetForeignKeys()); Assert.Equal(1, model.GetEntityTypes().Count(e => e.ClrType == typeof(DetailsBase))); var derivedType = model.FindEntityType(typeof(CustomerDetails)); @@ -1112,12 +1103,11 @@ public virtual void Can_map_derived_of_owned_type_first() var owned = owner.FindNavigation(nameof(OrderCombination.Details)).ForeignKey.DeclaringEntityType; Assert.Empty(owned.GetDirectlyDerivedTypes()); Assert.Null(owned.GetDiscriminatorPropertyName()); - var navToCustomerDetails = model.GetEntityTypes().SelectMany(e => e.GetDeclaredNavigations()).Where( - n => - { - var targetType = n.TargetEntityType.ClrType; - return targetType != typeof(DetailsBase) && typeof(DetailsBase).IsAssignableFrom(targetType); - }).Single(); + var navToCustomerDetails = model.GetEntityTypes().SelectMany(e => e.GetDeclaredNavigations()).Where(n => + { + var targetType = n.TargetEntityType.ClrType; + return targetType != typeof(DetailsBase) && typeof(DetailsBase).IsAssignableFrom(targetType); + }).Single(); Assert.Single(owned.GetForeignKeys()); Assert.Single(model.FindEntityTypes(typeof(DetailsBase))); var derivedType = model.FindEntityType(typeof(CustomerDetails)); @@ -1218,8 +1208,7 @@ public virtual void Throws_on_FK_matching_two_relationships() nameof(BookLabel), nameof(Book) + "." + nameof(Book.AlternateLabel), "{'" + nameof(BookLabel.BookId) + "'}"), - Assert.Throws( - () => modelBuilder.FinalizeModel()).Message); + Assert.Throws(() => modelBuilder.FinalizeModel()).Message); } [ConditionalFact] @@ -1561,15 +1550,10 @@ public virtual void Can_configure_self_ownership() Assert.Equal(2, model.GetEntityTypes().Count(e => e.ClrType == typeof(AnotherBookLabel))); } - [ConditionalTheory] // Issue #28091 - [InlineData(16, 2, 16, 4, 16, 4, 16, 4, 16, 4)] - [InlineData(16, 2, 17, 4, 17, 4, 17, 4, 17, 4)] - [InlineData(null, null, 16, 4, 16, 4, 16, 4, 16, 4)] - [InlineData(null, null, 16, 4, 15, 3, 14, 2, 13, 1)] - [InlineData(null, null, 16, null, 15, null, 14, null, 13, null)] - [InlineData(17, null, 16, null, 15, null, 14, null, 13, null)] - [InlineData(17, 5, 16, 4, 15, 3, 14, 2, 13, 1)] - [InlineData(17, 5, null, null, null, null, null, null, null, null)] + [ConditionalTheory, InlineData(16, 2, 16, 4, 16, 4, 16, 4, 16, 4), InlineData(16, 2, 17, 4, 17, 4, 17, 4, 17, 4), + InlineData(null, null, 16, 4, 16, 4, 16, 4, 16, 4), InlineData(null, null, 16, 4, 15, 3, 14, 2, 13, 1), + InlineData(null, null, 16, null, 15, null, 14, null, 13, null), InlineData(17, null, 16, null, 15, null, 14, null, 13, null), + InlineData(17, 5, 16, 4, 15, 3, 14, 2, 13, 1), InlineData(17, 5, null, null, null, null, null, null, null, null)] // Issue #28091 public virtual void Precision_and_scale_for_property_type_used_in_owned_types_can_be_overwritten( int? defaultPrecision, int? defaultScale, @@ -1582,43 +1566,40 @@ public virtual void Precision_and_scale_for_property_type_used_in_owned_types_ca int? manyPrecision, int? manyScale) { - var modelBuilder = CreateModelBuilder( - c => + var modelBuilder = CreateModelBuilder(c => + { + if (defaultPrecision.HasValue) { - if (defaultPrecision.HasValue) + if (defaultScale.HasValue) { - if (defaultScale.HasValue) - { - c.Properties().HavePrecision(defaultPrecision.Value, defaultScale.Value); - } - else - { - c.Properties().HavePrecision(defaultPrecision.Value); - } + c.Properties().HavePrecision(defaultPrecision.Value, defaultScale.Value); } - }); + else + { + c.Properties().HavePrecision(defaultPrecision.Value); + } + } + }); - modelBuilder.Entity( - b => - { - HasPrecision(b.Property(x => x.Number), mainPrecision, mainScale); - b.OwnsOne( - b => b.OwnedEntity, b => - { - HasPrecision(b.Property(x => x.Number), onePrecision, oneScale); - }); - }); + modelBuilder.Entity(b => + { + HasPrecision(b.Property(x => x.Number), mainPrecision, mainScale); + b.OwnsOne( + b => b.OwnedEntity, b => + { + HasPrecision(b.Property(x => x.Number), onePrecision, oneScale); + }); + }); - modelBuilder.Entity( - b => - { - HasPrecision(b.Property(x => x.Number), otherPrecision, otherScale); - b.OwnsMany( - b => b.OwnedEntities, b => - { - HasPrecision(b.Property(x => x.Number), manyPrecision, manyScale); - }); - }); + modelBuilder.Entity(b => + { + HasPrecision(b.Property(x => x.Number), otherPrecision, otherScale); + b.OwnsMany( + b => b.OwnedEntities, b => + { + HasPrecision(b.Property(x => x.Number), manyPrecision, manyScale); + }); + }); var model = modelBuilder.FinalizeModel(); @@ -1682,16 +1663,15 @@ public virtual void Can_configure_property_and_owned_entity_of_same_type() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.Property(d => d.Id) - .HasConversion( - id => id.Value, - value => new DepartmentId(value)); + modelBuilder.Entity(b => + { + b.Property(d => d.Id) + .HasConversion( + id => id.Value, + value => new DepartmentId(value)); - b.OwnsMany(d => d.DepartmentIds); - }); + b.OwnsMany(d => d.DepartmentIds); + }); modelBuilder.Entity() .OwnsMany(o => o.DepartmentIds); @@ -1720,16 +1700,15 @@ public virtual void Can_configure_owned_entity_and_property_of_same_type() modelBuilder.Entity() .OwnsMany(o => o.DepartmentIds); - modelBuilder.Entity( - b => - { - b.Property(d => d.Id) - .HasConversion( - id => id.Value, - value => new DepartmentId(value)); + modelBuilder.Entity(b => + { + b.Property(d => d.Id) + .HasConversion( + id => id.Value, + value => new DepartmentId(value)); - b.OwnsMany(d => d.DepartmentIds); - }); + b.OwnsMany(d => d.DepartmentIds); + }); var model = modelBuilder.FinalizeModel(); @@ -1758,8 +1737,7 @@ public virtual void Reconfiguring_entity_type_as_owned_throws() Assert.Equal( CoreStrings.ClashingNonOwnedEntityType(nameof(CustomerDetails)), - Assert.Throws( - () => modelBuilder.Entity().OwnsOne(c => c.Details)).Message); + Assert.Throws(() => modelBuilder.Entity().OwnsOne(c => c.Details)).Message); } [ConditionalFact] @@ -1772,8 +1750,7 @@ public virtual void Reconfiguring_owned_type_as_non_owned_throws() Assert.Equal( CoreStrings.ClashingOwnedEntityType(nameof(CustomerDetails)), - Assert.Throws( - () => modelBuilder.Entity().HasOne(c => c.Details)).Message); + Assert.Throws(() => modelBuilder.Entity().HasOne(c => c.Details)).Message); } [ConditionalFact] @@ -1795,8 +1772,7 @@ public virtual void Deriving_from_owned_type_throws() modelBuilder.Model.IsShared(typeof(BookLabel)) ? CoreStrings.ClashingSharedType(nameof(BookLabel)) : CoreStrings.ClashingOwnedEntityType(nameof(BookLabel)), - Assert.Throws( - () => modelBuilder.Entity().HasBaseType()).Message); + Assert.Throws(() => modelBuilder.Entity().HasBaseType()).Message); } [ConditionalFact] @@ -1812,8 +1788,7 @@ public virtual void Configuring_base_type_as_owned_throws() Assert.Equal( CoreStrings.ClashingNonOwnedDerivedEntityType(nameof(BookLabel), nameof(AnotherBookLabel)), - Assert.Throws( - () => modelBuilder.Entity().OwnsOne(c => c.Label)).Message); + Assert.Throws(() => modelBuilder.Entity().OwnsOne(c => c.Label)).Message); } [ConditionalFact] @@ -1978,11 +1953,10 @@ public virtual void Attempt_to_create_OwnsMany_on_a_reference_throws() CoreStrings.UnableToSetIsUnique( false, "OwnedDependent", - typeof(OneToOneNavPrincipalOwner).Name), - Assert.Throws( - () => modelBuilder - .Entity() - .OwnsMany("OwnedDependent")).Message + nameof(OneToOneNavPrincipalOwner)), + Assert.Throws(() => modelBuilder + .Entity() + .OwnsMany("OwnedDependent")).Message ); } @@ -1995,11 +1969,10 @@ public virtual void Attempt_to_create_OwnsOne_on_a_collection_throws() CoreStrings.UnableToSetIsUnique( true, "OwnedDependents", - typeof(OneToManyNavPrincipalOwner).Name), - Assert.Throws( - () => modelBuilder - .Entity() - .OwnsOne("OwnedDependents")).Message); + nameof(OneToManyNavPrincipalOwner)), + Assert.Throws(() => modelBuilder + .Entity() + .OwnsOne("OwnedDependents")).Message); } [ConditionalFact] @@ -2007,27 +1980,26 @@ public virtual void Shared_type_can_be_used_as_owned_type() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.OwnsOne( - "Shared1", e => e.Reference, sb => - { - sb.IndexerProperty("Value"); - }); - b.OwnsMany("Shared2", e => e.Collection).IndexerProperty("IsDeleted"); - b.OwnsOne( - e => e.OwnedNavigation, - o => - { - o.OwnsOne( - "Shared3", e => e.Reference, sb => - { - sb.IndexerProperty("NestedValue"); - }); - o.OwnsMany("Shared4", e => e.Collection).IndexerProperty("NestedLong"); - }); - }); + modelBuilder.Entity(b => + { + b.OwnsOne( + "Shared1", e => e.Reference, sb => + { + sb.IndexerProperty("Value"); + }); + b.OwnsMany("Shared2", e => e.Collection).IndexerProperty("IsDeleted"); + b.OwnsOne( + e => e.OwnedNavigation, + o => + { + o.OwnsOne( + "Shared3", e => e.Reference, sb => + { + sb.IndexerProperty("NestedValue"); + }); + o.OwnsMany("Shared4", e => e.Collection).IndexerProperty("NestedLong"); + }); + }); var model = modelBuilder.FinalizeModel(); @@ -2062,18 +2034,16 @@ public virtual void Shared_type_used_as_owned_type_throws_for_same_name() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.OwnsOne("Shared1", e => e.Reference); - b.OwnsOne("Shared1", e => e.Reference); - - Assert.Equal( - CoreStrings.ClashingNamedOwnedType( - "Shared1", nameof(OwnerOfSharedType), nameof(OwnerOfSharedType.Collection)), - Assert.Throws( - () => b.OwnsMany("Shared1", e => e.Collection)).Message); - }); + modelBuilder.Entity(b => + { + b.OwnsOne("Shared1", e => e.Reference); + b.OwnsOne("Shared1", e => e.Reference); + + Assert.Equal( + CoreStrings.ClashingNamedOwnedType( + "Shared1", nameof(OwnerOfSharedType), nameof(OwnerOfSharedType.Collection)), + Assert.Throws(() => b.OwnsMany("Shared1", e => e.Collection)).Message); + }); } [ConditionalFact] @@ -2082,23 +2052,22 @@ public virtual void PrimitiveCollectionBuilder_methods_can_be_chained() .Entity() .OwnsOne(e => e.CollectionQuarks) .PrimitiveCollection(e => e.Up) - .ElementType( - t => t - .HasAnnotation("B", "C") - .HasConversion(typeof(long)) - .HasConversion(new CastingConverter()) - .HasConversion(typeof(long), typeof(CustomValueComparer)) - .HasConversion(typeof(long), new CustomValueComparer()) - .HasConversion(new CastingConverter()) - .HasConversion(new CastingConverter(), new CustomValueComparer()) - .HasConversion() - .HasConversion(new CustomValueComparer()) - .HasConversion>() - .HasMaxLength(2) - .HasPrecision(1) - .HasPrecision(1, 2) - .IsRequired() - .IsUnicode()) + .ElementType(t => t + .HasAnnotation("B", "C") + .HasConversion(typeof(long)) + .HasConversion(new CastingConverter()) + .HasConversion(typeof(long), typeof(CustomValueComparer)) + .HasConversion(typeof(long), new CustomValueComparer()) + .HasConversion(new CastingConverter()) + .HasConversion(new CastingConverter(), new CustomValueComparer()) + .HasConversion() + .HasConversion(new CustomValueComparer()) + .HasConversion>() + .HasMaxLength(2) + .HasPrecision(1) + .HasPrecision(1, 2) + .IsRequired() + .IsUnicode()) .IsRequired() .HasAnnotation("A", "V") .IsConcurrencyToken() @@ -2121,23 +2090,22 @@ public virtual void PrimitiveCollectionBuilder_methods_can_be_chained_on_collect .Entity() .OwnsMany(e => e.Orders) .PrimitiveCollection>("List") - .ElementType( - t => t - .HasAnnotation("B", "C") - .HasConversion(typeof(long)) - .HasConversion(new CastingConverter()) - .HasConversion(typeof(long), typeof(CustomValueComparer)) - .HasConversion(typeof(long), new CustomValueComparer()) - .HasConversion(new CastingConverter()) - .HasConversion(new CastingConverter(), new CustomValueComparer()) - .HasConversion() - .HasConversion(new CustomValueComparer()) - .HasConversion>() - .HasMaxLength(2) - .HasPrecision(1) - .HasPrecision(1, 2) - .IsRequired() - .IsUnicode()) + .ElementType(t => t + .HasAnnotation("B", "C") + .HasConversion(typeof(long)) + .HasConversion(new CastingConverter()) + .HasConversion(typeof(long), typeof(CustomValueComparer)) + .HasConversion(typeof(long), new CustomValueComparer()) + .HasConversion(new CastingConverter()) + .HasConversion(new CastingConverter(), new CustomValueComparer()) + .HasConversion() + .HasConversion(new CustomValueComparer()) + .HasConversion>() + .HasMaxLength(2) + .HasPrecision(1) + .HasPrecision(1, 2) + .IsRequired() + .IsUnicode()) .IsRequired() .HasAnnotation("A", "V") .IsConcurrencyToken() diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.TestModel.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.TestModel.cs index c63fbce9c52..e15a91575a1 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.TestModel.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.TestModel.cs @@ -660,8 +660,7 @@ protected class OneToOnePrincipalEntityWithAnnotation public int OneToOneDependentEntityWithAnnotationId { get; set; } public int FkProperty { get; set; } - [NotMapped] - [ForeignKey("FkProperty")] + [NotMapped, ForeignKey("FkProperty")] public required OneToOneDependentEntityWithAnnotation NavOneToOneDependentEntityWithAnnotation { get; set; } } @@ -789,8 +788,11 @@ protected class CustomId : IEnumerable { public int Id { get; set; } - public IEnumerator GetEnumerator() => throw new NotImplementedException(); - IEnumerator IEnumerable.GetEnumerator() => throw new NotImplementedException(); + public IEnumerator GetEnumerator() + => throw new NotImplementedException(); + + IEnumerator IEnumerable.GetEnumerator() + => throw new NotImplementedException(); } protected class ValueCategory diff --git a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.cs b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.cs index 3d5d9fbb92e..87272a1ec17 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest.cs @@ -205,7 +205,8 @@ public abstract TestComplexCollectionBuilder ComplexCollection where TElement : notnull; - public abstract TestComplexCollectionBuilder ComplexCollection(string propertyName, + public abstract TestComplexCollectionBuilder ComplexCollection( + string propertyName, string complexTypeName) where TProperty : IEnumerable where TElement : notnull; @@ -908,7 +909,8 @@ public abstract TestComplexCollectionTypePropertyBuilder HasConversio ValueComparer? valueComparer, ValueComparer? providerComparerType); - public abstract TestComplexCollectionTypePropertyBuilder HasConversion(ValueConverter converter); + public abstract TestComplexCollectionTypePropertyBuilder HasConversion( + ValueConverter converter); public abstract TestComplexCollectionTypePropertyBuilder HasConversion( ValueConverter converter, @@ -920,7 +922,10 @@ public abstract TestComplexCollectionTypePropertyBuilder HasConversio ValueComparer? providerComparerType); public abstract TestComplexCollectionTypePropertyBuilder HasConversion(ValueConverter? converter); - public abstract TestComplexCollectionTypePropertyBuilder HasConversion(ValueConverter? converter, ValueComparer? valueComparer); + + public abstract TestComplexCollectionTypePropertyBuilder HasConversion( + ValueConverter? converter, + ValueComparer? valueComparer); public abstract TestComplexCollectionTypePropertyBuilder HasConversion( ValueConverter? converter, diff --git a/test/EFCore.Specification.Tests/ModelBuilding101ManyToManyTestBase.cs b/test/EFCore.Specification.Tests/ModelBuilding101ManyToManyTestBase.cs index b22946a0d46..4af87d42906 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding101ManyToManyTestBase.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding101ManyToManyTestBase.cs @@ -651,12 +651,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) => modelBuilder.Entity() .HasMany(e => e.Tags) .WithMany(e => e.Posts) - .UsingEntity( - j => - { - j.IndexerProperty("Id"); - j.HasKey("Id"); - }); + .UsingEntity(j => + { + j.IndexerProperty("Id"); + j.HasKey("Id"); + }); } public class Context1 : Context0 diff --git a/test/EFCore.Specification.Tests/ModelBuilding101OneToManyNrtTestBase.cs b/test/EFCore.Specification.Tests/ModelBuilding101OneToManyNrtTestBase.cs index 71666a66457..6ee8a4fed5b 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding101OneToManyNrtTestBase.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding101OneToManyNrtTestBase.cs @@ -84,9 +84,7 @@ public class Post [ForeignKey("Blog")] public int BlogId { get; set; } - [InverseProperty("Posts")] - [Required] - [ForeignKey("BlogId")] + [InverseProperty("Posts"), Required, ForeignKey("BlogId")] public Blog Blog { get; set; } = null!; } @@ -173,8 +171,7 @@ public class Post [ForeignKey("Blog")] public int? BlogId { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] + [InverseProperty("Posts"), ForeignKey("BlogId")] public Blog? Blog { get; set; } } @@ -257,9 +254,7 @@ public class Post { public int Id { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Posts"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } @@ -342,8 +337,7 @@ public class Post { public int Id { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] + [InverseProperty("Posts"), ForeignKey("BlogId")] public Blog? Blog { get; set; } } @@ -715,12 +709,10 @@ public class Post { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [ForeignKey("BlogId")] - [Required] + [ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } @@ -882,8 +874,7 @@ public class Post { public int Id { get; set; } - [ForeignKey("BlogId")] - [Required] + [ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } @@ -1313,13 +1304,10 @@ public class Post { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Posts"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } @@ -1412,8 +1400,7 @@ public class Post [ForeignKey("Blog")] public int? BlogId { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] + [InverseProperty("Posts"), ForeignKey("BlogId")] public Blog? Blog { get; set; } } @@ -1502,9 +1489,7 @@ public class Post { public int Id { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Posts"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } @@ -1593,8 +1578,7 @@ public class Post { public int Id { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] + [InverseProperty("Posts"), ForeignKey("BlogId")] public Blog? Blog { get; set; } } @@ -1649,30 +1633,28 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class Context1 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - nestedBuilder => - { - nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(nestedBuilder => + { + nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); - nestedBuilder.HasMany(e => e.Posts) - .WithOne(e => e.Blog); - }); + nestedBuilder.HasMany(e => e.Posts) + .WithOne(e => e.Blog); + }); } public class Context2 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - nestedBuilder => - { - nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(nestedBuilder => + { + nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); - nestedBuilder.HasMany(e => e.Posts) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) - .IsRequired(); - }); + nestedBuilder.HasMany(e => e.Posts) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) + .IsRequired(); + }); } public class Context3 : Context0 @@ -1734,9 +1716,7 @@ public class Post public int BlogId1 { get; set; } public int BlogId2 { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId1, BlogId2")] - [Required] + [InverseProperty("Posts"), ForeignKey("BlogId1, BlogId2"), Required] public Blog Blog { get; set; } = null!; } @@ -1785,30 +1765,28 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class Context1 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog); + }); } public class Context2 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) - .IsRequired(false); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) + .IsRequired(false); + }); } public class Context3 : Context0 @@ -1870,8 +1848,7 @@ public class Post public int BlogId1 { get; set; } public int? BlogId2 { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId1, BlogId2")] + [InverseProperty("Posts"), ForeignKey("BlogId1, BlogId2")] public Blog? Blog { get; set; } } @@ -1918,30 +1895,28 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class Context1 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog); + }); } public class Context2 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey("BlogId1", "BlogId2") - .IsRequired(); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey("BlogId1", "BlogId2") + .IsRequired(); + }); } public class Context3 : Context0 @@ -1999,9 +1974,7 @@ public class Post { public int Id { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId1, BlogId2")] - [Required] + [InverseProperty("Posts"), ForeignKey("BlogId1, BlogId2"), Required] public Blog Blog { get; set; } = null!; } @@ -2048,30 +2021,28 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class Context1 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog); + }); } public class Context2 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey("BlogId1", "BlogId2") - .IsRequired(false); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey("BlogId1", "BlogId2") + .IsRequired(false); + }); } public class Context3 : Context0 @@ -2129,8 +2100,7 @@ public class Post { public int Id { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId1, BlogId2")] + [InverseProperty("Posts"), ForeignKey("BlogId1, BlogId2")] public Blog? Blog { get; set; } } @@ -2191,8 +2161,7 @@ public class Employee [ForeignKey("Manager")] public int? ManagerId { get; set; } - [InverseProperty("Reports")] - [ForeignKey("ManagerId")] + [InverseProperty("Reports"), ForeignKey("ManagerId")] public Employee? Manager { get; set; } [InverseProperty("Manager")] @@ -2300,14 +2269,10 @@ public class Post { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] - [Required] - [DeleteBehavior(DeleteBehavior.Restrict)] + [InverseProperty("Posts"), ForeignKey("BlogId"), Required, DeleteBehavior(DeleteBehavior.Restrict)] public Blog Blog { get; set; } = null!; } diff --git a/test/EFCore.Specification.Tests/ModelBuilding101OneToManyTestBase.cs b/test/EFCore.Specification.Tests/ModelBuilding101OneToManyTestBase.cs index 7c741e00130..502ffe037ac 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding101OneToManyTestBase.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding101OneToManyTestBase.cs @@ -83,13 +83,10 @@ public class Post { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Posts"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } } @@ -176,8 +173,7 @@ public class Post [ForeignKey("Blog")] public int? BlogId { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] + [InverseProperty("Posts"), ForeignKey("BlogId")] public Blog Blog { get; set; } } @@ -289,9 +285,7 @@ public class Post { public int Id { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Posts"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } } @@ -374,8 +368,7 @@ public class Post { public int Id { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] + [InverseProperty("Posts"), ForeignKey("BlogId")] public Blog Blog { get; set; } } @@ -969,8 +962,7 @@ public class Post { public int Id { get; set; } - [Required] - [ForeignKey("BlogId")] + [Required, ForeignKey("BlogId")] public Blog Blog { get; set; } } @@ -1367,9 +1359,7 @@ public class Post [ForeignKey("Blog")] public int BlogId { get; set; } - [ForeignKey("BlogId")] - [Required] - [InverseProperty("Posts")] + [ForeignKey("BlogId"), Required, InverseProperty("Posts")] public Blog Blog { get; set; } } @@ -1475,8 +1465,7 @@ public class Post [ForeignKey("Blog")] public int? BlogId { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId")] + [InverseProperty("Posts"), ForeignKey("BlogId")] public Blog Blog { get; set; } } @@ -1596,9 +1585,7 @@ public class Post { public int Id { get; set; } - [Required] - [ForeignKey("BlogAlternateId")] - [InverseProperty("Posts")] + [Required, ForeignKey("BlogAlternateId"), InverseProperty("Posts")] public Blog Blog { get; set; } } @@ -1687,8 +1674,7 @@ public class Post { public int Id { get; set; } - [ForeignKey("BlogAlternateId")] - [InverseProperty("Posts")] + [ForeignKey("BlogAlternateId"), InverseProperty("Posts")] public Blog Blog { get; set; } } @@ -1743,31 +1729,29 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class Context1 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - nestedBuilder => - { - nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(nestedBuilder => + { + nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); - nestedBuilder.HasMany(e => e.Posts) - .WithOne(e => e.Blog) - .IsRequired(); - }); + nestedBuilder.HasMany(e => e.Posts) + .WithOne(e => e.Blog) + .IsRequired(); + }); } public class Context2 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - nestedBuilder => - { - nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(nestedBuilder => + { + nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); - nestedBuilder.HasMany(e => e.Posts) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) - .IsRequired(); - }); + nestedBuilder.HasMany(e => e.Posts) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) + .IsRequired(); + }); } public class Context3 : Context0 @@ -1829,9 +1813,7 @@ public class Post public int BlogId1 { get; set; } public int BlogId2 { get; set; } - [ForeignKey("BlogId1, BlogId2")] - [InverseProperty("Posts")] - [Required] + [ForeignKey("BlogId1, BlogId2"), InverseProperty("Posts"), Required] public Blog Blog { get; set; } } @@ -1880,30 +1862,28 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class Context1 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog); + }); } public class Context2 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) - .IsRequired(false); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) + .IsRequired(false); + }); } public class Context3 : Context0 @@ -1965,8 +1945,7 @@ public class Post public int BlogId1 { get; set; } public int? BlogId2 { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId1, BlogId2")] + [InverseProperty("Posts"), ForeignKey("BlogId1, BlogId2")] public Blog Blog { get; set; } } @@ -2010,43 +1989,40 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity() .HasKey(e => new { e.Id1, e.Id2 }); - modelBuilder.Entity( - b => - { - b.Property("BlogId1"); - b.Property("BlogId2"); - }); + modelBuilder.Entity(b => + { + b.Property("BlogId1"); + b.Property("BlogId2"); + }); } } public class Context1 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog) - .IsRequired(); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog) + .IsRequired(); + }); } public class Context2 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey("BlogId1", "BlogId2") - .IsRequired(); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey("BlogId1", "BlogId2") + .IsRequired(); + }); } public class Context3 : Context0 @@ -2106,9 +2082,7 @@ public class Post { public int Id { get; set; } - [Required] - [ForeignKey("BlogId1, BlogId2")] - [InverseProperty("Posts")] + [Required, ForeignKey("BlogId1, BlogId2"), InverseProperty("Posts")] public Blog Blog { get; set; } } @@ -2155,30 +2129,28 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class Context1 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog); + }); } public class Context2 : Context0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Posts) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey("BlogId1", "BlogId2") - .IsRequired(false); - }); + b.HasMany(e => e.Posts) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey("BlogId1", "BlogId2") + .IsRequired(false); + }); } public class Context3 : Context0 @@ -2236,8 +2208,7 @@ public class Post { public int Id { get; set; } - [InverseProperty("Posts")] - [ForeignKey("BlogId1, BlogId2")] + [InverseProperty("Posts"), ForeignKey("BlogId1, BlogId2")] public Blog Blog { get; set; } } @@ -2298,8 +2269,7 @@ public class Employee [ForeignKey("Manager")] public int? ManagerId { get; set; } - [InverseProperty("Reports")] - [ForeignKey("ManagerId")] + [InverseProperty("Reports"), ForeignKey("ManagerId")] public Employee Manager { get; set; } [InverseProperty("Manager")] @@ -2410,10 +2380,7 @@ public class Post [ForeignKey("Blog")] public int BlogId { get; set; } - [DeleteBehavior(DeleteBehavior.Restrict)] - [InverseProperty("Posts")] - [Required] - [ForeignKey("BlogId")] + [DeleteBehavior(DeleteBehavior.Restrict), InverseProperty("Posts"), Required, ForeignKey("BlogId")] public Blog Blog { get; set; } } diff --git a/test/EFCore.Specification.Tests/ModelBuilding101OneToOneNrtTestBase.cs b/test/EFCore.Specification.Tests/ModelBuilding101OneToOneNrtTestBase.cs index 12fc078ee6a..d2b3000e87a 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding101OneToOneNrtTestBase.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding101OneToOneNrtTestBase.cs @@ -77,13 +77,10 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } } @@ -154,8 +151,7 @@ public class BlogHeader [ForeignKey("Blog")] public int? BlogId { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] + [InverseProperty("Header"), ForeignKey("BlogId")] public Blog? Blog { get; set; } } @@ -258,9 +254,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("Id")] - [Required] + [InverseProperty("Header"), ForeignKey("Id"), Required] public Blog Blog { get; set; } = null!; } @@ -362,9 +356,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } @@ -466,8 +458,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] + [InverseProperty("Header"), ForeignKey("BlogId")] public Blog? Blog { get; set; } } @@ -768,12 +759,10 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [ForeignKey("BlogId")] - [Required] + [ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } @@ -936,8 +925,7 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("BlogId")] - [Required] + [ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } @@ -1342,13 +1330,10 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } @@ -1441,8 +1426,7 @@ public class BlogHeader [ForeignKey("Blog")] public int? BlogId { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] + [InverseProperty("Header"), ForeignKey("BlogId")] public Blog? Blog { get; set; } } @@ -1531,9 +1515,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } = null!; } @@ -1622,8 +1604,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] + [InverseProperty("Header"), ForeignKey("BlogId")] public Blog? Blog { get; set; } } @@ -1678,17 +1659,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class BlogContext1 : BlogContext0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - nestedBuilder => - { - nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(nestedBuilder => + { + nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); - nestedBuilder.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) - .IsRequired(); - }); + nestedBuilder.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) + .IsRequired(); + }); } public class BlogContext2 : BlogContext0 @@ -1756,9 +1736,7 @@ public class BlogHeader [Required] public int BlogId2 { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId1, BlogId2")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId1, BlogId2"), Required] public Blog Blog { get; set; } = null!; } @@ -1807,17 +1785,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class BlogContext1 : BlogContext0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) - .IsRequired(false); - }); + b.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) + .IsRequired(false); + }); } public class BlogContext2 : BlogContext0 @@ -1884,8 +1861,7 @@ public class BlogHeader public int? BlogId2 { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId1, BlogId2")] + [InverseProperty("Header"), ForeignKey("BlogId1, BlogId2")] public Blog? Blog { get; set; } } @@ -1925,31 +1901,29 @@ public DbSet BlogHeaders => Set(); protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }); - }); + b.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }); + }); } public class BlogContext1 : BlogContext0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey("BlogId1", "BlogId2") - .IsRequired(); - }); + b.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey("BlogId1", "BlogId2") + .IsRequired(); + }); } public class BlogContext2 : BlogContext0 @@ -2009,9 +1983,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId1, BlogId2")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId1, BlogId2"), Required] public Blog Blog { get; set; } = null!; } @@ -2051,31 +2023,29 @@ public DbSet BlogHeaders => Set(); protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }); - }); + b.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }); + }); } public class BlogContext1 : BlogContext0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey("BlogId1", "BlogId2") - .IsRequired(false); - }); + b.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey("BlogId1", "BlogId2") + .IsRequired(false); + }); } public class BlogContext2 : BlogContext0 @@ -2135,8 +2105,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId1, BlogId2")] + [InverseProperty("Header"), ForeignKey("BlogId1, BlogId2")] public Blog? Blog { get; set; } } @@ -2196,8 +2165,7 @@ public class Person [ForeignKey("Husband")] public int? HusbandId { get; set; } - [InverseProperty("Wife")] - [ForeignKey("HusbandId")] + [InverseProperty("Wife"), ForeignKey("HusbandId")] public Person? Husband { get; set; } [InverseProperty("Husband")] @@ -2303,14 +2271,10 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] - [Required] - [DeleteBehavior(DeleteBehavior.Restrict)] + [InverseProperty("Header"), ForeignKey("BlogId"), Required, DeleteBehavior(DeleteBehavior.Restrict)] public Blog Blog { get; set; } = null!; } diff --git a/test/EFCore.Specification.Tests/ModelBuilding101OneToOneTestBase.cs b/test/EFCore.Specification.Tests/ModelBuilding101OneToOneTestBase.cs index c4663b93dee..5e10b301fd1 100644 --- a/test/EFCore.Specification.Tests/ModelBuilding101OneToOneTestBase.cs +++ b/test/EFCore.Specification.Tests/ModelBuilding101OneToOneTestBase.cs @@ -79,13 +79,10 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } } } @@ -156,8 +153,7 @@ public class BlogHeader [ForeignKey("Blog")] public int? BlogId { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] + [InverseProperty("Header"), ForeignKey("BlogId")] public Blog Blog { get; set; } } @@ -236,8 +232,7 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("Id")] - [Required] + [ForeignKey("Id"), Required] public Blog Blog { get; set; } } @@ -262,9 +257,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("Id")] - [Required] + [InverseProperty("Header"), ForeignKey("Id"), Required] public Blog Blog { get; set; } } @@ -342,8 +335,7 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("BlogId")] - [Required] + [ForeignKey("BlogId"), Required] public Blog Blog { get; set; } } @@ -368,9 +360,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } } @@ -472,8 +462,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] + [InverseProperty("Header"), ForeignKey("BlogId")] public Blog Blog { get; set; } } @@ -774,12 +763,10 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [ForeignKey("BlogId")] - [Required] + [ForeignKey("BlogId"), Required] public Blog Blog { get; set; } } @@ -943,8 +930,7 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("BlogId")] - [Required] + [ForeignKey("BlogId"), Required] public Blog Blog { get; set; } } @@ -1349,13 +1335,10 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } } @@ -1448,8 +1431,7 @@ public class BlogHeader [ForeignKey("Blog")] public int? BlogId { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] + [InverseProperty("Header"), ForeignKey("BlogId")] public Blog Blog { get; set; } } @@ -1569,9 +1551,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId"), Required] public Blog Blog { get; set; } } @@ -1660,8 +1640,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] + [InverseProperty("Header"), ForeignKey("BlogId")] public Blog Blog { get; set; } } @@ -1716,17 +1695,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class BlogContext1 : BlogContext0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - nestedBuilder => - { - nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(nestedBuilder => + { + nestedBuilder.HasKey(e => new { e.Id1, e.Id2 }); - nestedBuilder.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) - .IsRequired(); - }); + nestedBuilder.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) + .IsRequired(); + }); } public class BlogContext2 : BlogContext0 @@ -1794,9 +1772,7 @@ public class BlogHeader [Required] public int BlogId2 { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId1, BlogId2")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId1, BlogId2"), Required] public Blog Blog { get; set; } } @@ -1845,17 +1821,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public class BlogContext1 : BlogContext0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) - .IsRequired(false); - }); + b.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey(e => new { e.BlogId1, e.BlogId2 }) + .IsRequired(false); + }); } public class BlogContext2 : BlogContext0 @@ -1922,8 +1897,7 @@ public class BlogHeader public int? BlogId2 { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId1, BlogId2")] + [InverseProperty("Header"), ForeignKey("BlogId1, BlogId2")] public Blog Blog { get; set; } } @@ -1963,32 +1937,30 @@ public DbSet BlogHeaders => Set(); protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .IsRequired(); - }); + b.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .IsRequired(); + }); } public class BlogContext1 : BlogContext0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey("BlogId1", "BlogId2") - .IsRequired(); - }); + b.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey("BlogId1", "BlogId2") + .IsRequired(); + }); } public class BlogContext2 : BlogContext0 @@ -2021,8 +1993,7 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("BlogId1, BlogId2")] - [Required] + [ForeignKey("BlogId1, BlogId2"), Required] public Blog Blog { get; set; } } @@ -2049,9 +2020,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId1, BlogId2")] - [Required] + [InverseProperty("Header"), ForeignKey("BlogId1, BlogId2"), Required] public Blog Blog { get; set; } } @@ -2091,31 +2060,29 @@ public DbSet BlogHeaders => Set(); protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }); - }); + b.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }); + }); } public class BlogContext1 : BlogContext0 { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); + => modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Header) - .WithOne(e => e.Blog) - .HasPrincipalKey(e => new { e.Id1, e.Id2 }) - .HasForeignKey("BlogId1", "BlogId2") - .IsRequired(false); - }); + b.HasOne(e => e.Header) + .WithOne(e => e.Blog) + .HasPrincipalKey(e => new { e.Id1, e.Id2 }) + .HasForeignKey("BlogId1", "BlogId2") + .IsRequired(false); + }); } public class BlogContext2 : BlogContext0 @@ -2175,8 +2142,7 @@ public class BlogHeader { public int Id { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId1, BlogId2")] + [InverseProperty("Header"), ForeignKey("BlogId1, BlogId2")] public Blog Blog { get; set; } } @@ -2236,8 +2202,7 @@ public class Person [ForeignKey("Husband")] public int? HusbandId { get; set; } - [InverseProperty("Wife")] - [ForeignKey("HusbandId")] + [InverseProperty("Wife"), ForeignKey("HusbandId")] public Person Husband { get; set; } [InverseProperty("Husband")] @@ -2343,14 +2308,10 @@ public class BlogHeader { public int Id { get; set; } - [ForeignKey("Blog")] - [Required] + [ForeignKey("Blog"), Required] public int BlogId { get; set; } - [InverseProperty("Header")] - [ForeignKey("BlogId")] - [Required] - [DeleteBehavior(DeleteBehavior.Restrict)] + [InverseProperty("Header"), ForeignKey("BlogId"), Required, DeleteBehavior(DeleteBehavior.Restrict)] public Blog Blog { get; set; } } diff --git a/test/EFCore.Specification.Tests/MonsterFixupTestBase.cs b/test/EFCore.Specification.Tests/MonsterFixupTestBase.cs index 590ec78737d..1aa13efdeac 100644 --- a/test/EFCore.Specification.Tests/MonsterFixupTestBase.cs +++ b/test/EFCore.Specification.Tests/MonsterFixupTestBase.cs @@ -750,141 +750,141 @@ protected void SimpleVerification() { using var context = CreateContext(); Assert.Equal( - new[] { "Eeky Bear", "Sheila Koalie", "Sue Pandy", "Tarquin Tiger" }, + ["Eeky Bear", "Sheila Koalie", "Sue Pandy", "Tarquin Tiger"], context.Customers.Select(c => c.Name).OrderBy(n => n)); Assert.Equal( - new[] { "Assorted Dog Treats", "Chocolate Donuts", "Mrs Koalie's Famous Waffles" }, + ["Assorted Dog Treats", "Chocolate Donuts", "Mrs Koalie's Famous Waffles"], context.Products.Select(c => c.Description).OrderBy(n => n)); Assert.Equal( - new[] { "Barcode 1 2 3 4", "Barcode 2 2 3 4", "Barcode 3 2 3 4" }, + ["Barcode 1 2 3 4", "Barcode 2 2 3 4", "Barcode 3 2 3 4"], context.Barcodes.Select(c => c.Text).OrderBy(n => n)); Assert.Equal( - new[] { "Barcode 1 2 3 4", "Barcode 2 2 3 4", "Barcode 3 2 3 4" }, + ["Barcode 1 2 3 4", "Barcode 2 2 3 4", "Barcode 3 2 3 4"], context.Barcodes.Select(c => c.Text).OrderBy(n => n)); Assert.Equal( - new[] { "Eeky Bear", "Trent" }, + ["Eeky Bear", "Trent"], context.BarcodeDetails.Select(c => c.RegisteredTo).OrderBy(n => n)); Assert.Equal( - new[] { "Treats not Donuts", "Wot no waffles?" }, + ["Treats not Donuts", "Wot no waffles?"], context.IncorrectScans.Select(c => c.Details).OrderBy(n => n)); Assert.Equal( - new[] { "Don't give coffee to Eeky!", "Really! Don't give coffee to Eeky!" }, + ["Don't give coffee to Eeky!", "Really! Don't give coffee to Eeky!"], context.Complaints.Select(c => c.Details).OrderBy(n => n)); Assert.Equal( - new[] { "Destroyed all coffee in Redmond area." }, + ["Destroyed all coffee in Redmond area."], context.Resolutions.Select(c => c.Details).OrderBy(n => n)); Assert.Equal( - new[] { "MrsBossyPants", "MrsKoalie73", "TheStripedMenace" }, + ["MrsBossyPants", "MrsKoalie73", "TheStripedMenace"], context.Logins.Select(c => c.Username).OrderBy(n => n)); Assert.Equal( - new[] { "Crumbs in the cupboard", "Donuts gone missing", "Pig prints on keyboard" }, + ["Crumbs in the cupboard", "Donuts gone missing", "Pig prints on keyboard"], context.SuspiciousActivities.Select(c => c.Activity).OrderBy(n => n)); Assert.Equal( - new[] { "1234", "2234" }, + ["1234", "2234"], context.RsaTokens.Select(c => c.Serial).OrderBy(n => n)); Assert.Equal( - new[] { "MrsBossyPants", "MrsKoalie73" }, + ["MrsBossyPants", "MrsKoalie73"], context.SmartCards.Select(c => c.Username).OrderBy(n => n)); Assert.Equal( - new[] { "Rent-A-Mole" }, + ["Rent-A-Mole"], context.PasswordResets.Select(c => c.TempPassword).OrderBy(n => n)); Assert.Equal( - new[] { "somePage1", "somePage2", "somePage3" }, + ["somePage1", "somePage2", "somePage3"], context.PageViews.Select(c => c.PageUrl).OrderBy(n => n)); Assert.Equal( - new[] { "MrsBossyPants", "MrsKoalie73" }, + ["MrsBossyPants", "MrsKoalie73"], context.LastLogins.Select(c => c.Username).OrderBy(n => n)); Assert.Equal( - new[] { "Fancy a cup of tea?", "I'll put the kettle on.", "Love one!" }, + ["Fancy a cup of tea?", "I'll put the kettle on.", "Love one!"], context.Messages.Select(c => c.Body).OrderBy(n => n)); Assert.Equal( - new[] { "MrsBossyPants", "MrsKoalie73", "TheStripedMenace" }, + ["MrsBossyPants", "MrsKoalie73", "TheStripedMenace"], context.Orders.Select(c => c.Username).OrderBy(n => n)); Assert.Equal( - new[] { "And donuts!", "But no coffee. :-(", "Must have tea!" }, + ["And donuts!", "But no coffee. :-(", "Must have tea!"], context.OrderNotes.Select(c => c.Note).OrderBy(n => n)); Assert.Equal( - new[] { "Eeky Bear", "Eeky Bear", "Eeky Bear" }, + ["Eeky Bear", "Eeky Bear", "Eeky Bear"], context.OrderQualityChecks.Select(c => c.CheckedBy).OrderBy(n => n)); Assert.Equal( - new[] { 1, 2, 3, 4, 5, 7 }, + [1, 2, 3, 4, 5, 7], context.OrderLines.Select(c => c.Quantity).OrderBy(n => n)); Assert.Equal( - new[] { "A Waffle Cart specialty!", "Eeky Bear's favorite!" }, + ["A Waffle Cart specialty!", "Eeky Bear's favorite!"], context.ProductDetails.Select(c => c.Details).OrderBy(n => n)); Assert.Equal( - new[] { "Better than Tarqies!", "Eeky says yes!", "Good with maple syrup." }, + ["Better than Tarqies!", "Eeky says yes!", "Good with maple syrup."], context.ProductReviews.Select(c => c.Review).OrderBy(n => n)); // See issue#16428 if (context.Database.ProviderName == "Microsoft.EntityFrameworkCore.Sqlite") { Assert.Equal( - new[] { "101", "103", "105" }, + ["101", "103", "105"], context.ProductPhotos.ToList().Select(c => c.Photo.First().ToString()).OrderBy(n => n)); } else { Assert.Equal( - new[] { "101", "103", "105" }, + ["101", "103", "105"], context.ProductPhotos.Select(c => c.Photo.First().ToString()).OrderBy(n => n)); } Assert.Equal( - new[] { "Waffle Style", "What does the waffle say?" }, + ["Waffle Style", "What does the waffle say?"], context.ProductWebFeatures.Select(c => c.Heading).OrderBy(n => n)); Assert.Equal( - new[] { "Ants By Boris", "Trading As Trent" }, + ["Ants By Boris", "Trading As Trent"], context.Suppliers.Select(c => c.Name).OrderBy(n => n)); Assert.Equal( - new[] { "201", "202" }, + ["201", "202"], context.SupplierLogos.ToList().SelectMany(c => c.Logo).Select(l => l.ToString()).OrderBy(n => n)); Assert.Equal( - new[] { "Orange fur?", "Seems a bit dodgy.", "Very expensive!" }, + ["Orange fur?", "Seems a bit dodgy.", "Very expensive!"], context.SupplierInformation.Select(c => c.Information).OrderBy(n => n)); Assert.Equal( - new[] { "Mrs Bossy Pants!", "Really likes tea." }, + ["Mrs Bossy Pants!", "Really likes tea."], context.CustomerInformation.Select(c => c.Information).OrderBy(n => n)); Assert.Equal( - new[] { "markash420", "unicorns420" }, + ["markash420", "unicorns420"], context.Computers.Select(c => c.Name).OrderBy(n => n)); Assert.Equal( - new[] { "It's a Dell!", "It's not a Dell!" }, + ["It's a Dell!", "It's not a Dell!"], context.ComputerDetails.Select(c => c.Specifications).OrderBy(n => n)); Assert.Equal( - new[] { "Eeky Bear", "Splash Bear" }, + ["Eeky Bear", "Splash Bear"], context.Drivers.Select(c => c.Name).OrderBy(n => n)); Assert.Equal( - new[] { "10", "11" }, + ["10", "11"], context.Licenses.Select(c => c.LicenseNumber).OrderBy(n => n)); } diff --git a/test/EFCore.Specification.Tests/MusicStoreTestBase.cs b/test/EFCore.Specification.Tests/MusicStoreTestBase.cs index 61a70c887e6..122b6f14efe 100644 --- a/test/EFCore.Specification.Tests/MusicStoreTestBase.cs +++ b/test/EFCore.Specification.Tests/MusicStoreTestBase.cs @@ -21,84 +21,79 @@ protected MusicStoreTestBase(TFixture fixture) public virtual async Task Browse_ReturnsViewWithGenre() { using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - const string genreName = "Genre 1"; - CreateTestGenres(numberOfGenres: 3, numberOfAlbums: 3, context: context); + const string genreName = "Genre 1"; + CreateTestGenres(numberOfGenres: 3, numberOfAlbums: 3, context: context); - var controller = new StoreController(context); + var controller = new StoreController(context); - var result = await controller.Browse(genreName); + var result = await controller.Browse(genreName); - Assert.Equal(genreName, result.Name); - Assert.NotNull(result.Albums); - Assert.Equal(3, result.Albums.Count); - } - }); + Assert.Equal(genreName, result.Name); + Assert.NotNull(result.Albums); + Assert.Equal(3, result.Albums.Count); + } + }); } [ConditionalFact] public virtual async Task Index_CreatesViewWithGenres() { using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - CreateTestGenres(numberOfGenres: 10, numberOfAlbums: 1, context: context); + CreateTestGenres(numberOfGenres: 10, numberOfAlbums: 1, context: context); - var controller = new StoreController(context); + var controller = new StoreController(context); - var result = await controller.Index(); + var result = await controller.Index(); - Assert.Equal(10, result.Count); - } - }); + Assert.Equal(10, result.Count); + } + }); } [ConditionalFact] public virtual async Task Details_ReturnsAlbumDetail() { using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var genres = CreateTestGenres(numberOfGenres: 3, numberOfAlbums: 3, context: context); - var albumId = genres.First().Albums[2].AlbumId; + var genres = CreateTestGenres(numberOfGenres: 3, numberOfAlbums: 3, context: context); + var albumId = genres.First().Albums[2].AlbumId; - var controller = new StoreController(context); + var controller = new StoreController(context); - var result = await controller.Details(albumId); + var result = await controller.Details(albumId); - Assert.NotNull(result.Genre); - var genre = genres.SingleOrDefault(g => g.GenreId == result.GenreId); - Assert.NotNull(genre); - Assert.NotNull(genre.Albums.SingleOrDefault(a => a.AlbumId == albumId)); - Assert.NotNull(result.Artist); - Assert.NotEqual(0, result.ArtistId); - } - }); + Assert.NotNull(result.Genre); + var genre = genres.SingleOrDefault(g => g.GenreId == result.GenreId); + Assert.NotNull(genre); + Assert.NotNull(genre.Albums.SingleOrDefault(a => a.AlbumId == albumId)); + Assert.NotNull(result.Artist); + Assert.NotEqual(0, result.ArtistId); + } + }); } private static Genre[] CreateTestGenres(int numberOfGenres, int numberOfAlbums, DbContext context) { var artist = new Artist { Name = "Artist1" }; - var genres = Enumerable.Range(1, numberOfGenres).Select( - g => - new Genre - { - Name = "Genre " + g, - Albums = Enumerable.Range(1, numberOfAlbums).Select( - n => - new Album { Artist = artist, Title = "Greatest Hits" }).ToList() - }).ToList(); + var genres = Enumerable.Range(1, numberOfGenres).Select(g => + new Genre + { + Name = "Genre " + g, + Albums = Enumerable.Range(1, numberOfAlbums).Select(n => + new Album { Artist = artist, Title = "Greatest Hits" }).ToList() + }).ToList(); context.AddRange(genres); context.SaveChanges(); @@ -110,49 +105,45 @@ private static Genre[] CreateTestGenres(int numberOfGenres, int numberOfAlbums, public virtual async Task Index_GetsSixTopAlbums() { using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var controller = new HomeController(); + var controller = new HomeController(); - var albums = TestAlbumDataProvider.GetAlbums(); + var albums = TestAlbumDataProvider.GetAlbums(); - foreach (var album in albums) - { - await context.AddAsync(album); - } + foreach (var album in albums) + { + await context.AddAsync(album); + } - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - var result = await controller.Index(context); + var result = await controller.Index(context); - Assert.Equal(6, result.Count); - } - }); + Assert.Equal(6, result.Count); + } + }); } private static class TestAlbumDataProvider { public static Album[] GetAlbums() { - var genres = Enumerable.Range(1, 10).Select( - n => - new Genre { Name = "Genre Name " + n }).ToArray(); + var genres = Enumerable.Range(1, 10).Select(n => + new Genre { Name = "Genre Name " + n }).ToArray(); - var artists = Enumerable.Range(1, 10).Select( - n => - new Artist { Name = "Artist Name " + n }).ToArray(); + var artists = Enumerable.Range(1, 10).Select(n => + new Artist { Name = "Artist Name " + n }).ToArray(); - var albums = Enumerable.Range(1, 10).Select( - n => - new Album - { - Artist = artists[n - 1], - Genre = genres[n - 1], - Title = "Greatest Hits" - }).ToArray(); + var albums = Enumerable.Range(1, 10).Select(n => + new Album + { + Artist = artists[n - 1], + Genre = genres[n - 1], + Title = "Greatest Hits" + }).ToArray(); return albums; } @@ -162,24 +153,22 @@ public static Album[] GetAlbums() public virtual async Task GenreMenuComponent_Returns_NineGenres() { using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var genreMenuComponent = new GenreMenuComponent(context); + var genreMenuComponent = new GenreMenuComponent(context); - var genres = Enumerable.Range(1, 10).Select( - n => new Genre { Name = $"G{n}" }); + var genres = Enumerable.Range(1, 10).Select(n => new Genre { Name = $"G{n}" }); - context.AddRange(genres); - context.SaveChanges(); + context.AddRange(genres); + context.SaveChanges(); - var result = await genreMenuComponent.InvokeAsync(); + var result = await genreMenuComponent.InvokeAsync(); - Assert.Equal(9, result.Count); - } - }); + Assert.Equal(9, result.Count); + } + }); } [ConditionalFact] @@ -192,23 +181,22 @@ public virtual async Task AddressAndPayment_RedirectToCompleteWhenSuccessful() var formCollection = new Dictionary { { "PromoCode", new[] { "FREE" } } }; using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var cartItems = CreateTestCartItems(cartId, itemPrice: 10, numberOfItems: 1); - context.AddRange(cartItems.Select(n => n.Album).Distinct()); - context.AddRange(cartItems); - context.SaveChanges(); + var cartItems = CreateTestCartItems(cartId, itemPrice: 10, numberOfItems: 1); + context.AddRange(cartItems.Select(n => n.Album).Distinct()); + context.AddRange(cartItems); + context.SaveChanges(); - var controller = new CheckoutController(formCollection); + var controller = new CheckoutController(formCollection); - var result = await controller.AddressAndPayment(context, cartId, order); + var result = await controller.AddressAndPayment(context, cartId, order); - Assert.Equal(order.OrderId, result); - } - }); + Assert.Equal(order.OrderId, result); + } + }); } [ConditionalFact] @@ -217,19 +205,18 @@ public virtual async Task AddressAndPayment_ReturnsOrderIfInvalidPromoCode() const string cartId = "CartId_A"; using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var controller = new CheckoutController(); - var order = CreateOrder(); + var controller = new CheckoutController(); + var order = CreateOrder(); - var result = await controller.AddressAndPayment(context, cartId, order); + var result = await controller.AddressAndPayment(context, cartId, order); - Assert.Null(result); - } - }); + Assert.Null(result); + } + }); } protected Order CreateOrder(string userName = "RainbowDash") @@ -251,39 +238,37 @@ protected Order CreateOrder(string userName = "RainbowDash") public virtual async Task Complete_ReturnsOrderIdIfValid() { using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var controller = new CheckoutController(); + var controller = new CheckoutController(); - var order = (await context.AddAsync(CreateOrder())).Entity; - await context.SaveChangesAsync(); + var order = (await context.AddAsync(CreateOrder())).Entity; + await context.SaveChangesAsync(); - var result = await controller.Complete(context, order.OrderId); + var result = await controller.Complete(context, order.OrderId); - Assert.Equal(order.OrderId, result); - } - }); + Assert.Equal(order.OrderId, result); + } + }); } [ConditionalFact] public virtual async Task Complete_ReturnsErrorIfInvalidOrder() { using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var controller = new CheckoutController(); + var controller = new CheckoutController(); - var result = await controller.Complete(context, -3333); + var result = await controller.Complete(context, -3333); - Assert.Equal("Error", result); - } - }); + Assert.Equal("Error", result); + } + }); } [ConditionalFact] @@ -294,74 +279,71 @@ public virtual async Task CartSummaryComponent_returns_items() const int itemCount = 10; using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) + var album = new Album { - var album = new Album + Title = albumTitle, + Artist = new Artist { Name = "Kung Fu Kenny" }, + Genre = new Genre { Name = "Rap" } + }; + + var cartItems = Enumerable.Range(1, itemCount).Select(n => + new CartItem { - Title = albumTitle, - Artist = new Artist { Name = "Kung Fu Kenny" }, - Genre = new Genre { Name = "Rap" } - }; - - var cartItems = Enumerable.Range(1, itemCount).Select( - n => - new CartItem - { - Album = album, - Count = 1, - CartId = cartId - }).ToArray(); - - context.AddRange(cartItems); - context.SaveChanges(); - - var result = await new CartSummaryComponent(context, cartId).InvokeAsync(); - - Assert.Equal(itemCount, result.CartCount); - Assert.Equal(albumTitle, result.CartSummary); - } - }); + Album = album, + Count = 1, + CartId = cartId + }).ToArray(); + + context.AddRange(cartItems); + context.SaveChanges(); + + var result = await new CartSummaryComponent(context, cartId).InvokeAsync(); + + Assert.Equal(itemCount, result.CartCount); + Assert.Equal(albumTitle, result.CartSummary); + } + }); } [ConditionalFact] public virtual async Task Music_store_project_to_mapped_entity() { using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var albums = CreateTestAlbums( - 10, - new Artist { Name = "Kung Fu Kenny" }, new Genre { Name = "Rap" }); - - context.Albums.AddRange(albums); - await context.SaveChangesAsync(); - - var q = from album in context.Albums - join genre in context.Genres on album.GenreId equals genre.GenreId - join artist in context.Artists on album.ArtistId equals artist.ArtistId - select new Album - { - ArtistId = album.ArtistId, - AlbumArtUrl = album.AlbumArtUrl, - AlbumId = album.AlbumId, - GenreId = album.GenreId, - Price = album.Price, - Title = album.Title, - Artist = new Artist { ArtistId = album.ArtistId, Name = artist.Name }, - Genre = new Genre { GenreId = album.GenreId, Name = genre.Name } - }; - - var foundAlbums = q.ToList(); - - Assert.Equal(10, foundAlbums.Count); - } - }); + var albums = CreateTestAlbums( + 10, + new Artist { Name = "Kung Fu Kenny" }, new Genre { Name = "Rap" }); + + context.Albums.AddRange(albums); + await context.SaveChangesAsync(); + + var q = from album in context.Albums + join genre in context.Genres on album.GenreId equals genre.GenreId + join artist in context.Artists on album.ArtistId equals artist.ArtistId + select new Album + { + ArtistId = album.ArtistId, + AlbumArtUrl = album.AlbumArtUrl, + AlbumId = album.AlbumId, + GenreId = album.GenreId, + Price = album.Price, + Title = album.Title, + Artist = new Artist { ArtistId = album.ArtistId, Name = artist.Name }, + Genre = new Genre { GenreId = album.GenreId, Name = genre.Name } + }; + + var foundAlbums = q.ToList(); + + Assert.Equal(10, foundAlbums.Count); + } + }); } [ConditionalFact] @@ -372,49 +354,45 @@ public virtual async Task RemoveFromCart_removes_items_from_cart() const int unitPrice = 10; using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var cartItems = CreateTestCartItems(cartId, unitPrice, numberOfItems); - context.AddRange(cartItems.Select(n => n.Album).Distinct()); - context.AddRange(cartItems); - context.SaveChanges(); + var cartItems = CreateTestCartItems(cartId, unitPrice, numberOfItems); + context.AddRange(cartItems.Select(n => n.Album).Distinct()); + context.AddRange(cartItems); + context.SaveChanges(); - var controller = new ShoppingCartController(context, cartId); + var controller = new ShoppingCartController(context, cartId); - var cartItemId = cartItems[2].CartItemId; - var viewModel = await controller.RemoveFromCart(cartItemId); + var cartItemId = cartItems[2].CartItemId; + var viewModel = await controller.RemoveFromCart(cartItemId); - Assert.Equal(numberOfItems - 1, viewModel.CartCount); - Assert.Equal((numberOfItems - 1) * 10, viewModel.CartTotal); - Assert.Equal("Greatest Hits has been removed from your shopping cart.", viewModel.Message); + Assert.Equal(numberOfItems - 1, viewModel.CartCount); + Assert.Equal((numberOfItems - 1) * 10, viewModel.CartTotal); + Assert.Equal("Greatest Hits has been removed from your shopping cart.", viewModel.Message); - var cart = ShoppingCart.GetCart(context, cartId); - Assert.DoesNotContain((await cart.GetCartItems()), c => c.CartItemId == cartItemId); - } - }); + var cart = ShoppingCart.GetCart(context, cartId); + Assert.DoesNotContain((await cart.GetCartItems()), c => c.CartItemId == cartItemId); + } + }); } - [ConditionalTheory] - [InlineData(null)] - [InlineData("CartId_A")] + [ConditionalTheory, InlineData(null), InlineData("CartId_A")] public virtual async Task Cart_is_empty_when_no_items_have_been_added(string cartId) { using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var controller = new ShoppingCartController(context, cartId); - var viewModel = await controller.Index(); + var controller = new ShoppingCartController(context, cartId); + var viewModel = await controller.Index(); - Assert.Empty(viewModel.CartItems); - Assert.Equal(0, viewModel.CartTotal); - } - }); + Assert.Empty(viewModel.CartItems); + Assert.Equal(0, viewModel.CartTotal); + } + }); } [ConditionalFact] @@ -423,27 +401,26 @@ public virtual async Task Cart_has_items_once_they_have_been_added() const string cartId = "CartId_A"; using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var cartItems = CreateTestCartItems( - cartId, - itemPrice: 10, - numberOfItems: 5); + var cartItems = CreateTestCartItems( + cartId, + itemPrice: 10, + numberOfItems: 5); - context.AddRange(cartItems.Select(n => n.Album).Distinct()); - context.AddRange(cartItems); - context.SaveChanges(); + context.AddRange(cartItems.Select(n => n.Album).Distinct()); + context.AddRange(cartItems); + context.SaveChanges(); - var controller = new ShoppingCartController(context, cartId); - var viewModel = await controller.Index(); + var controller = new ShoppingCartController(context, cartId); + var viewModel = await controller.Index(); - Assert.Equal(5, viewModel.CartItems.Count); - Assert.Equal(5 * 10, viewModel.CartTotal); - } - }); + Assert.Equal(5, viewModel.CartItems.Count); + Assert.Equal(5 * 10, viewModel.CartTotal); + } + }); } [ConditionalFact] @@ -452,46 +429,42 @@ public virtual async Task Can_add_items_to_cart() const string cartId = "CartId_A"; using var context = CreateContext(); - await context.Database.CreateExecutionStrategy().ExecuteAsync( - async () => + await context.Database.CreateExecutionStrategy().ExecuteAsync(async () => + { + using (Fixture.BeginTransaction(context)) { - using (Fixture.BeginTransaction(context)) - { - var albums = CreateTestAlbums( - 10, - new Artist { Name = "Kung Fu Kenny" }, new Genre { Name = "Rap" }); + var albums = CreateTestAlbums( + 10, + new Artist { Name = "Kung Fu Kenny" }, new Genre { Name = "Rap" }); - context.AddRange(albums); - context.SaveChanges(); + context.AddRange(albums); + context.SaveChanges(); - var controller = new ShoppingCartController(context, cartId); - var albumId = albums[2].AlbumId; - await controller.AddToCart(albumId); + var controller = new ShoppingCartController(context, cartId); + var albumId = albums[2].AlbumId; + await controller.AddToCart(albumId); - var cart = ShoppingCart.GetCart(context, cartId); - Assert.Single(await cart.GetCartItems()); - Assert.Equal(albumId, (await cart.GetCartItems()).Single().AlbumId); - } - }); + var cart = ShoppingCart.GetCart(context, cartId); + Assert.Single(await cart.GetCartItems()); + Assert.Equal(albumId, (await cart.GetCartItems()).Single().AlbumId); + } + }); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Custom_projection_FirstOrDefault_works(bool async) { using var context = CreateContext(); var shoppingCartId = "CartId_A"; var id = 1; var query = context.CartItems - .Select( - ci => new CartItem - { - CartId = ci.CartId, - CartItemId = ci.CartItemId, - Count = ci.Count, - Album = new Album { Title = ci.Album.Title } - }); + .Select(ci => new CartItem + { + CartId = ci.CartId, + CartItemId = ci.CartItemId, + Count = ci.Count, + Album = new Album { Title = ci.Album.Title } + }); var cartItem = async ? await query.FirstOrDefaultAsync(ci => ci.CartId == shoppingCartId && ci.CartItemId == id) @@ -506,27 +479,25 @@ private static CartItem[] CreateTestCartItems(string cartId, decimal itemPrice, itemPrice, new Artist { Name = "Kung Fu Kenny" }, new Genre { Name = "Rap" }); - var cartItems = Enumerable.Range(1, numberOfItems).Select( - n => new CartItem - { - Count = 1, - CartId = cartId, - Album = albums[n % albums.Length] - }).ToArray(); + var cartItems = Enumerable.Range(1, numberOfItems).Select(n => new CartItem + { + Count = 1, + CartId = cartId, + Album = albums[n % albums.Length] + }).ToArray(); return cartItems; } private static Album[] CreateTestAlbums(decimal itemPrice, Artist artist, Genre genre) - => Enumerable.Range(1, 10).Select( - n => - new Album - { - Title = "Greatest Hits", - Price = itemPrice, - Artist = artist, - Genre = genre - }).ToArray(); + => Enumerable.Range(1, 10).Select(n => + new Album + { + Title = "Greatest Hits", + Price = itemPrice, + Artist = artist, + Genre = genre + }).ToArray(); protected class CartSummaryComponent(MusicStoreContext context, string cartId) { @@ -654,8 +625,7 @@ public async Task Complete(MusicStoreContext context, int id) { var userName = "RainbowDash"; - var isValid = await context.Orders.AnyAsync( - o => o.OrderId == id && o.Username == userName); + var isValid = await context.Orders.AnyAsync(o => o.OrderId == id && o.Username == userName); if (isValid) { diff --git a/test/EFCore.Specification.Tests/NonSharedModelTestBase.cs b/test/EFCore.Specification.Tests/NonSharedModelTestBase.cs index def5acf6edb..d9ca0df2f8e 100644 --- a/test/EFCore.Specification.Tests/NonSharedModelTestBase.cs +++ b/test/EFCore.Specification.Tests/NonSharedModelTestBase.cs @@ -15,23 +15,27 @@ public abstract class NonSharedModelTestBase : IAsyncLifetime protected virtual ITestOutputHelper? TestOutputHelper { get; set; } private ServiceProvider? _serviceProvider; + protected IServiceProvider ServiceProvider => _serviceProvider ?? throw new InvalidOperationException( $"You must call `await {nameof(InitializeAsync)}(\"DatabaseName\");` at the beginning of the test."); private TestStore? _testStore; + protected TestStore TestStore => _testStore ?? throw new InvalidOperationException( $"You must call `await {nameof(InitializeAsync)}(\"DatabaseName\");` at the beginning of the test."); private ListLoggerFactory? _listLoggerFactory; + protected ListLoggerFactory ListLoggerFactory => _listLoggerFactory ??= (ListLoggerFactory)ServiceProvider.GetRequiredService(); protected NonSharedModelTestBase() - { } + { + } protected NonSharedModelTestBase(NonSharedFixture fixture) => Fixture = fixture; @@ -150,14 +154,13 @@ protected virtual IServiceCollection AddServices(IServiceCollection serviceColle protected virtual DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) => builder .EnableSensitiveDataLogging() - .ConfigureWarnings( - b => b.Default(WarningBehavior.Throw) - .Log(CoreEventId.SensitiveDataLoggingEnabledWarning) - .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning) - .Ignore( - CoreEventId.MappedEntityTypeIgnoredWarning, - CoreEventId.MappedPropertyIgnoredWarning, - CoreEventId.MappedNavigationIgnoredWarning)); + .ConfigureWarnings(b => b.Default(WarningBehavior.Throw) + .Log(CoreEventId.SensitiveDataLoggingEnabledWarning) + .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning) + .Ignore( + CoreEventId.MappedEntityTypeIgnoredWarning, + CoreEventId.MappedPropertyIgnoredWarning, + CoreEventId.MappedNavigationIgnoredWarning)); protected virtual TestStore CreateTestStore() => TestStoreFactory.Create(StoreName); diff --git a/test/EFCore.Specification.Tests/OptimisticConcurrencyTestBase.cs b/test/EFCore.Specification.Tests/OptimisticConcurrencyTestBase.cs index bf4c276d798..200a84b2788 100644 --- a/test/EFCore.Specification.Tests/OptimisticConcurrencyTestBase.cs +++ b/test/EFCore.Specification.Tests/OptimisticConcurrencyTestBase.cs @@ -145,9 +145,8 @@ public virtual Task Two_concurrency_issues_in_one_to_one_related_entities_can_be catch (DbUpdateConcurrencyException ex2) { Assert.Equal( - LogLevel.Debug, Fixture.ListLoggerFactory.Log.Single( - l => - l.Id == CoreEventId.OptimisticConcurrencyException).Level); + LogLevel.Debug, Fixture.ListLoggerFactory.Log.Single(l => + l.Id == CoreEventId.OptimisticConcurrencyException).Level); var entry2 = ex2.Entries.Single(); Assert.IsAssignableFrom(entry2.Entity); @@ -192,9 +191,8 @@ public virtual Task Two_concurrency_issues_in_one_to_many_related_entities_can_b catch (DbUpdateConcurrencyException ex2) { Assert.Equal( - LogLevel.Debug, Fixture.ListLoggerFactory.Log.Single( - l => - l.Id == CoreEventId.OptimisticConcurrencyException).Level); + LogLevel.Debug, Fixture.ListLoggerFactory.Log.Single(l => + l.Id == CoreEventId.OptimisticConcurrencyException).Level); var entry2 = ex2.Entries.Single(); Assert.IsAssignableFrom(entry2.Entity); @@ -427,9 +425,7 @@ public virtual Task #region Tests for calling Reload on an entity in various states - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_an_Added_entity_that_is_not_in_database_is_no_op(bool async) { using var c = CreateF1Context(); @@ -455,27 +451,19 @@ await c.Database.CreateExecutionStrategy().ExecuteAsync( }); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_an_Unchanged_entity_that_is_not_in_database_detaches_it(bool async) => await TestReloadGone(EntityState.Unchanged, async); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_a_Modified_entity_that_is_not_in_database_detaches_it(bool async) => await TestReloadGone(EntityState.Modified, async); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_a_Deleted_entity_that_is_not_in_database_detaches_it(bool async) => await TestReloadGone(EntityState.Deleted, async); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_a_Detached_entity_that_is_not_in_database_detaches_it(bool async) => await TestReloadGone(EntityState.Detached, async); @@ -511,33 +499,23 @@ await c.Database.CreateExecutionStrategy().ExecuteAsync( }); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_an_Unchanged_entity_makes_the_entity_unchanged(bool async) => await TestReloadPositive(EntityState.Unchanged, async); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_a_Modified_entity_makes_the_entity_unchanged(bool async) => await TestReloadPositive(EntityState.Modified, async); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_a_Deleted_entity_makes_the_entity_unchanged(bool async) => await TestReloadPositive(EntityState.Deleted, async); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_an_Added_entity_that_was_saved_elsewhere_makes_the_entity_unchanged(bool async) => await TestReloadPositive(EntityState.Added, async); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_a_Detached_entity_makes_the_entity_unchanged(bool async) => await TestReloadPositive(EntityState.Detached, async); @@ -574,9 +552,7 @@ await c.Database.CreateExecutionStrategy().ExecuteAsync( }); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_GetDatabaseValues_on_owned_entity_works(bool async) { using var c = CreateF1Context(); @@ -606,9 +582,7 @@ await c.Database.CreateExecutionStrategy().ExecuteAsync( }); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Calling_Reload_on_owned_entity_works(bool async) { using var c = CreateF1Context(); @@ -728,8 +702,8 @@ await c.Database.CreateExecutionStrategy().ExecuteAsync( if (typeof(TException) == typeof(DbUpdateConcurrencyException)) { Assert.Equal( - LogLevel.Debug, Fixture.ListLoggerFactory.Log.Single( - l => l.Id == CoreEventId.OptimisticConcurrencyException).Level); + LogLevel.Debug, + Fixture.ListLoggerFactory.Log.Single(l => l.Id == CoreEventId.OptimisticConcurrencyException).Level); } Fixture.ListLoggerFactory.Clear(); diff --git a/test/EFCore.Specification.Tests/OverzealousInitializationTestBase.cs b/test/EFCore.Specification.Tests/OverzealousInitializationTestBase.cs index fa0a9fc57c6..0d3d0d435c3 100644 --- a/test/EFCore.Specification.Tests/OverzealousInitializationTestBase.cs +++ b/test/EFCore.Specification.Tests/OverzealousInitializationTestBase.cs @@ -33,7 +33,7 @@ public virtual void Fixup_ignores_eagerly_initialized_reference_navs() private static readonly Artist[] _artists = [ - new Artist { Id = 1, Name = "Freddie" }, new Artist { Id = 2, Name = "Kendrick" }, new Artist { Id = 3, Name = "Jarvis" } + new() { Id = 1, Name = "Freddie" }, new() { Id = 2, Name = "Kendrick" }, new() { Id = 3, Name = "Jarvis" } ]; protected class Album diff --git a/test/EFCore.Specification.Tests/PropertyValuesTestBase.cs b/test/EFCore.Specification.Tests/PropertyValuesTestBase.cs index 5713a191631..d62eb9c59fc 100644 --- a/test/EFCore.Specification.Tests/PropertyValuesTestBase.cs +++ b/test/EFCore.Specification.Tests/PropertyValuesTestBase.cs @@ -1041,7 +1041,7 @@ public virtual void Using_complex_property_value_not_list_throws() // Complex collection query support. Issue #31411 var school = CreateSchool(); context.Set().Attach(school); - + var entry = context.Entry(school); var schoolValues = entry.CurrentValues; @@ -1260,17 +1260,10 @@ private async Task TestPropertyValuesPositiveForState( Assert.Equal("Building One Optimal", values["Name"]); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Added, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public async Task Values_can_be_reloaded_from_database_for_entity_in_any_state(EntityState state, bool async) { using var context = CreateContext(); @@ -1298,17 +1291,10 @@ public async Task Values_can_be_reloaded_from_database_for_entity_in_any_state(E Assert.Equal(EntityState.Unchanged, entry.State); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Added, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public async Task Reload_when_entity_deleted_in_store_can_happen_for_any_state(EntityState state, bool async) { using var context = CreateContext(); @@ -1359,17 +1345,10 @@ public async Task Reload_when_entity_deleted_in_store_can_happen_for_any_state(E Assert.Contains(office, building.Offices); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, true)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] - [InlineData(EntityState.Detached, true)] - [InlineData(EntityState.Detached, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Added, true), + InlineData(EntityState.Added, false), InlineData(EntityState.Deleted, true), InlineData(EntityState.Deleted, false), + InlineData(EntityState.Detached, true), InlineData(EntityState.Detached, false)] public virtual async Task Values_can_be_reloaded_from_database_for_entity_in_any_state_with_inheritance(EntityState state, bool async) { using var context = CreateContext(); @@ -1798,10 +1777,7 @@ private void TestKeyChange(Func, PropertyValues> getProper Assert.Throws(() => values["BuildingId"] = new Guid()).Message); } - [ConditionalTheory] - [InlineData(CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Never)] public virtual void Non_nullable_property_in_current_values_results_in_conceptual_null(CascadeTiming deleteOrphansTiming) { using var context = CreateContext(); @@ -1843,10 +1819,7 @@ public virtual void Non_nullable_property_in_current_values_results_in_conceptua } } - [ConditionalTheory] - [InlineData(CascadeTiming.Immediate)] - [InlineData(CascadeTiming.OnSaveChanges)] - [InlineData(CascadeTiming.Never)] + [ConditionalTheory, InlineData(CascadeTiming.Immediate), InlineData(CascadeTiming.OnSaveChanges), InlineData(CascadeTiming.Never)] public virtual void Non_nullable_shadow_property_in_current_values_results_in_conceptual_null(CascadeTiming deleteOrphansTiming) { using var context = CreateContext(); @@ -2124,8 +2097,8 @@ private async Task GetDatabaseValues_for_entity_not_in_the_store_returns_null_im [ConditionalFact] public virtual Task NonGeneric_GetDatabaseValues_for_entity_not_in_the_store_returns_null() - => NonGeneric_GetDatabaseValues_for_entity_not_in_the_store_returns_null_implementation( - e => Task.FromResult(e.GetDatabaseValues()!)); + => NonGeneric_GetDatabaseValues_for_entity_not_in_the_store_returns_null_implementation(e + => Task.FromResult(e.GetDatabaseValues()!)); [ConditionalFact] public virtual Task NonGeneric_GetDatabaseValuesAsync_for_entity_not_in_the_store_returns_null() @@ -2151,8 +2124,7 @@ private async Task NonGeneric_GetDatabaseValues_for_entity_not_in_the_store_retu [ConditionalFact] public virtual Task GetDatabaseValues_for_derived_entity_not_in_the_store_returns_null() - => GetDatabaseValues_for_derived_entity_not_in_the_store_returns_null_implementation( - e => Task.FromResult(e.GetDatabaseValues()!)); + => GetDatabaseValues_for_derived_entity_not_in_the_store_returns_null_implementation(e => Task.FromResult(e.GetDatabaseValues()!)); [ConditionalFact] public virtual Task GetDatabaseValuesAsync_for_derived_entity_not_in_the_store_returns_null() @@ -2177,13 +2149,12 @@ private async Task GetDatabaseValues_for_derived_entity_not_in_the_store_returns [ConditionalFact] public virtual Task NonGeneric_GetDatabaseValues_for_derived_entity_not_in_the_store_returns_null() - => NonGeneric_GetDatabaseValues_for_derived_entity_not_in_the_store_returns_null_implementation( - e => Task.FromResult(e.GetDatabaseValues()!)); + => NonGeneric_GetDatabaseValues_for_derived_entity_not_in_the_store_returns_null_implementation(e + => Task.FromResult(e.GetDatabaseValues()!)); [ConditionalFact] public virtual Task NonGeneric_GetDatabaseValuesAsync_for_derived_entity_not_in_the_store_returns_null() - => NonGeneric_GetDatabaseValues_for_derived_entity_not_in_the_store_returns_null_implementation( - e => e.GetDatabaseValuesAsync()!); + => NonGeneric_GetDatabaseValues_for_derived_entity_not_in_the_store_returns_null_implementation(e => e.GetDatabaseValuesAsync()!); private async Task NonGeneric_GetDatabaseValues_for_derived_entity_not_in_the_store_returns_null_implementation( Func> getPropertyValues) @@ -2204,8 +2175,7 @@ private async Task NonGeneric_GetDatabaseValues_for_derived_entity_not_in_the_st [ConditionalFact] public virtual Task GetDatabaseValues_for_the_wrong_type_in_the_store_returns_null() - => GetDatabaseValues_for_the_wrong_type_in_the_store_returns_null_implementation( - e => Task.FromResult(e.GetDatabaseValues()!)); + => GetDatabaseValues_for_the_wrong_type_in_the_store_returns_null_implementation(e => Task.FromResult(e.GetDatabaseValues()!)); [ConditionalFact] public virtual Task GetDatabaseValuesAsync_for_the_wrong_type_in_the_store_returns_null() @@ -2237,8 +2207,7 @@ private async Task GetDatabaseValues_for_the_wrong_type_in_the_store_returns_nul [ConditionalFact] public virtual Task NonGeneric_GetDatabaseValues_for_the_wrong_type_in_the_store_throws() - => NonGeneric_GetDatabaseValues_for_the_wrong_type_in_the_store_throws_implementation( - e => Task.FromResult(e.GetDatabaseValues()!)); + => NonGeneric_GetDatabaseValues_for_the_wrong_type_in_the_store_throws_implementation(e => Task.FromResult(e.GetDatabaseValues()!)); [ConditionalFact] public virtual Task NonGeneric_GetDatabaseValuesAsync_for_the_wrong_type_in_the_store_throws() @@ -2270,8 +2239,7 @@ private async Task NonGeneric_GetDatabaseValues_for_the_wrong_type_in_the_store_ [ConditionalFact] public Task Store_values_really_are_store_values_not_current_or_original_values() - => Store_values_really_are_store_values_not_current_or_original_values_implementation( - e => Task.FromResult(e.GetDatabaseValues()!)); + => Store_values_really_are_store_values_not_current_or_original_values_implementation(e => Task.FromResult(e.GetDatabaseValues()!)); [ConditionalFact] public Task Store_values_really_are_store_values_not_current_or_original_values_async() @@ -2346,16 +2314,17 @@ private async Task TestComplexCollectionPropertyValues( var originalFirstDepartmentCourses = school.Departments.First().Courses.ToList(); school.Departments.Clear(); - school.Departments.Add(new Department - { - Name = "Modified Department", - Building = "Modified Building", - Courses = - [ - new Course { Name = "Modified Course 1", Credits = 4 }, - new Course { Name = "Modified Course 2", Credits = 5 } - ] - }); + school.Departments.Add( + new Department + { + Name = "Modified Department", + Building = "Modified Building", + Courses = + [ + new Course { Name = "Modified Course 1", Credits = 4 }, + new Course { Name = "Modified Course 2", Credits = 5 } + ] + }); var entry = context.Entry(school); var values = await getPropertyValues(entry); @@ -2380,7 +2349,6 @@ private async Task TestComplexCollectionPropertyValues( Assert.Equal("Computer Science", dept1Object.Name); Assert.Equal("Building A", dept1Object.Building); - var department1Courses = dept1.Courses; Assert.Equal(2, department1Courses.Count); @@ -2694,18 +2662,14 @@ public virtual void Setting_complex_collection_current_values_from_dictionary_wo ["Building"] = "Dict Building 1", ["Courses"] = new List> { - new() { ["Name"] = "Dict Course 1", ["Credits"] = 5 }, - new() { ["Name"] = "Dict Course 2", ["Credits"] = 6 } + new() { ["Name"] = "Dict Course 1", ["Credits"] = 5 }, new() { ["Name"] = "Dict Course 2", ["Credits"] = 6 } } }, new() { ["Name"] = "Dict Department 2", ["Building"] = "Dict Building 2", - ["Courses"] = new List> - { - new() { ["Name"] = "Dict Course 3", ["Credits"] = 7 } - } + ["Courses"] = new List> { new() { ["Name"] = "Dict Course 3", ["Credits"] = 7 } } } } }; @@ -2774,20 +2738,17 @@ public virtual void Setting_complex_collection_values_from_DTO_with_nulls_works( { Id = school.Id, Name = "DTO School", - Departments = new List - { + Departments = + [ new() { Name = "DTO Department", Building = "DTO Building", - Courses = new List - { - null, - new() { Name = "DTO Course", Credits = 8 } - } + Courses = [null, new() { Name = "DTO Course", Credits = 8 }] }, + null - } + ] }; var entry = context.Entry(school); @@ -2949,10 +2910,9 @@ public virtual void Setting_complex_collection_original_values_from_dictionary_w ["Name"] = "Original Dict Department", ["Building"] = "Original Dict Building", ["Courses"] = new List?> - { - null, - new() { ["Name"] = "Original Dict Course", ["Credits"] = 2 } - } + { + null, new() { ["Name"] = "Original Dict Course", ["Credits"] = 2 } + } }, null } @@ -3028,30 +2988,28 @@ public virtual void Setting_complex_collection_current_values_from_DTO_with_comp { Id = school.Id, Name = "Advanced DTO School", - Departments = new List - { + Departments = + [ new() { Name = "Advanced DTO Department 1", Building = "Advanced DTO Building 1", - Courses = new List - { + Courses = + [ new() { Name = "Advanced DTO Course 1", Credits = 10 }, null, new() { Name = "Advanced DTO Course 2", Credits = 12 } - } + ] }, + null, new() { Name = "Advanced DTO Department 2", Building = "Advanced DTO Building 2", - Courses = new List - { - new() { Name = "Advanced DTO Course 3", Credits = 15 } - } + Courses = [new() { Name = "Advanced DTO Course 3", Credits = 15 }] } - } + ] }; var entry = context.Entry(school); @@ -3120,11 +3078,7 @@ public virtual void SetValues_throws_for_complex_collection_with_non_list_value( var school = CreateSchool(); context.Set().Attach(school); - var dictionary = new Dictionary - { - ["Name"] = "Test School", - ["Departments"] = "Not a list" - }; + var dictionary = new Dictionary { ["Name"] = "Test School", ["Departments"] = "Not a list" }; var entry = context.Entry(school); var exception = Assert.Throws(() => entry.OriginalValues.SetValues(dictionary)); @@ -3140,8 +3094,7 @@ public virtual void SetValues_throws_for_complex_collection_with_non_dictionary_ var dictionary = new Dictionary { - ["Name"] = "Test School", - ["Departments"] = new List { "Not a dictionary", null } + ["Name"] = "Test School", ["Departments"] = new List { "Not a dictionary", null } }; var entry = context.Entry(school); @@ -3207,11 +3160,7 @@ public virtual void SetValues_throws_for_complex_property_with_non_dictionary_va using var context = CreateContext(); var building = context.Set().Single(b => b.Name == "Building One"); - var dictionary = new Dictionary - { - ["Name"] = "Building", - ["Culture"] = "Not a dictionary" - }; + var dictionary = new Dictionary { ["Name"] = "Building", ["Culture"] = "Not a dictionary" }; var entry = context.Entry(building); var exception = Assert.Throws(() => entry.OriginalValues.SetValues(dictionary)); @@ -3810,6 +3759,7 @@ protected class PastEmployee : Employee { public DateTime TerminationDate { get; set; } } + protected class SchoolDto { public int Id { get; set; } @@ -3859,11 +3809,12 @@ protected DbContext CreateContext() return context; } - private static School CreateSchool() => new School - { - Id = 1, - Name = "Test School", - Departments = + private static School CreateSchool() + => new() + { + Id = 1, + Name = "Test School", + Departments = [ new Department { @@ -3886,7 +3837,7 @@ protected DbContext CreateContext() ] } ] - }; + }; public abstract class PropertyValuesFixtureBase : SharedStoreFixtureBase { @@ -3898,31 +3849,29 @@ protected override IServiceCollection AddServices(IServiceCollection serviceColl protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - b => - { - b.Property(e => e.EmployeeId).ValueGeneratedNever(); - b.Property("Shadow1"); - b.Property("Shadow2"); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.EmployeeId).ValueGeneratedNever(); + b.Property("Shadow1"); + b.Property("Shadow2"); + }); - modelBuilder.Entity( - b => - { - b.Property("Shadow3"); - - b.HasMany(p => p.VirtualTeams) - .WithMany(p => p.Employees) - .UsingEntity>( - "VirtualTeamEmployee", - j => j - .HasOne() - .WithMany(), - j => j - .HasOne() - .WithMany(), - j => j.IndexerProperty("Payload")); - }); + modelBuilder.Entity(b => + { + b.Property("Shadow3"); + + b.HasMany(p => p.VirtualTeams) + .WithMany(p => p.Employees) + .UsingEntity>( + "VirtualTeamEmployee", + j => j + .HasOne() + .WithMany(), + j => j + .HasOne() + .WithMany(), + j => j.IndexerProperty("Payload")); + }); modelBuilder.Entity(b => b.Property("Shadow4")); @@ -3936,35 +3885,31 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .WithMany(nameof(Building.MailRooms)) .HasForeignKey(m => m.BuildingId); - modelBuilder.Entity().HasKey( - o => new { o.Number, o.BuildingId }); + modelBuilder.Entity().HasKey(o => new { o.Number, o.BuildingId }); modelBuilder.Ignore(); - modelBuilder.Entity( - b => - { - b.HasKey(d => d.BuildingId); - b.HasOne(d => d.Building).WithOne().HasPrincipalKey(e => e.BuildingId); - }); + modelBuilder.Entity(b => + { + b.HasKey(d => d.BuildingId); + b.HasOne(d => d.Building).WithOne().HasPrincipalKey(e => e.BuildingId); + }); - modelBuilder.Entity( - b => - { - b.Ignore(e => e.NotInModel); - b.Property("Shadow1"); - b.Property("Shadow2"); + modelBuilder.Entity(b => + { + b.Ignore(e => e.NotInModel); + b.Property("Shadow1"); + b.Property("Shadow2"); - b.ComplexProperty(e => e.Culture); - b.ComplexProperty(e => e.Milk); - }); + b.ComplexProperty(e => e.Culture); + b.ComplexProperty(e => e.Milk); + }); modelBuilder.Entity(); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - b => b.ComplexCollection(e => e.Departments)); + modelBuilder.Entity(b => b.ComplexCollection(e => e.Departments)); } protected override Task SeedAsync(PoolableDbContext context) @@ -4099,7 +4044,8 @@ protected override Task SeedAsync(PoolableDbContext context) Number = 42, }, Foo = "F" - }); context.Add( + }); + context.Add( new Customer33307 { Name = "Bar", diff --git a/test/EFCore.Specification.Tests/Query/AdHocAdvancedMappingsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/AdHocAdvancedMappingsQueryTestBase.cs index c17c2cc57f3..6134e870fd7 100644 --- a/test/EFCore.Specification.Tests/Query/AdHocAdvancedMappingsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/AdHocAdvancedMappingsQueryTestBase.cs @@ -9,7 +9,8 @@ namespace Microsoft.EntityFrameworkCore.Query; #nullable disable -public abstract class AdHocAdvancedMappingsQueryTestBase(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture +public abstract class AdHocAdvancedMappingsQueryTestBase(NonSharedFixture fixture) + : NonSharedModelTestBase(fixture), IClassFixture { protected override string StoreName => "AdHocAdvancedMappingsQueryTests"; @@ -29,14 +30,13 @@ protected class Context9582(DbContextOptions options) : DbContext(options) { protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity( - builder => - { - builder.HasKey(ts => ts.Id); + modelBuilder.Entity(builder => + { + builder.HasKey(ts => ts.Id); - builder.Property(ts => ts.Id).IsRequired(); - builder.Property(ts => ts.Nombre).IsRequired().HasMaxLength(20); - }); + builder.Property(ts => ts.Id).IsRequired(); + builder.Property(ts => ts.Nombre).IsRequired().HasMaxLength(20); + }); foreach (var property in modelBuilder.Model.GetEntityTypes() .SelectMany(e => e.GetProperties().Where(p => p.ClrType == typeof(string)))) @@ -62,24 +62,22 @@ public virtual async Task Projecting_correlated_collection_along_with_non_mapped var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); using (var context = contextFactory.CreateContext()) { - var result = context.Blogs.Select( - e => new - { - e.Id, - e.Title, - FirstPostName = e.Posts.Where(i => i.Name.Contains("2")).ToList() - }).ToList(); + var result = context.Blogs.Select(e => new + { + e.Id, + e.Title, + FirstPostName = e.Posts.Where(i => i.Name.Contains("2")).ToList() + }).ToList(); } using (var context = contextFactory.CreateContext()) { - var result = context.Blogs.Select( - e => new - { - e.Id, - e.Title, - FirstPostName = e.Posts.OrderBy(i => i.Id).FirstOrDefault().Name - }).ToList(); + var result = context.Blogs.Select(e => new + { + e.Id, + e.Title, + FirstPostName = e.Posts.OrderBy(i => i.Id).FirstOrDefault().Name + }).ToList(); } } @@ -246,6 +244,7 @@ protected class Context17276(DbContextOptions options) : DbContext(options) { // ReSharper disable once UnusedAutoPropertyAccessor.Local public DbSet RemovableEntities { get; set; } + // ReSharper disable once UnusedAutoPropertyAccessor.Local public DbSet Parents { get; set; } @@ -404,8 +403,9 @@ public virtual async Task Casts_are_removed_from_expression_tree_when_redundant( var queryBase = (IQueryable)context.MockEntities; var id = 1; - var message = Assert.Throws( - () => queryBase.Cast().FirstOrDefault(x => x.Id == id)).Message; + var message = Assert + .Throws(() => queryBase.Cast().FirstOrDefault(x => x.Id == id)) + .Message; Assert.Equal( CoreStrings.TranslationFailed( @@ -506,16 +506,9 @@ public enum BusinessType #region 26742 - [ConditionalTheory] - [InlineData(null, "")] + [ConditionalTheory, InlineData(null, ""), InlineData(1, " (Scale = 1)"), InlineData(2, " (Scale = 2)"), InlineData(3, " (Scale = 3)"), + InlineData(4, " (Scale = 4)"), InlineData(5, " (Scale = 5)"), InlineData(6, " (Scale = 6)"), InlineData(7, " (Scale = 7)")] //[InlineData(0, " (Scale = 0)")] //https://github.com/dotnet/SqlClient/issues/1380 cause this test to fail, not EF - [InlineData(1, " (Scale = 1)")] - [InlineData(2, " (Scale = 2)")] - [InlineData(3, " (Scale = 3)")] - [InlineData(4, " (Scale = 4)")] - [InlineData(5, " (Scale = 5)")] - [InlineData(6, " (Scale = 6)")] - [InlineData(7, " (Scale = 7)")] public virtual async Task Query_generates_correct_datetime2_parameter_definition(int? fractionalSeconds, string postfix) { var contextFactory = await InitializeAsync( @@ -532,16 +525,9 @@ public virtual async Task Query_generates_correct_datetime2_parameter_definition _ = context.Entities.Where(x => x.DateTime == parameter).Select(e => e.DateTime).FirstOrDefault(); } - [ConditionalTheory] - [InlineData(null, "")] + [ConditionalTheory, InlineData(null, ""), InlineData(1, " (Scale = 1)"), InlineData(2, " (Scale = 2)"), InlineData(3, " (Scale = 3)"), + InlineData(4, " (Scale = 4)"), InlineData(5, " (Scale = 5)"), InlineData(6, " (Scale = 6)"), InlineData(7, " (Scale = 7)")] //[InlineData(0, " (Scale = 0)")] //https://github.com/dotnet/SqlClient/issues/1380 cause this test to fail, not EF - [InlineData(1, " (Scale = 1)")] - [InlineData(2, " (Scale = 2)")] - [InlineData(3, " (Scale = 3)")] - [InlineData(4, " (Scale = 4)")] - [InlineData(5, " (Scale = 5)")] - [InlineData(6, " (Scale = 6)")] - [InlineData(7, " (Scale = 7)")] public virtual async Task Query_generates_correct_datetimeoffset_parameter_definition(int? fractionalSeconds, string postfix) { var contextFactory = await InitializeAsync( @@ -558,16 +544,9 @@ public virtual async Task Query_generates_correct_datetimeoffset_parameter_defin _ = context.Entities.Where(x => x.DateTimeOffset == parameter).Select(e => e.DateTimeOffset).FirstOrDefault(); } - [ConditionalTheory] - [InlineData(null, "")] + [ConditionalTheory, InlineData(null, ""), InlineData(1, " (Scale = 1)"), InlineData(2, " (Scale = 2)"), InlineData(3, " (Scale = 3)"), + InlineData(4, " (Scale = 4)"), InlineData(5, " (Scale = 5)"), InlineData(6, " (Scale = 6)"), InlineData(7, " (Scale = 7)")] //[InlineData(0, " (Scale = 0)")] //https://github.com/dotnet/SqlClient/issues/1380 cause this test to fail, not EF - [InlineData(1, " (Scale = 1)")] - [InlineData(2, " (Scale = 2)")] - [InlineData(3, " (Scale = 3)")] - [InlineData(4, " (Scale = 4)")] - [InlineData(5, " (Scale = 5)")] - [InlineData(6, " (Scale = 6)")] - [InlineData(7, " (Scale = 7)")] public virtual async Task Query_generates_correct_timespan_parameter_definition(int? fractionalSeconds, string postfix) { var contextFactory = await InitializeAsync( @@ -602,8 +581,7 @@ public class Entity #region 28196 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Hierarchy_query_with_abstract_type_sibling(bool async) => Hierarchy_query_with_abstract_type_sibling_helper(async, null); @@ -695,8 +673,7 @@ public class Dog : Pet #region 34760 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Projecting_property_with_converter_with_closure(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -708,8 +685,7 @@ public virtual async Task Projecting_property_with_converter_with_closure(bool a Assert.Equal(2, result.Count); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Projecting_expression_with_converter_with_closure(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -717,17 +693,13 @@ public virtual async Task Projecting_expression_with_converter_with_closure(bool var query = context.Books .GroupBy(t => t.Id) - .Select(g => new - { - Day = g.Min(t => t.PublishDate) - }); + .Select(g => new { Day = g.Min(t => t.PublishDate) }); var result = await query.ToListAsync(); Assert.Equal(2, result.Count); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Projecting_property_with_converter_without_closure(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -735,10 +707,7 @@ public virtual async Task Projecting_property_with_converter_without_closure(boo var query = context.Books .GroupBy(t => t.Id) - .Select(g => new - { - Day = g.Min(t => t.AudiobookDate) - }); + .Select(g => new { Day = g.Min(t => t.AudiobookDate) }); var result = await query.ToListAsync(); Assert.Equal(2, result.Count); @@ -751,20 +720,23 @@ protected class Context34760(DbContextOptions options) : DbContext(options) protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); - modelBuilder.Entity().Property(e => e.PublishDate).HasConversion(new MyDateTimeValueConverterWithClosure(new MyDatetimeConverter())); + modelBuilder.Entity().Property(e => e.PublishDate) + .HasConversion(new MyDateTimeValueConverterWithClosure(new MyDatetimeConverter())); modelBuilder.Entity().Property(e => e.AudiobookDate).HasConversion(new MyDateTimeValueConverterWithoutClosure()); } public Task SeedAsync() { AddRange( - new Book { + new Book + { Id = 1, Name = "The Blade Itself", PublishDate = new DateTime(2006, 5, 4, 11, 59, 59), AudiobookDate = new DateTime(2015, 9, 8, 23, 59, 59) }, - new Book { + new Book + { Id = 2, Name = "Red Rising", PublishDate = new DateTime(2014, 1, 27, 23, 59, 59), diff --git a/test/EFCore.Specification.Tests/Query/AdHocComplexTypeQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/AdHocComplexTypeQueryTestBase.cs index 3c26e2c3e27..3d68782f48b 100644 --- a/test/EFCore.Specification.Tests/Query/AdHocComplexTypeQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/AdHocComplexTypeQueryTestBase.cs @@ -4,7 +4,8 @@ namespace Microsoft.EntityFrameworkCore.Query; // ReSharper disable ClassNeverInstantiated.Local -public abstract class AdHocComplexTypeQueryTestBase(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture +public abstract class AdHocComplexTypeQueryTestBase(NonSharedFixture fixture) + : NonSharedModelTestBase(fixture), IClassFixture { #region 33449 diff --git a/test/EFCore.Specification.Tests/Query/AdHocJsonQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/AdHocJsonQueryTestBase.cs index 1ae6771caac..93b77bc7971 100644 --- a/test/EFCore.Specification.Tests/Query/AdHocJsonQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/AdHocJsonQueryTestBase.cs @@ -19,8 +19,7 @@ protected virtual void ConfigureWarnings(WarningsConfigurationBuilder builder) #region 21006 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Project_root_with_missing_scalars(bool async) { var contextFactory = await InitializeAsync( @@ -50,8 +49,7 @@ public virtual async Task Project_root_with_missing_scalars(bool async) Assert.True(nested.Collection.SelectMany(x => x.NestedCollection).All(x => x.DoB == default)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Project_top_level_json_entity_with_missing_scalars(bool async) { var contextFactory = await InitializeAsync( @@ -87,8 +85,7 @@ public virtual async Task Project_top_level_json_entity_with_missing_scalars(boo Assert.True(nested.Collection.SelectMany(x => x.NestedCollection).All(x => x.DoB == default)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Project_nested_json_entity_with_missing_scalars(bool async) { var contextFactory = await InitializeAsync( @@ -118,8 +115,7 @@ public virtual async Task Project_nested_json_entity_with_missing_scalars(bool a Assert.True(nested.NestedCollection.All(x => x.DoB == default)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Project_top_level_entity_with_null_value_required_scalars(bool async) { var contextFactory = await InitializeAsync( @@ -131,8 +127,7 @@ public virtual async Task Project_top_level_entity_with_null_value_required_scal var query = context.Set().Where(x => x.Id == 4).Select(x => new { - x.Id, - x.RequiredReference, + x.Id, x.RequiredReference, }).AsNoTracking(); var result = async @@ -144,8 +139,7 @@ public virtual async Task Project_top_level_entity_with_null_value_required_scal Assert.Equal(default, nullScalars.RequiredReference.Number); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Project_root_entity_with_missing_required_navigation(bool async) { var contextFactory = await InitializeAsync( @@ -168,8 +162,7 @@ public virtual async Task Project_root_entity_with_missing_required_navigation(b Assert.True(missingRequiredNav.Collection.All(x => x.NestedRequiredReference == default)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Project_missing_required_navigation(bool async) { var contextFactory = await InitializeAsync( @@ -179,7 +172,8 @@ public virtual async Task Project_missing_required_navigation(bool async) await using var context = contextFactory.CreateContext(); - var query = context.Set().Where(x => x.Id == 5).Select(x => x.RequiredReference.NestedRequiredReference).AsNoTracking(); + var query = context.Set().Where(x => x.Id == 5).Select(x => x.RequiredReference.NestedRequiredReference) + .AsNoTracking(); var result = async ? await query.ToListAsync() @@ -190,8 +184,7 @@ public virtual async Task Project_missing_required_navigation(bool async) Assert.Equal(default, missingRequiredNav); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Project_root_entity_with_null_required_navigation(bool async) { var contextFactory = await InitializeAsync( @@ -214,8 +207,7 @@ public virtual async Task Project_root_entity_with_null_required_navigation(bool Assert.True(nullRequiredNav.Collection.All(x => x.NestedRequiredReference == default)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Project_null_required_navigation(bool async) { var contextFactory = await InitializeAsync( @@ -236,8 +228,7 @@ public virtual async Task Project_null_required_navigation(bool async) Assert.Equal(default, nullRequiredNav.NestedRequiredReference); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Project_missing_required_scalar(bool async) { var contextFactory = await InitializeAsync( @@ -249,11 +240,7 @@ public virtual async Task Project_missing_required_scalar(bool async) var query = context.Set() .Where(x => x.Id == 2) - .Select(x => new - { - x.Id, - Number = (double?)x.RequiredReference.Number - }); + .Select(x => new { x.Id, Number = (double?)x.RequiredReference.Number }); var result = async ? await query.ToListAsync() @@ -262,8 +249,7 @@ public virtual async Task Project_missing_required_scalar(bool async) Assert.Null(result.Single().Number); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Project_null_required_scalar(bool async) { var contextFactory = await InitializeAsync( @@ -277,8 +263,7 @@ public virtual async Task Project_null_required_scalar(bool async) .Where(x => x.Id == 4) .Select(x => new { - x.Id, - Number = (double?)x.RequiredReference.Number, + x.Id, Number = (double?)x.RequiredReference.Number, }); var result = async @@ -290,31 +275,34 @@ public virtual async Task Project_null_required_scalar(bool async) protected virtual void OnModelCreating21006(ModelBuilder modelBuilder) => modelBuilder.Entity(b => - { - b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(x => x.OptionalReference, bb => + { + b.Property(x => x.Id).ValueGeneratedNever(); + b.OwnsOne( + x => x.OptionalReference, bb => { bb.OwnsOne(x => x.NestedOptionalReference); bb.OwnsOne(x => x.NestedRequiredReference); bb.Navigation(x => x.NestedRequiredReference).IsRequired(); bb.OwnsMany(x => x.NestedCollection); }); - b.OwnsOne(x => x.RequiredReference, bb => + b.OwnsOne( + x => x.RequiredReference, bb => { bb.OwnsOne(x => x.NestedOptionalReference); bb.OwnsOne(x => x.NestedRequiredReference); bb.Navigation(x => x.NestedRequiredReference).IsRequired(); bb.OwnsMany(x => x.NestedCollection); }); - b.Navigation(x => x.RequiredReference).IsRequired(); - b.OwnsMany(x => x.Collection, bb => + b.Navigation(x => x.RequiredReference).IsRequired(); + b.OwnsMany( + x => x.Collection, bb => { bb.OwnsOne(x => x.NestedOptionalReference); bb.OwnsOne(x => x.NestedRequiredReference); bb.Navigation(x => x.NestedRequiredReference).IsRequired(); bb.OwnsMany(x => x.NestedCollection); }); - }); + }); protected virtual async Task Seed21006(Context21006 context) { @@ -329,52 +317,53 @@ protected virtual async Task Seed21006(Context21006 context) Text = "e1 or", NestedOptionalReference = new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 or nor" }, NestedRequiredReference = new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 or nrr" }, - NestedCollection = new List - { - new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 or c1" }, - new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 or c2" }, - } + NestedCollection = + [ + new() { DoB = new DateTime(2000, 1, 1), Text = "e1 or c1" }, + new() { DoB = new DateTime(2000, 1, 1), Text = "e1 or c2" } + ] }, - RequiredReference = new Context21006.JsonEntity { Number = 7, Text = "e1 rr", NestedOptionalReference = new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 rr nor" }, NestedRequiredReference = new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 rr nrr" }, - NestedCollection = new List - { - new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 rr c1" }, - new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 rr c2" }, - } + NestedCollection = + [ + new() { DoB = new DateTime(2000, 1, 1), Text = "e1 rr c1" }, + new() { DoB = new DateTime(2000, 1, 1), Text = "e1 rr c2" } + ] }, - Collection = new List - { - new Context21006.JsonEntity + Collection = + [ + new() { Number = 7, Text = "e1 c1", NestedOptionalReference = new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 c1 nor" }, NestedRequiredReference = new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 c1 nrr" }, - NestedCollection = new List - { - new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 c1 c1" }, - new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 c1 c2" }, - } + NestedCollection = + [ + new() { DoB = new DateTime(2000, 1, 1), Text = "e1 c1 c1" }, + new() { DoB = new DateTime(2000, 1, 1), Text = "e1 c1 c2" } + ] }, - new Context21006.JsonEntity + + new() { Number = 7, Text = "e1 c2", NestedOptionalReference = new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 c2 nor" }, NestedRequiredReference = new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 c2 nrr" }, - NestedCollection = new List - { - new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 c2 c1" }, - new Context21006.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "e1 c2 c2" }, - } - }, - } + NestedCollection = + [ + new() { DoB = new DateTime(2000, 1, 1), Text = "e1 c2 c1" }, + new() { DoB = new DateTime(2000, 1, 1), Text = "e1 c2 c2" } + ] + } + + ] }; context.Add(e1); @@ -453,11 +442,11 @@ public virtual async Task Can_project_nullable_json_property_when_the_element_in protected virtual void OnModelCreating29219(ModelBuilder modelBuilder) => modelBuilder.Entity(b => - { - b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(x => x.Reference); - b.OwnsMany(x => x.Collection); - }); + { + b.Property(x => x.Id).ValueGeneratedNever(); + b.OwnsOne(x => x.Reference); + b.OwnsMany(x => x.Collection); + }); protected virtual async Task Seed29219(DbContext ctx) { @@ -532,8 +521,7 @@ public virtual async Task Accessing_missing_navigation_works() Assert.Null(result[3].Json.RequiredReference); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Missing_navigation_works_with_deduplication(bool async) { var contextFactory = await InitializeAsync( @@ -542,17 +530,16 @@ public virtual async Task Missing_navigation_works_with_deduplication(bool async seed: Seed30028); using var context = contextFactory.CreateContext(); - var queryable = context.Set().OrderBy(x => x.Id).Select( - x => new - { - x, - x.Json, - x.Json.OptionalReference, - x.Json.RequiredReference, - NestedOptional = x.Json.OptionalReference.Nested, - NestedRequired = x.Json.RequiredReference.Nested, - x.Json.Collection, - }).AsNoTracking(); + var queryable = context.Set().OrderBy(x => x.Id).Select(x => new + { + x, + x.Json, + x.Json.OptionalReference, + x.Json.RequiredReference, + NestedOptional = x.Json.OptionalReference.Nested, + NestedRequired = x.Json.RequiredReference.Nested, + x.Json.Collection, + }).AsNoTracking(); var result = async ? await queryable.ToListAsync() : queryable.ToList(); @@ -584,16 +571,17 @@ public virtual async Task Missing_navigation_works_with_deduplication(bool async protected virtual void OnModelCreating30028(ModelBuilder modelBuilder) => modelBuilder.Entity(b => - { - b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(x => x.Json, nb => + { + b.Property(x => x.Id).ValueGeneratedNever(); + b.OwnsOne( + x => x.Json, nb => { nb.OwnsMany(x => x.Collection, nnb => nnb.OwnsOne(x => x.Nested)); nb.OwnsOne(x => x.OptionalReference, nnb => nnb.OwnsOne(x => x.Nested)); nb.OwnsOne(x => x.RequiredReference, nnb => nnb.OwnsOne(x => x.Nested)); nb.Navigation(x => x.RequiredReference).IsRequired(); }); - }); + }); protected abstract Task Seed30028(DbContext ctx); @@ -649,14 +637,13 @@ public virtual async Task Contains_on_nested_collection_with_init_only_navigatio } protected virtual void OnModelCreating32310(ModelBuilder modelBuilder) - => modelBuilder.Entity().OwnsOne(e => e.Visits); + => modelBuilder.Entity().OwnsOne(e => e.Visits); protected virtual async Task Seed32310(DbContext context) { var user = new Context32310.Pub { - Name = "FBI", - Visits = new Context32310.Visits { LocationTag = "tag", DaysVisited = [new DateOnly(2023, 1, 1)] } + Name = "FBI", Visits = new Context32310.Visits { LocationTag = "tag", DaysVisited = [new DateOnly(2023, 1, 1)] } }; context.Add(user); @@ -748,13 +735,14 @@ public virtual async Task Query_with_nested_json_collection_mapped_to_private_fi protected virtual void OnModelCreating33046(ModelBuilder modelBuilder) => modelBuilder.Entity(b => - { - b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsMany(x => x.Rounds, ownedBuilder => + { + b.Property(x => x.Id).ValueGeneratedNever(); + b.OwnsMany( + x => x.Rounds, ownedBuilder => { ownedBuilder.OwnsMany(r => r.SubRounds); }); - }); + }); protected abstract Task Seed33046(DbContext ctx); @@ -860,34 +848,38 @@ protected virtual void OnModelCreating34960(ModelBuilder modelBuilder) { b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(x => x.Reference, b => - { - b.OwnsOne(x => x.NestedReference); - b.OwnsMany(x => x.NestedCollection); - }); + b.OwnsOne( + x => x.Reference, b => + { + b.OwnsOne(x => x.NestedReference); + b.OwnsMany(x => x.NestedCollection); + }); - b.OwnsMany(x => x.Collection, b => - { - b.OwnsOne(x => x.NestedReference); - b.OwnsMany(x => x.NestedCollection); - }); + b.OwnsMany( + x => x.Collection, b => + { + b.OwnsOne(x => x.NestedReference); + b.OwnsMany(x => x.NestedCollection); + }); }); modelBuilder.Entity(b => { b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(x => x.Reference, b => - { - b.Ignore(x => x.NestedReference); - b.Ignore(x => x.NestedCollection); - }); + b.OwnsOne( + x => x.Reference, b => + { + b.Ignore(x => x.NestedReference); + b.Ignore(x => x.NestedCollection); + }); - b.OwnsMany(x => x.Collection, b => - { - b.Ignore(x => x.NestedReference); - b.Ignore(x => x.NestedCollection); - }); + b.OwnsMany( + x => x.Collection, b => + { + b.Ignore(x => x.NestedReference); + b.Ignore(x => x.NestedCollection); + }); }); } @@ -901,72 +893,35 @@ protected virtual async Task Seed34960(Context34960 ctx) { Name = "ref1", Number = 1.5f, - NestedReference = new Context34960.JsonEntityNested - { - DoB = new DateTime(2000, 1, 1), - Text = "nested ref 1" - }, + NestedReference = new Context34960.JsonEntityNested { DoB = new DateTime(2000, 1, 1), Text = "nested ref 1" }, NestedCollection = [ - new Context34960.JsonEntityNested - { - DoB = new DateTime(2001, 1, 1), - Text = "nested col 1 1" - }, - new Context34960.JsonEntityNested - { - DoB = new DateTime(2001, 2, 2), - Text = "nested col 1 2" - }, + new Context34960.JsonEntityNested { DoB = new DateTime(2001, 1, 1), Text = "nested col 1 1" }, + new Context34960.JsonEntityNested { DoB = new DateTime(2001, 2, 2), Text = "nested col 1 2" }, ], }, - Collection = [ new Context34960.JsonEntity { Name = "col 1 1", Number = 2.5f, - NestedReference = new Context34960.JsonEntityNested - { - DoB = new DateTime(2010, 1, 1), - Text = "nested col 1 1 ref 1" - }, + NestedReference = new Context34960.JsonEntityNested { DoB = new DateTime(2010, 1, 1), Text = "nested col 1 1 ref 1" }, NestedCollection = [ - new Context34960.JsonEntityNested - { - DoB = new DateTime(2011, 1, 1), - Text = "nested col 1 1 col 1 1" - }, - new Context34960.JsonEntityNested - { - DoB = new DateTime(2011, 2, 2), - Text = "nested col 1 1 col 1 2" - }, + new Context34960.JsonEntityNested { DoB = new DateTime(2011, 1, 1), Text = "nested col 1 1 col 1 1" }, + new Context34960.JsonEntityNested { DoB = new DateTime(2011, 2, 2), Text = "nested col 1 1 col 1 2" }, ], }, new Context34960.JsonEntity { Name = "col 1 2", Number = 2.5f, - NestedReference = new Context34960.JsonEntityNested - { - DoB = new DateTime(2020, 1, 1), - Text = "nested col 1 2 ref 1" - }, + NestedReference = new Context34960.JsonEntityNested { DoB = new DateTime(2020, 1, 1), Text = "nested col 1 2 ref 1" }, NestedCollection = [ - new Context34960.JsonEntityNested - { - DoB = new DateTime(2021, 1, 1), - Text = "nested col 1 2 col 1 1" - }, - new Context34960.JsonEntityNested - { - DoB = new DateTime(2021, 2, 2), - Text = "nested col 1 2 col 1 2" - }, + new Context34960.JsonEntityNested { DoB = new DateTime(2021, 1, 1), Text = "nested col 1 2 col 1 1" }, + new Context34960.JsonEntityNested { DoB = new DateTime(2021, 2, 2), Text = "nested col 1 2 col 1 2" }, ], }, ], @@ -991,7 +946,6 @@ protected virtual async Task Seed34960(Context34960 ctx) NestedReference = null, NestedCollection = null }, - Collection = [ new Context34960.JsonEntity @@ -1070,8 +1024,8 @@ public virtual async Task Project_element_of_json_array_of_primitives() seed: SeedArrayOfPrimitives); using var context = contextFactory.CreateContext(); - var query = context.Set().OrderBy(x => x.Id).Select( - x => new { ArrayElement = x.Reference.IntArray[0], ListElement = x.Reference.ListOfString[1] }); + var query = context.Set().OrderBy(x => x.Id).Select(x + => new { ArrayElement = x.Reference.IntArray[0], ListElement = x.Reference.ListOfString[1] }); var result = await query.ToListAsync(); } @@ -1107,8 +1061,7 @@ public virtual async Task Predicate_based_on_element_of_json_array_of_primitives Assert.Equal("Bar", result[0].Reference.ListOfString[1]); } - [ConditionalFact] - [MemberData(nameof(IsAsyncData))] + [ConditionalFact, MemberData(nameof(IsAsyncData))] public virtual async Task Predicate_based_on_element_of_json_array_of_primitives3() { var contextFactory = await InitializeAsync( @@ -1247,35 +1200,38 @@ public virtual async Task Junk_in_json_basic_no_tracking() protected abstract Task SeedJunkInJson(DbContext ctx); protected virtual void OnModelCreatingJunkInJson(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.Property(x => x.Id).ValueGeneratedNever(); + => modelBuilder.Entity(b => + { + b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(x => x.Reference, b => + b.OwnsOne( + x => x.Reference, b => { b.OwnsOne(x => x.NestedReference); b.OwnsMany(x => x.NestedCollection); }); - b.OwnsOne(x => x.ReferenceWithCtor, b => + b.OwnsOne( + x => x.ReferenceWithCtor, b => { b.OwnsOne(x => x.NestedReference); b.OwnsMany(x => x.NestedCollection); }); - b.OwnsMany(x => x.Collection, b => + b.OwnsMany( + x => x.Collection, b => { b.OwnsOne(x => x.NestedReference); b.OwnsMany(x => x.NestedCollection); }); - b.OwnsMany(x => x.CollectionWithCtor, b => + b.OwnsMany( + x => x.CollectionWithCtor, b => { b.OwnsOne(x => x.NestedReference); b.OwnsMany(x => x.NestedCollection); }); - }); + }); protected class ContextJunkInJson(DbContextOptions options) : DbContext(options) { @@ -1344,14 +1300,15 @@ public virtual async Task Tricky_buffering_basic() protected virtual void OnModelCreatingTrickyBuffering(ModelBuilder modelBuilder) => modelBuilder.Entity(b => - { - b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(x => x.Reference, b => + { + b.Property(x => x.Id).ValueGeneratedNever(); + b.OwnsOne( + x => x.Reference, b => { b.OwnsOne(x => x.NestedReference); b.OwnsMany(x => x.NestedCollection); }); - }); + }); protected class ContextTrickyBuffering(DbContextOptions options) : DbContext(options) { @@ -1442,12 +1399,11 @@ public virtual async Task Project_shadow_properties_from_json_entity() seed: SeedShadowProperties); using var context = contextFactory.CreateContext(); - var query = context.Set().Select( - x => new - { - ShadowString = EF.Property(x.Reference, "ShadowString"), - ShadowInt = EF.Property(x.ReferenceWithCtor, "Shadow_Int"), - }); + var query = context.Set().Select(x => new + { + ShadowString = EF.Property(x.Reference, "ShadowString"), + ShadowInt = EF.Property(x.ReferenceWithCtor, "Shadow_Int"), + }); var result = await query.ToListAsync(); @@ -1460,29 +1416,33 @@ public virtual async Task Project_shadow_properties_from_json_entity() protected virtual void OnModelCreatingShadowProperties(ModelBuilder modelBuilder) => modelBuilder.Entity(b => - { - b.Property(x => x.Id).ValueGeneratedNever(); + { + b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(x => x.Reference, b => + b.OwnsOne( + x => x.Reference, b => { b.Property("ShadowString"); }); - b.OwnsOne(x => x.ReferenceWithCtor, b => + b.OwnsOne( + x => x.ReferenceWithCtor, b => { b.Property("Shadow_Int"); }); - b.OwnsMany(x => x.Collection, b => + b.OwnsMany( + x => x.Collection, b => { b.Property("ShadowDouble"); }); - b.OwnsMany(x => x.CollectionWithCtor, b => + b.OwnsMany( + x => x.CollectionWithCtor, b => { b.Property("ShadowNullableByte"); }); - }); + }); protected class ContextShadowProperties(DbContextOptions options) : DbContext(options) { @@ -1628,14 +1588,14 @@ public virtual async Task Not_ICollection_basic_projection() protected virtual void OnModelCreatingNotICollection(ModelBuilder modelBuilder) => modelBuilder.Entity(b => - { - b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(cr => cr.Json, nb => + { + b.Property(x => x.Id).ValueGeneratedNever(); + b.OwnsOne( + cr => cr.Json, nb => { nb.OwnsMany(x => x.Collection); }); - }); - + }); protected class ContextNotICollection(DbContextOptions options) : DbContext(options) { @@ -1665,9 +1625,7 @@ public class MyJsonNestedEntity #region BadJsonProperties - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Bad_json_properties_duplicated_navigations(bool noTracking) { var contextFactory = await InitializeAsync( @@ -1702,9 +1660,7 @@ public virtual async Task Bad_json_properties_duplicated_navigations(bool noTrac Assert.Equal(baseline.Collection[1].NestedCollection[1].Text + " dupnav", dupNavs.Collection[1].NestedCollection[1].Text); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Bad_json_properties_duplicated_scalars(bool noTracking) { var contextFactory = await InitializeAsync( @@ -1739,9 +1695,7 @@ public virtual async Task Bad_json_properties_duplicated_scalars(bool noTracking Assert.Equal(baseline.Collection[1].NestedCollection[1].Text + " dupprop", dupProps.Collection[1].NestedCollection[1].Text); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Bad_json_properties_empty_navigations(bool noTracking) { var contextFactory = await InitializeAsync( @@ -1770,9 +1724,7 @@ public virtual async Task Bad_json_properties_empty_navigations(bool noTracking) Assert.Null(emptyNavs.Collection[1].NestedCollection); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Bad_json_properties_empty_scalars(bool noTracking) { var contextFactory = await InitializeAsync( @@ -1805,9 +1757,7 @@ public virtual async Task Bad_json_properties_empty_scalars(bool noTracking) Assert.Null(emptyNavs.Collection[1].NestedCollection[1].Text); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Bad_json_properties_null_navigations(bool noTracking) { var contextFactory = await InitializeAsync( @@ -1820,9 +1770,7 @@ public virtual async Task Bad_json_properties_null_navigations(bool noTracking) var _ = await query.SingleAsync(x => x.Scenario == "null navigation property names"); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Bad_json_properties_null_scalars(bool noTracking) { var contextFactory = await InitializeAsync( @@ -1839,30 +1787,33 @@ public virtual async Task Bad_json_properties_null_scalars(bool noTracking) protected virtual void OnModelCreatingBadJsonProperties(ModelBuilder modelBuilder) => modelBuilder.Entity(b => - { - b.Property(x => x.Id).ValueGeneratedNever(); + { + b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(x => x.RequiredReference, b => + b.OwnsOne( + x => x.RequiredReference, b => { b.OwnsOne(x => x.NestedOptional); b.OwnsOne(x => x.NestedRequired); b.OwnsMany(x => x.NestedCollection); }); - b.OwnsOne(x => x.OptionalReference, b => + b.OwnsOne( + x => x.OptionalReference, b => { b.OwnsOne(x => x.NestedOptional); b.OwnsOne(x => x.NestedRequired); b.OwnsMany(x => x.NestedCollection); }); - b.OwnsMany(x => x.Collection, b => + b.OwnsMany( + x => x.Collection, b => { b.OwnsOne(x => x.NestedOptional); b.OwnsOne(x => x.NestedRequired); b.OwnsMany(x => x.NestedCollection); }); - }); + }); protected class ContextBadJsonProperties(DbContextOptions options) : DbContext(options) { diff --git a/test/EFCore.Specification.Tests/Query/AdHocManyToManyQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/AdHocManyToManyQueryTestBase.cs index e6f3a3cdfe2..67d8a1595bf 100644 --- a/test/EFCore.Specification.Tests/Query/AdHocManyToManyQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/AdHocManyToManyQueryTestBase.cs @@ -5,7 +5,8 @@ namespace Microsoft.EntityFrameworkCore; #nullable disable -public abstract class AdHocManyToManyQueryTestBase(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture +public abstract class AdHocManyToManyQueryTestBase(NonSharedFixture fixture) + : NonSharedModelTestBase(fixture), IClassFixture { protected override string StoreName => "AdHocManyToManyQueryTests"; @@ -78,8 +79,7 @@ public class OrganisationUser #region 20277 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) { var contextFactory = await InitializeAsync(); diff --git a/test/EFCore.Specification.Tests/Query/AdHocMiscellaneousQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/AdHocMiscellaneousQueryTestBase.cs index 334038f53c1..bfe02d5fbeb 100644 --- a/test/EFCore.Specification.Tests/Query/AdHocMiscellaneousQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/AdHocMiscellaneousQueryTestBase.cs @@ -9,7 +9,8 @@ namespace Microsoft.EntityFrameworkCore; #nullable disable -public abstract class AdHocMiscellaneousQueryTestBase(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture +public abstract class AdHocMiscellaneousQueryTestBase(NonSharedFixture fixture) + : NonSharedModelTestBase(fixture), IClassFixture { protected override string StoreName => "AdHocMiscellaneousQueryTests"; @@ -62,8 +63,7 @@ public class Product #region 6901 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task LeftJoin_with_missing_key_values_on_both_sides(bool async) { var contextFactory = await InitializeAsync(); @@ -93,73 +93,71 @@ protected class Context6901(DbContextOptions options) : DbContext(options) { protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity( - c => - { - c.HasKey(x => x.CustomerID); - c.Property(c => c.CustomerID).ValueGeneratedNever(); - c.Property(c => c.CustomerName).HasMaxLength(120).IsUnicode(false); - c.HasData( - new Customer - { - CustomerID = 1, - CustomerName = "Sam Tippet", - PostcodeID = 5 - }, - new Customer - { - CustomerID = 2, - CustomerName = "William Greig", - PostcodeID = 2 - }, - new Customer - { - CustomerID = 3, - CustomerName = "Steve Jones", - PostcodeID = 3 - }, - new Customer { CustomerID = 4, CustomerName = "Jim Warren" }, - new Customer - { - CustomerID = 5, - CustomerName = "Andrew Smith", - PostcodeID = 5 - }); - }); + modelBuilder.Entity(c => + { + c.HasKey(x => x.CustomerID); + c.Property(c => c.CustomerID).ValueGeneratedNever(); + c.Property(c => c.CustomerName).HasMaxLength(120).IsUnicode(false); + c.HasData( + new Customer + { + CustomerID = 1, + CustomerName = "Sam Tippet", + PostcodeID = 5 + }, + new Customer + { + CustomerID = 2, + CustomerName = "William Greig", + PostcodeID = 2 + }, + new Customer + { + CustomerID = 3, + CustomerName = "Steve Jones", + PostcodeID = 3 + }, + new Customer { CustomerID = 4, CustomerName = "Jim Warren" }, + new Customer + { + CustomerID = 5, + CustomerName = "Andrew Smith", + PostcodeID = 5 + }); + }); - modelBuilder.Entity( - p => - { - p.HasKey(x => x.PostcodeID); - p.Property(c => c.PostcodeID).ValueGeneratedNever(); - p.Property(c => c.PostcodeValue).HasMaxLength(100).IsUnicode(false); - p.Property(c => c.TownName).HasMaxLength(255).IsUnicode(false); - p.HasData( - new Postcode - { - PostcodeID = 2, - PostcodeValue = "1000", - TownName = "Town 1" - }, - new Postcode - { - PostcodeID = 3, - PostcodeValue = "2000", - TownName = "Town 2" - }, - new Postcode - { - PostcodeID = 4, - PostcodeValue = "3000", - TownName = "Town 3" - }, - new Postcode - { - PostcodeID = 5, - PostcodeValue = "4000", - TownName = "Town 4" - }); - }); + modelBuilder.Entity(p => + { + p.HasKey(x => x.PostcodeID); + p.Property(c => c.PostcodeID).ValueGeneratedNever(); + p.Property(c => c.PostcodeValue).HasMaxLength(100).IsUnicode(false); + p.Property(c => c.TownName).HasMaxLength(255).IsUnicode(false); + p.HasData( + new Postcode + { + PostcodeID = 2, + PostcodeValue = "1000", + TownName = "Town 1" + }, + new Postcode + { + PostcodeID = 3, + PostcodeValue = "2000", + TownName = "Town 2" + }, + new Postcode + { + PostcodeID = 4, + PostcodeValue = "3000", + TownName = "Town 3" + }, + new Postcode + { + PostcodeID = 5, + PostcodeValue = "4000", + TownName = "Town 4" + }); + }); } public DbSet Customers { get; set; } @@ -212,8 +210,8 @@ public virtual async Task Shadow_property_with_inheritance() using (var context = contextFactory.CreateContext()) { // can_project_shadow_property_using_ef_property - var query = context.Contacts.OfType().Select( - c => new { c, Prop = EF.Property(c, "ServiceOperatorId") }).ToList(); + var query = context.Contacts.OfType() + .Select(c => new { c, Prop = EF.Property(c, "ServiceOperatorId") }).ToList(); Assert.Single(query); Assert.Equal(1, query[0].Prop); @@ -392,7 +390,7 @@ public virtual async Task New_instances_in_projection_are_not_shared_across_resu var list = context.Posts.Select(p => new Context7983.PostDTO().From(p)).ToList(); Assert.Equal(3, list.Count); - Assert.Equal(new[] { "First", "Second", "Third" }, list.Select(dto => dto.Title)); + Assert.Equal(["First", "Second", "Third"], list.Select(dto => dto.Title)); } // Protected so that it can be used by inheriting tests, and so that things like unused setters are not removed. @@ -708,8 +706,8 @@ public virtual async Task Conditional_expression_with_conditions_does_not_collap { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); using var context = contextFactory.CreateContext(); - var query = context.Carts.Select( - t => new { Processing = t.Configuration != null ? !t.Configuration.Processed : (bool?)null }).ToList(); + var query = context.Carts.Select(t => new { Processing = t.Configuration != null ? !t.Configuration.Processed : (bool?)null }) + .ToList(); Assert.Single(query, t => t.Processing == null); Assert.Single(query, t => t.Processing == true); @@ -827,13 +825,12 @@ protected class Context11885(DbContextOptions options) : DbContext(options) public DbSet Prices { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.Property(e => e.Price).HasPrecision(18, 8); - b.Property(e => e.DecimalColumn).HasPrecision(18, 2); - b.Property(e => e.NullableDecimalColumn).HasPrecision(18, 2); - }); + => modelBuilder.Entity(b => + { + b.Property(e => e.Price).HasPrecision(18, 8); + b.Property(e => e.DecimalColumn).HasPrecision(18, 2); + b.Property(e => e.NullableDecimalColumn).HasPrecision(18, 2); + }); public Task SeedAsync() { @@ -906,14 +903,13 @@ public virtual async Task Parameterless_ctor_on_inner_DTO_gets_called_for_every_ { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); using var context = contextFactory.CreateContext(); - var results = context.Entities.Select( - x => - new Context12274.OuterDTO - { - Id = x.Id, - Name = x.Name, - Inner = new Context12274.InnerDTO() - }).ToList(); + var results = context.Entities.Select(x => + new Context12274.OuterDTO + { + Id = x.Id, + Name = x.Name, + Inner = new Context12274.InnerDTO() + }).ToList(); Assert.Equal(4, results.Count); Assert.False(ReferenceEquals(results[0].Inner, results[1].Inner)); Assert.False(ReferenceEquals(results[1].Inner, results[2].Inner)); @@ -1251,8 +1247,7 @@ public class B #region 21770 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Comparing_enum_casted_to_byte_with_int_parameter(bool async) { var contextFactory = await InitializeAsync(); @@ -1267,8 +1262,7 @@ public virtual async Task Comparing_enum_casted_to_byte_with_int_parameter(bool Assert.Single(bitterIceCreams); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Comparing_enum_casted_to_byte_with_int_constant(bool async) { var contextFactory = await InitializeAsync(); @@ -1282,8 +1276,7 @@ public virtual async Task Comparing_enum_casted_to_byte_with_int_constant(bool a Assert.Single(bitterIceCreams); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Comparing_byte_column_to_enum_in_vb_creating_double_cast(bool async) { var contextFactory = await InitializeAsync(); @@ -1303,8 +1296,7 @@ public virtual async Task Comparing_byte_column_to_enum_in_vb_creating_double_ca : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Null_check_removal_in_ternary_maintain_appropriate_cast(bool async) { var contextFactory = await InitializeAsync(); @@ -1326,35 +1318,33 @@ protected class Context21770(DbContextOptions options) : DbContext(options) protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity( - entity => - { - entity.HasData( - new IceCream - { - IceCreamId = 1, - Name = "Vanilla", - Taste = (byte)Taste.Sweet - }, - new IceCream - { - IceCreamId = 2, - Name = "Chocolate", - Taste = (byte)Taste.Sweet - }, - new IceCream - { - IceCreamId = 3, - Name = "Match", - Taste = (byte)Taste.Bitter - }); - }); + modelBuilder.Entity(entity => + { + entity.HasData( + new IceCream + { + IceCreamId = 1, + Name = "Vanilla", + Taste = (byte)Taste.Sweet + }, + new IceCream + { + IceCreamId = 2, + Name = "Chocolate", + Taste = (byte)Taste.Sweet + }, + new IceCream + { + IceCreamId = 3, + Name = "Match", + Taste = (byte)Taste.Bitter + }); + }); - modelBuilder.Entity( - entity => - { - entity.HasData(new Food { Id = 1, Taste = null }); - }); + modelBuilder.Entity(entity => + { + entity.HasData(new Food { Id = 1, Taste = null }); + }); } public enum Taste : byte @@ -1450,8 +1440,7 @@ public int Id #region 24657 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Bool_discriminator_column_works(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -1517,8 +1506,7 @@ public PhotoBlog() #region 26593 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Unwrap_convert_node_over_projection_when_translating_contains_over_subquery(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -1542,8 +1530,7 @@ public virtual async Task Unwrap_convert_node_over_projection_when_translating_c : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Unwrap_convert_node_over_projection_when_translating_contains_over_subquery_2(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -1567,8 +1554,7 @@ public virtual async Task Unwrap_convert_node_over_projection_when_translating_c : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Unwrap_convert_node_over_projection_when_translating_contains_over_subquery_3(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -1637,8 +1623,7 @@ public class Membership #region 26587 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task GroupBy_aggregate_on_right_side_of_join(bool async) { var contextFactory = await InitializeAsync(); @@ -1683,8 +1668,7 @@ public class OrderItem #region 26472 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Enum_with_value_converter_matching_take_value(bool async) { var contextFactory = await InitializeAsync(); @@ -1693,14 +1677,13 @@ public virtual async Task Enum_with_value_converter_matching_take_value(bool asy var query = context.Orders.Where(x => x.Items.Any()).OrderBy(e => e.Id).Take(1) .Select(e => e.Id) .Join(context.Orders, o => o, i => i.Id, (o, i) => i) - .Select( - entity => new - { - entity.Id, - SpecialSum = entity.Items.Where(x => x.Type == orderItemType) - .Select(x => x.Price) - .FirstOrDefault() - }); + .Select(entity => new + { + entity.Id, + SpecialSum = entity.Items.Where(x => x.Type == orderItemType) + .Select(x => x.Price) + .FirstOrDefault() + }); var result = async ? await query.ToListAsync() @@ -1743,8 +1726,7 @@ public enum OrderItemType #region 27083 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task GroupBy_Aggregate_over_navigations_repeated(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -1754,13 +1736,12 @@ public virtual async Task GroupBy_Aggregate_over_navigations_repeated(bool async .Set() .Where(x => x.OrderId != null) .GroupBy(x => x.OrderId) - .Select( - x => new - { - HourlyRate = x.Min(f => f.Order.HourlyRate), - CustomerId = x.Min(f => f.Project.Customer.Id), - CustomerName = x.Min(f => f.Project.Customer.Name), - }); + .Select(x => new + { + HourlyRate = x.Min(f => f.Order.HourlyRate), + CustomerId = x.Min(f => f.Project.Customer.Id), + CustomerName = x.Min(f => f.Project.Customer.Name), + }); var timeSheets = async ? await query.ToListAsync() @@ -1769,8 +1750,7 @@ public virtual async Task GroupBy_Aggregate_over_navigations_repeated(bool async Assert.Equal(2, timeSheets.Count); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Aggregate_over_subquery_in_group_by_projection(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -1782,15 +1762,14 @@ public virtual async Task Aggregate_over_subquery_in_group_by_projection(bool as .Set() .Where(someFilterFromOutside) .GroupBy(x => new { x.CustomerId, x.Number }) - .Select( - x => new - { - x.Key.CustomerId, - CustomerMinHourlyRate = - context.Set().Where(n => n.CustomerId == x.Key.CustomerId).Min(h => h.HourlyRate), - HourlyRate = x.Min(f => f.HourlyRate), - Count = x.Count() - }); + .Select(x => new + { + x.Key.CustomerId, + CustomerMinHourlyRate = + context.Set().Where(n => n.CustomerId == x.Key.CustomerId).Min(h => h.HourlyRate), + HourlyRate = x.Min(f => f.HourlyRate), + Count = x.Count() + }); var orders = async ? await query.ToListAsync() @@ -1902,8 +1881,7 @@ public class TimeSheet #region 27094 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Aggregate_over_subquery_in_group_by_projection_2(bool async) { var contextFactory = await InitializeAsync(); @@ -1922,8 +1900,7 @@ into tg : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Group_by_aggregate_in_subquery_projection_after_group_by(bool async) { var contextFactory = await InitializeAsync(); @@ -1964,24 +1941,21 @@ public class Table #region 26744 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Subquery_first_member_compared_to_null(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); using var context = contextFactory.CreateContext(); var query = context.Parents - .Where( - p => p.Children.Any(c => c.SomeNullableDateTime == null) - && p.Children.Where(c => c.SomeNullableDateTime == null) - .OrderBy(c => c.SomeInteger) - .First().SomeOtherNullableDateTime - != null) - .Select( - p => p.Children.Where(c => c.SomeNullableDateTime == null) + .Where(p => p.Children.Any(c => c.SomeNullableDateTime == null) + && p.Children.Where(c => c.SomeNullableDateTime == null) .OrderBy(c => c.SomeInteger) - .First().SomeOtherNullableDateTime); + .First().SomeOtherNullableDateTime + != null) + .Select(p => p.Children.Where(c => c.SomeNullableDateTime == null) + .OrderBy(c => c.SomeInteger) + .First().SomeOtherNullableDateTime); var result = async ? await query.ToListAsync() @@ -1990,19 +1964,17 @@ public virtual async Task Subquery_first_member_compared_to_null(bool async) Assert.Single(result); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task SelectMany_where_Select(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); using var context = contextFactory.CreateContext(); var query = context.Parents - .SelectMany( - p => p.Children - .Where(c => c.SomeNullableDateTime == null) - .OrderBy(c => c.SomeInteger) - .Take(1)) + .SelectMany(p => p.Children + .Where(c => c.SomeNullableDateTime == null) + .OrderBy(c => c.SomeInteger) + .Take(1)) .Where(c => c.SomeOtherNullableDateTime != null) .Select(c => c.SomeNullableDateTime); @@ -2045,8 +2017,7 @@ public class Child #region 27343 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Flattened_GroupJoin_on_interface_generic(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -2098,8 +2069,7 @@ public class Child #region 28039 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Pushdown_does_not_add_grouping_key_to_projection_when_distinct_is_applied(bool async) { var contextFactory = await InitializeAsync(); @@ -2161,32 +2131,30 @@ public class SearchResult #region 31961 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Filter_on_nested_DTO_with_interface_gets_simplified_correctly(bool async) { var contextFactory = await InitializeAsync(); using var context = contextFactory.CreateContext(); var query = context.Customers - .Select( - m => new Context31961.CustomerDto - { - Id = m.Id, - CompanyId = m.CompanyId, - Company = m.Company != null - ? new Context31961.CompanyDto + .Select(m => new Context31961.CustomerDto + { + Id = m.Id, + CompanyId = m.CompanyId, + Company = m.Company != null + ? new Context31961.CompanyDto + { + Id = m.Company.Id, + CompanyName = m.Company.CompanyName, + CountryId = m.Company.CountryId, + Country = new Context31961.CountryDto { - Id = m.Company.Id, - CompanyName = m.Company.CompanyName, - CountryId = m.Company.CountryId, - Country = new Context31961.CountryDto - { - Id = m.Company.Country.Id, CountryName = m.Company.Country.CountryName, - }, - } - : null, - }) + Id = m.Company.Country.Id, CountryName = m.Company.Country.CountryName, + }, + } + : null, + }) .Where(m => m.Company.Country.CountryName == "COUNTRY"); var result = async diff --git a/test/EFCore.Specification.Tests/Query/AdHocNavigationsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/AdHocNavigationsQueryTestBase.cs index 6c75cadded8..bd8be0f302e 100644 --- a/test/EFCore.Specification.Tests/Query/AdHocNavigationsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/AdHocNavigationsQueryTestBase.cs @@ -10,7 +10,8 @@ namespace Microsoft.EntityFrameworkCore.Query; #nullable disable -public abstract class AdHocNavigationsQueryTestBase(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture +public abstract class AdHocNavigationsQueryTestBase(NonSharedFixture fixture) + : NonSharedModelTestBase(fixture), IClassFixture { protected override string StoreName => "AdHocNavigationsQueryTests"; @@ -37,8 +38,7 @@ public virtual async Task ThenInclude_with_interface_navigations() using (var context = contextFactory.CreateContext()) { var results = context.Children - .Select( - c => new { c.SelfReferenceBackNavigation, c.SelfReferenceBackNavigation.ParentBackNavigation }) + .Select(c => new { c.SelfReferenceBackNavigation, c.SelfReferenceBackNavigation.ParentBackNavigation }) .ToList(); Assert.Equal(3, results.Count); @@ -49,16 +49,15 @@ public virtual async Task ThenInclude_with_interface_navigations() using (var context = contextFactory.CreateContext()) { var results = context.Children - .Select( - c => new - { - SelfReferenceBackNavigation - = EF.Property(c, "SelfReferenceBackNavigation"), - ParentBackNavigationB - = EF.Property( - EF.Property(c, "SelfReferenceBackNavigation"), - "ParentBackNavigation") - }) + .Select(c => new + { + SelfReferenceBackNavigation + = EF.Property(c, "SelfReferenceBackNavigation"), + ParentBackNavigationB + = EF.Property( + EF.Property(c, "SelfReferenceBackNavigation"), + "ParentBackNavigation") + }) .ToList(); Assert.Equal(3, results.Count); @@ -191,7 +190,7 @@ public virtual async Task Customer_collections_materialize_properly() Assert.Equal( CoreStrings.NavigationCannotCreateType( - "Orders4", typeof(Context3758.Customer).Name, + "Orders4", nameof(Context3758.Customer), typeof(Context3758.MyInvalidCollection).ShortDisplayName()), Assert.Throws(() => query4.ToList()).Message); } @@ -202,14 +201,13 @@ protected class Context3758(DbContextOptions options) : DbContext(options) public DbSet Orders { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.HasMany(e => e.Orders1).WithOne().HasForeignKey("CustomerId1"); - b.HasMany(e => e.Orders2).WithOne().HasForeignKey("CustomerId2"); - b.HasMany(e => e.Orders3).WithOne().HasForeignKey("CustomerId3"); - b.HasMany(e => e.Orders4).WithOne().HasForeignKey("CustomerId4"); - }); + => modelBuilder.Entity(b => + { + b.HasMany(e => e.Orders1).WithOne().HasForeignKey("CustomerId1"); + b.HasMany(e => e.Orders2).WithOne().HasForeignKey("CustomerId2"); + b.HasMany(e => e.Orders3).WithOne().HasForeignKey("CustomerId3"); + b.HasMany(e => e.Orders4).WithOne().HasForeignKey("CustomerId4"); + }); public Task SeedAsync() { @@ -238,8 +236,8 @@ public Task SeedAsync() Orders4 = new MyInvalidCollection(42) }; - c1.Orders2.AddRange(new[] { o121, o122 }); - c1.Orders3.AddRange(new[] { o131, o132 }); + c1.Orders2.AddRange([o121, o122]); + c1.Orders3.AddRange([o131, o132]); c1.Orders4.Add(o141); var c2 = new Customer @@ -251,8 +249,8 @@ public Task SeedAsync() Orders4 = new MyInvalidCollection(42) }; - c2.Orders2.AddRange(new[] { o221, o222 }); - c2.Orders3.AddRange(new[] { o231, o232 }); + c2.Orders2.AddRange([o221, o222]); + c2.Orders3.AddRange([o231, o232]); c2.Orders4.Add(o241); Customers.AddRange(c1, c2); @@ -400,17 +398,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity().HasBaseType(); modelBuilder.Entity(); - modelBuilder.Entity( - entity => - { - entity.Property("Discriminator").HasMaxLength(63); - entity.HasIndex("Discriminator"); - entity.HasOne(m => m.Teacher) - .WithMany(m => m.Students) - .HasForeignKey(m => m.TeacherId) - .HasPrincipalKey(m => m.Id) - .OnDelete(DeleteBehavior.Restrict); - }); + modelBuilder.Entity(entity => + { + entity.Property("Discriminator").HasMaxLength(63); + entity.HasIndex("Discriminator"); + entity.HasOne(m => m.Teacher) + .WithMany(m => m.Students) + .HasForeignKey(m => m.TeacherId) + .HasPrincipalKey(m => m.Id) + .OnDelete(DeleteBehavior.Restrict); + }); } public Task SeedAsync() @@ -507,8 +504,8 @@ public Task SeedAsync() var c13 = new Child10635 { Name = "Child113" }; var c21 = new Child10635 { Name = "Child121" }; - var p1 = new Parent10635 { Name = "Parent1", Children = new[] { c11, c12, c13 } }; - var p2 = new Parent10635 { Name = "Parent2", Children = new[] { c21 } }; + var p1 = new Parent10635 { Name = "Parent1", Children = [c11, c12, c13] }; + var p2 = new Parent10635 { Name = "Parent2", Children = [c21] }; Parents.AddRange(p1, p2); Children.AddRange(c11, c12, c13, c21); return SaveChangesAsync(); @@ -544,32 +541,28 @@ public virtual async Task Collection_without_setter_materialized_correctly() var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); using var context = contextFactory.CreateContext(); var query1 = context.Blogs - .Select( - b => new - { - Collection1 = b.Posts1, - Collection2 = b.Posts2, - Collection3 = b.Posts3 - }).ToList(); + .Select(b => new + { + Collection1 = b.Posts1, + Collection2 = b.Posts2, + Collection3 = b.Posts3 + }).ToList(); var query2 = context.Blogs - .Select( - b => new - { - Collection1 = b.Posts1.OrderBy(p => p.Id).First().Comments.Count, - Collection2 = b.Posts2.OrderBy(p => p.Id).First().Comments.Count, - Collection3 = b.Posts3.OrderBy(p => p.Id).First().Comments.Count - }).ToList(); + .Select(b => new + { + Collection1 = b.Posts1.OrderBy(p => p.Id).First().Comments.Count, + Collection2 = b.Posts2.OrderBy(p => p.Id).First().Comments.Count, + Collection3 = b.Posts3.OrderBy(p => p.Id).First().Comments.Count + }).ToList(); - Assert.Throws( - () => context.Blogs - .Select( - b => new - { - Collection1 = b.Posts1.OrderBy(p => p.Id), - Collection2 = b.Posts2.OrderBy(p => p.Id), - Collection3 = b.Posts3.OrderBy(p => p.Id) - }).ToList()); + Assert.Throws(() => context.Blogs + .Select(b => new + { + Collection1 = b.Posts1.OrderBy(p => p.Id), + Collection2 = b.Posts2.OrderBy(p => p.Id), + Collection3 = b.Posts3.OrderBy(p => p.Id) + }).ToList()); } // Protected so that it can be used by inheriting tests, and so that things like unused setters are not removed. @@ -581,13 +574,12 @@ protected class Context11923(DbContextOptions options) : DbContext(options) protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity( - b => - { - b.HasMany(e => e.Posts1).WithOne().HasForeignKey("BlogId1"); - b.HasMany(e => e.Posts2).WithOne().HasForeignKey("BlogId2"); - b.HasMany(e => e.Posts3).WithOne().HasForeignKey("BlogId3"); - }); + modelBuilder.Entity(b => + { + b.HasMany(e => e.Posts1).WithOne().HasForeignKey("BlogId1"); + b.HasMany(e => e.Posts2).WithOne().HasForeignKey("BlogId2"); + b.HasMany(e => e.Posts3).WithOne().HasForeignKey("BlogId3"); + }); modelBuilder.Entity(); } @@ -611,12 +603,12 @@ public Task SeedAsync() var b1 = new Blog { Name = "B1" }; var b2 = new Blog { Name = "B2" }; - b1.Posts1.AddRange(new[] { p111, p112 }); - b1.Posts2.AddRange(new[] { p121, p122, p123 }); + b1.Posts1.AddRange([p111, p112]); + b1.Posts2.AddRange([p121, p122, p123]); b1.Posts3.Add(p131); - b2.Posts1.AddRange(new[] { p211, p212 }); - b2.Posts2.AddRange(new[] { p221, p222, p223 }); + b2.Posts1.AddRange([p211, p212]); + b2.Posts2.AddRange([p221, p222, p223]); b2.Posts3.Add(p231); Blogs.AddRange(b1, b2); @@ -743,23 +735,21 @@ public virtual async Task Let_multiple_references_with_reference_to_outer() using (var context = contextFactory.CreateContext()) { var users = context.Activities - .Select( - a => new - { - Activity = a, - CompetitionSeason = context.CompetitionSeasons - .First(s => s.StartDate <= a.DateTime && a.DateTime < s.EndDate) - }) - .Select( - a => new - { - a.Activity, - CompetitionSeasonId = a.CompetitionSeason.Id, - Points = a.Activity.Points - ?? a.Activity.ActivityType.Points - .Where(p => p.CompetitionSeason == a.CompetitionSeason) - .Select(p => p.Points).SingleOrDefault() - }).ToList(); + .Select(a => new + { + Activity = a, + CompetitionSeason = context.CompetitionSeasons + .First(s => s.StartDate <= a.DateTime && a.DateTime < s.EndDate) + }) + .Select(a => new + { + a.Activity, + CompetitionSeasonId = a.CompetitionSeason.Id, + Points = a.Activity.Points + ?? a.Activity.ActivityType.Points + .Where(p => p.CompetitionSeason == a.CompetitionSeason) + .Select(p => p.Points).SingleOrDefault() + }).ToList(); } } @@ -898,12 +888,7 @@ public virtual async Task Correlated_collection_correctly_associates_entities_wi var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); using var context = contextFactory.CreateContext(); var query = from blog in context.Blogs - select new - { - blog.Name, - Comments = blog.Comments.Select( - u => new { u.Id }).ToArray() - }; + select new { blog.Name, Comments = blog.Comments.Select(u => new { u.Id }).ToArray() }; var result = query.ToList(); Assert.Single(result[0].Comments); } @@ -1003,17 +988,15 @@ public virtual async Task SelectMany_and_collection_in_projection_in_FirstOrDefa var customerId = new Guid("1115c816-6c4c-4016-94df-d8b60a22ffa1"); var query = context.Orders .Where(o => o.ExternalReferenceId == referenceId && o.CustomerId == customerId) - .Select( - o => new + .Select(o => new + { + IdentityDocuments = o.IdentityDocuments.Select(id => new { - IdentityDocuments = o.IdentityDocuments.Select( - id => new - { - Images = o.IdentityDocuments - .SelectMany(id => id.Images) - .Select(i => new { i.Image }), - }) - }).SingleOrDefault(); + Images = o.IdentityDocuments + .SelectMany(id => id.Images) + .Select(i => new { i.Image }), + }) + }).SingleOrDefault(); } // Protected so that it can be used by inheriting tests, and so that things like unused setters are not removed. @@ -1081,8 +1064,7 @@ public virtual async Task Using_explicit_interface_implementation_as_navigation_ Expression> projection = b => new Context21768.BookViewModel { - FirstPage = b.FrontCover.Illustrations.FirstOrDefault( - i => i.State >= Context21768.IllustrationState.Approved) + FirstPage = b.FrontCover.Illustrations.FirstOrDefault(i => i.State >= Context21768.IllustrationState.Approved) != null ? new Context21768.PageViewModel { @@ -1376,8 +1358,7 @@ public virtual async Task Walking_back_include_tree_is_not_allowed_1() CoreResources.LogNavigationBaseIncludeIgnored(new TestLogger()) .GenerateMessage("ManyDependent.Principal"), "CoreEventId.NavigationBaseIncludeIgnored"), - Assert.Throws( - () => query.ToList()).Message); + Assert.Throws(() => query.ToList()).Message); } } @@ -1396,8 +1377,7 @@ public virtual async Task Walking_back_include_tree_is_not_allowed_2() CoreResources.LogNavigationBaseIncludeIgnored(new TestLogger()) .GenerateMessage("SingleDependent.Principal"), "CoreEventId.NavigationBaseIncludeIgnored"), - Assert.Throws( - () => query.ToList()).Message); + Assert.Throws(() => query.ToList()).Message); } } @@ -1431,8 +1411,7 @@ public virtual async Task Walking_back_include_tree_is_not_allowed_4() CoreResources.LogNavigationBaseIncludeIgnored(new TestLogger()) .GenerateMessage("ManyDependent.SingleDependent"), "CoreEventId.NavigationBaseIncludeIgnored"), - Assert.Throws( - () => query.ToList()).Message); + Assert.Throws(() => query.ToList()).Message); } } @@ -1485,39 +1464,36 @@ public virtual async Task Projection_with_multiple_includes_and_subquery_with_se .Include(p => p.Director) .ThenInclude(a => a.Movies) .ThenInclude(p => p.Movie) - .Select( - x => new - { - x.Id, - x.Name, - x.Surname, - x.Birthday, - x.Hometown, - x.Bio, - x.AvatarUrl, - Images = x.Images - .Select( - i => new - { - i.Id, - i.ImageUrl, - i.Height, - i.Width - }).ToList(), - KnownByFilms = x.Actor.Movies - .Select(m => m.Movie) - .Union( - x.Director.Movies - .Select(m => m.Movie)) - .Select( - m => new - { - m.Id, - m.Name, - m.PosterUrl, - m.Rating - }).ToList() - }) + .Select(x => new + { + x.Id, + x.Name, + x.Surname, + x.Birthday, + x.Hometown, + x.Bio, + x.AvatarUrl, + Images = x.Images + .Select(i => new + { + i.Id, + i.ImageUrl, + i.Height, + i.Width + }).ToList(), + KnownByFilms = x.Actor.Movies + .Select(m => m.Movie) + .Union( + x.Director.Movies + .Select(m => m.Movie)) + .Select(m => new + { + m.Id, + m.Name, + m.PosterUrl, + m.Rating + }).ToList() + }) .FirstOrDefaultAsync(x => x.Id == id); } @@ -1613,8 +1589,7 @@ public class MovieEntity #region 26433 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Count_member_over_IReadOnlyCollection_works(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); diff --git a/test/EFCore.Specification.Tests/Query/AdHocQueryFiltersQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/AdHocQueryFiltersQueryTestBase.cs index 239aa97d99b..412b9508dd2 100644 --- a/test/EFCore.Specification.Tests/Query/AdHocQueryFiltersQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/AdHocQueryFiltersQueryTestBase.cs @@ -5,7 +5,8 @@ namespace Microsoft.EntityFrameworkCore.Query; #nullable disable -public abstract class AdHocQueryFiltersQueryTestBase(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture +public abstract class AdHocQueryFiltersQueryTestBase(NonSharedFixture fixture) + : NonSharedModelTestBase(fixture), IClassFixture { protected override string StoreName => "AdHocQueryFiltersQueryTests"; @@ -71,7 +72,9 @@ public virtual async Task Named_query_filters_anonymous_ignore() [ConditionalFact] public virtual async Task Named_query_filters_combined() { - var exception = await Assert.ThrowsAsync(async () => await InitializeAsync(seed: c => c.SeedAsync())); + var exception = + await Assert.ThrowsAsync(async () + => await InitializeAsync(seed: c => c.SeedAsync())); Assert.Equal(exception.Message, CoreStrings.AnonymousAndNamedFiltersCombined); } @@ -312,16 +315,15 @@ public virtual async Task Query_filter_with_pk_fk_optimization() { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); using var context = contextFactory.CreateContext(); - context.Entities.Select( - s => - new Context13517.EntityDto13517 - { - Id = s.Id, - RefEntity = s.RefEntity == null - ? null - : new Context13517.RefEntityDto13517 { Id = s.RefEntity.Id, Public = s.RefEntity.Public }, - RefEntityId = s.RefEntityId - }).Single(p => p.Id == 1); + context.Entities.Select(s => + new Context13517.EntityDto13517 + { + Id = s.Id, + RefEntity = s.RefEntity == null + ? null + : new Context13517.RefEntityDto13517 { Id = s.RefEntity.Id, Public = s.RefEntity.Public }, + RefEntityId = s.RefEntityId + }).Single(p => p.Id == 1); } protected class Context13517(DbContextOptions options) : DbContext(options) @@ -575,8 +577,7 @@ public class User18759 #nullable enable - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task IsDeleted_query_filter_with_conversion_to_int_works(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); @@ -657,8 +658,7 @@ protected class Location #region 27163 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Group_by_multiple_aggregate_joining_different_tables(bool async) { var contextFactory = await InitializeAsync(); @@ -666,26 +666,24 @@ public virtual async Task Group_by_multiple_aggregate_joining_different_tables(b var query = context.Parents .GroupBy(x => new { }) - .Select( - g => new - { - Test1 = g - .Select(x => x.Child1.Value1) - .Distinct() - .Count(), - Test2 = g - .Select(x => x.Child2.Value2) - .Distinct() - .Count() - }); + .Select(g => new + { + Test1 = g + .Select(x => x.Child1.Value1) + .Distinct() + .Count(), + Test2 = g + .Select(x => x.Child2.Value2) + .Distinct() + .Count() + }); var orders = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Group_by_multiple_aggregate_joining_different_tables_with_query_filter(bool async) { var contextFactory = await InitializeAsync(); @@ -693,18 +691,17 @@ public virtual async Task Group_by_multiple_aggregate_joining_different_tables_w var query = context.Parents .GroupBy(x => new { }) - .Select( - g => new - { - Test1 = g - .Select(x => x.ChildFilter1.Value1) - .Distinct() - .Count(), - Test2 = g - .Select(x => x.ChildFilter2.Value2) - .Distinct() - .Count() - }); + .Select(g => new + { + Test1 = g + .Select(x => x.ChildFilter1.Value1) + .Distinct() + .Count(), + Test2 = g + .Select(x => x.ChildFilter2.Value2) + .Distinct() + .Count() + }); var orders = async ? await query.ToListAsync() @@ -761,16 +758,15 @@ public class ChildFilter2 #region 35111 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Query_filter_with_context_accessor_with_constant(bool async) { var contextFactory = await InitializeAsync(); using var context = contextFactory.CreateContext(); var data = async - ? await context.Set().ToListAsync() - : context.Set().ToList(); + ? await context.Set().ToListAsync() + : context.Set().ToList(); } protected class Context35111(DbContextOptions options) : DbContext(options) @@ -780,13 +776,11 @@ protected class Context35111(DbContextOptions options) : DbContext(options) public List Baz { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity() + => modelBuilder.Entity() .HasQueryFilter(e => Foo == 1 ? Baz.Contains(e.Bar) : e.Bar == Bar); - } } public class FooBar35111 diff --git a/test/EFCore.Specification.Tests/Query/ComplexNavigationsCollectionsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/ComplexNavigationsCollectionsQueryTestBase.cs index 7c18447c42f..c0f10dfaf6e 100644 --- a/test/EFCore.Specification.Tests/Query/ComplexNavigationsCollectionsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/ComplexNavigationsCollectionsQueryTestBase.cs @@ -16,8 +16,7 @@ protected ComplexNavigationsContext CreateContext() protected override Expression RewriteExpectedQueryExpression(Expression expectedQueryExpression) => new ExpectedQueryRewritingVisitor(Fixture.GetShadowPropertyMappings()).Visit(expectedQueryExpression); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nav_prop_collection_one_to_many_required(bool async) => AssertQuery( async, @@ -25,20 +24,19 @@ public virtual Task Select_nav_prop_collection_one_to_many_required(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_with_other_query_operators_composed_on_top(bool async) => AssertQuery( async, - ss => from l4 in ss.Set().SelectMany( - l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) - join l2 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2 - .DefaultIfEmpty()) + ss => from l4 in ss.Set() + .SelectMany(l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) + join l2 in ss.Set().SelectMany(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3 + .OneToMany_Required_Self2 + .DefaultIfEmpty()) on l4.Id equals l2.Id - join l3 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty()) + join l3 in ss.Set().SelectMany(l4 + => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty()) on l2.Id equals l3.Id into grouping from l3 in grouping.DefaultIfEmpty() where l4.OneToMany_Optional_Inverse4.Name != "Foo" @@ -49,14 +47,14 @@ orderby l2.OneToOne_Optional_FK2.Id Collection = l2.OneToMany_Optional_Self2.Where(e => e.Id != 42).ToList(), Property = l3.OneToOne_Optional_FK_Inverse3.OneToOne_Required_FK2.Name }, - ss => from l4 in ss.Set().SelectMany( - l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) - join l2 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2 - .DefaultIfEmpty()) + ss => from l4 in ss.Set() + .SelectMany(l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) + join l2 in ss.Set().SelectMany(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3 + .OneToMany_Required_Self2 + .DefaultIfEmpty()) on l4.Id equals l2.Id - join l3 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty()) + join l3 in ss.Set().SelectMany(l4 + => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty()) on l2.Id equals l3.Id into grouping from l3 in grouping.DefaultIfEmpty() where l4.OneToMany_Optional_Inverse4.Name != "Foo" @@ -75,8 +73,7 @@ orderby l2.OneToOne_Optional_FK2.MaybeScalar(x => x.Id) Assert.Equal(e.Property, a.Property); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation(bool async) => AssertQuery( async, @@ -85,8 +82,7 @@ public virtual Task Project_collection_navigation(bool async) elementSorter: e => e != null ? e.Count : 0, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_nested(bool async) => AssertQuery( async, @@ -97,8 +93,7 @@ public virtual Task Project_collection_navigation_nested(bool async) elementSorter: e => e.Count, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_nested_with_take(bool async) => AssertQuery( async, @@ -109,8 +104,7 @@ select l1.OneToOne_Optional_FK1.OneToMany_Optional2.Take(50), elementSorter: e => e?.Count() ?? 0, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_using_ef_property(bool async) => AssertQuery( async, @@ -123,8 +117,7 @@ select EF.Property>( elementSorter: e => e?.Count ?? 0, elementAsserter: (e, a) => AssertCollection(e ?? new List(), a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_nested_anonymous(bool async) => AssertQuery( async, @@ -137,8 +130,7 @@ public virtual Task Project_collection_navigation_nested_anonymous(bool async) AssertCollection(e.OneToMany_Optional2 ?? new List(), a.OneToMany_Optional2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_composed(bool async) => AssertQuery( async, @@ -152,8 +144,7 @@ where l1.Id < 3 AssertCollection(e.collection, a.collection); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_and_root_entity(bool async) => AssertQuery( async, @@ -166,8 +157,7 @@ public virtual Task Project_collection_and_root_entity(bool async) AssertCollection(e.OneToMany_Optional1, a.OneToMany_Optional1); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_and_include(bool async) => AssertQuery( async, @@ -180,8 +170,7 @@ public virtual Task Project_collection_and_include(bool async) AssertCollection(e.OneToMany_Optional1, a.OneToMany_Optional1); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_navigation_and_collection(bool async) => AssertQuery( async, @@ -194,8 +183,7 @@ public virtual Task Project_navigation_and_collection(bool async) AssertCollection(e.OneToMany_Optional2 ?? new List(), a.OneToMany_Optional2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_inside_subquery(bool async) => AssertQuery( async, @@ -206,44 +194,38 @@ public virtual Task Include_inside_subquery(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.subquery, a.subquery)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_check_in_anonymous_type_projection_should_not_be_removed(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(l1 => l1.Id).Select( - l1 => new + ss => ss.Set().OrderBy(l1 => l1.Id).Select(l1 => new + { + Level2s = l1.OneToMany_Optional1.Select(l2 => new { - Level2s = l1.OneToMany_Optional1.Select( - l2 => new - { - Level3 = l2.OneToOne_Required_FK2 == null - ? null - : new { l2.OneToOne_Required_FK2.Name } - }).ToList() - }), + Level3 = l2.OneToOne_Required_FK2 == null + ? null + : new { l2.OneToOne_Required_FK2.Name } + }).ToList() + }), assertOrder: true, elementAsserter: (e, a) => AssertCollection( e.Level2s, a.Level2s, elementSorter: ee => ee?.Level3.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_check_in_Dto_projection_should_not_be_removed(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(l1 => l1.Id).Select( - l1 => new + ss => ss.Set().OrderBy(l1 => l1.Id).Select(l1 => new + { + Level2s = l1.OneToMany_Optional1.Select(l2 => new { - Level2s = l1.OneToMany_Optional1.Select( - l2 => new - { - Level3 = l2.OneToOne_Required_FK2 == null - ? null - : new ProjectedDto { Value = l2.OneToOne_Required_FK2.Name } - }).ToList() - }), + Level3 = l2.OneToOne_Required_FK2 == null + ? null + : new ProjectedDto { Value = l2.OneToOne_Required_FK2.Name } + }).ToList() + }), assertOrder: true, elementAsserter: (e, a) => AssertCollection( e.Level2s, @@ -256,8 +238,7 @@ private class ProjectedDto public T Value { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_navigation_property_followed_by_select_collection_navigation(bool async) => AssertQuery( async, @@ -269,8 +250,7 @@ public virtual Task SelectMany_navigation_property_followed_by_select_collection AssertCollection(e.OneToMany_Optional2, a.OneToMany_Optional2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_SelectMany_navigation_property_followed_by_select_collection_navigation(bool async) => AssertQuery( async, @@ -283,8 +263,7 @@ public virtual Task Multiple_SelectMany_navigation_property_followed_by_select_c AssertCollection(e.OneToMany_Optional3, a.OneToMany_Optional3); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_navigation_property_with_include_and_followed_by_select_collection_navigation(bool async) => AssertQuery( async, @@ -300,20 +279,18 @@ public virtual Task SelectMany_navigation_property_with_include_and_followed_by_ AssertCollection(e.OneToMany_Optional2, a.OneToMany_Optional2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Lift_projection_mapping_when_pushing_down_subquery(bool async) => AssertQuery( async, ss => ss.Set() .Take(25) - .Select( - l1 => new - { - l1.Id, - c1 = l1.OneToMany_Required1.Select(l2 => new { l2.Id }).FirstOrDefault(), - c2 = l1.OneToMany_Required1.Select(l2 => new { l2.Id }) - }), + .Select(l1 => new + { + l1.Id, + c1 = l1.OneToMany_Required1.Select(l2 => new { l2.Id }).FirstOrDefault(), + c2 = l1.OneToMany_Required1.Select(l2 => new { l2.Id }) + }), elementSorter: t => t.Id, elementAsserter: (e, a) => { @@ -322,18 +299,16 @@ public virtual Task Lift_projection_mapping_when_pushing_down_subquery(bool asyn AssertCollection(e.c2, a.c2, elementSorter: i => i.Id, elementAsserter: (ie, ia) => Assert.Equal(ie.Id, ia.Id)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_single_nested_subquery(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(l1 => l1.Id).Select( - l1 => new - { - Level2 = l1.OneToMany_Optional1.OrderBy(l2 => l2.Id).Select( - l2 => new { Level3s = l2.OneToMany_Optional2.OrderBy(l3 => l3.Id).Select(l3 => new { l3.Id }).ToList() }) - .FirstOrDefault() - }), + ss => ss.Set().OrderBy(l1 => l1.Id).Select(l1 => new + { + Level2 = l1.OneToMany_Optional1.OrderBy(l2 => l2.Id).Select(l2 + => new { Level3s = l2.OneToMany_Optional2.OrderBy(l3 => l3.Id).Select(l3 => new { l3.Id }).ToList() }) + .FirstOrDefault() + }), assertOrder: true, elementAsserter: (e, a) => { @@ -347,25 +322,21 @@ public virtual Task Select_subquery_single_nested_subquery(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_single_nested_subquery2(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(l1 => l1.Id).Select( - l1 => new + ss => ss.Set().OrderBy(l1 => l1.Id).Select(l1 => new + { + Level2s = l1.OneToMany_Optional1.OrderBy(l2 => l2.Id).Select(l2 => new { - Level2s = l1.OneToMany_Optional1.OrderBy(l2 => l2.Id).Select( - l2 => new - { - Level3 = l2.OneToMany_Optional2.OrderBy(l3 => l3.Id).Select( - l3 => new - { - Level4s = l3.OneToMany_Optional3.OrderBy(l4 => l4.Id).Select(l4 => new { l4.Id }) - .ToList() - }).FirstOrDefault() - }) - }), + Level3 = l2.OneToMany_Optional2.OrderBy(l3 => l3.Id).Select(l3 => new + { + Level4s = l3.OneToMany_Optional3.OrderBy(l4 => l4.Id).Select(l4 => new { l4.Id }) + .ToList() + }).FirstOrDefault() + }) + }), assertOrder: true, elementAsserter: (e, a) => { @@ -384,8 +355,7 @@ public virtual Task Select_subquery_single_nested_subquery2(bool async) }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Queryable_in_subquery_works_when_final_projection_is_List(bool async) => AssertInvalidMaterializationType( () => @@ -404,8 +374,7 @@ select inner.ToList(), elementAsserter: (e, a) => AssertCollection(e, a)), typeof(IQueryable).ShortDisplayName()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(bool async) => AssertQuery( async, @@ -421,8 +390,7 @@ select inner.ToList(), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_let_collection_projection_FirstOrDefault(bool async) => AssertQuery( async, @@ -438,19 +406,18 @@ select innerL1s.ToList()).FirstOrDefault() assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_DefaultIfEmpty_multiple_times_with_joins_projecting_a_collection(bool async) => AssertQuery( async, - ss => from l4 in ss.Set().SelectMany( - l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) - join l2 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2 - .DefaultIfEmpty()) on + ss => from l4 in ss.Set() + .SelectMany(l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) + join l2 in ss.Set().SelectMany(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3 + .OneToMany_Required_Self2 + .DefaultIfEmpty()) on l4.Id equals l2.Id - join l3 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty()) on + join l3 in ss.Set().SelectMany(l4 + => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty()) on l2.Id equals l3.Id into grouping from l3 in grouping.DefaultIfEmpty() where l4.OneToMany_Optional_Inverse4.Name != "Foo" @@ -461,14 +428,14 @@ orderby l2.OneToOne_Optional_FK2.Id Collection = l2.OneToMany_Optional_Self2.Where(e => e.Id != 42).ToList(), Property = l3.OneToOne_Optional_FK_Inverse3.OneToOne_Required_FK2.Name }, - ss => from l4 in ss.Set().SelectMany( - l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) - join l2 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2 - .DefaultIfEmpty()) on + ss => from l4 in ss.Set() + .SelectMany(l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) + join l2 in ss.Set().SelectMany(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3 + .OneToMany_Required_Self2 + .DefaultIfEmpty()) on l4.Id equals l2.Id - join l3 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty()) on + join l3 in ss.Set().SelectMany(l4 + => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty()) on l2.Id equals l3.Id into grouping from l3 in grouping.DefaultIfEmpty() where l4.OneToMany_Optional_Inverse4.Name != "Foo" @@ -487,28 +454,25 @@ orderby l2.OneToOne_Optional_FK2.MaybeScalar(e => e.Id) AssertEqual(e.Property, a.Property); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_Select_collection_Take(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(l1 => l1.Id).Take(1) - .Select( - l1 => new - { - l1.Id, - l1.Name, - Level2s = l1.OneToMany_Required1.OrderBy(l2 => l2.Id).Take(3) - .Select( - l2 => new - { - l2.Id, - l2.Name, - Level1Id = EF.Property(l2, "OneToMany_Required_Inverse2Id"), - Level2Id = l2.Level1_Required_Id, - Level2 = l2.OneToOne_Required_FK_Inverse2 - }) - }), + .Select(l1 => new + { + l1.Id, + l1.Name, + Level2s = l1.OneToMany_Required1.OrderBy(l2 => l2.Id).Take(3) + .Select(l2 => new + { + l2.Id, + l2.Name, + Level1Id = EF.Property(l2, "OneToMany_Required_Inverse2Id"), + Level2Id = l2.Level1_Required_Id, + Level2 = l2.OneToOne_Required_FK_Inverse2 + }) + }), assertOrder: true, elementAsserter: (e, a) => { @@ -526,28 +490,25 @@ public virtual Task Take_Select_collection_Take(bool async) }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_Select_collection_Skip_Take(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(l1 => l1.Id).Skip(1).Take(1) - .Select( - l1 => new - { - l1.Id, - l1.Name, - Level2s = l1.OneToMany_Required1.OrderBy(l2 => l2.Id).Skip(1).Take(3) - .Select( - l2 => new - { - l2.Id, - l2.Name, - Level1Id = EF.Property(l2, "OneToMany_Required_Inverse2Id"), - Level2Id = l2.Level1_Required_Id, - Level2 = l2.OneToOne_Required_FK_Inverse2 - }) - }), + .Select(l1 => new + { + l1.Id, + l1.Name, + Level2s = l1.OneToMany_Required1.OrderBy(l2 => l2.Id).Skip(1).Take(3) + .Select(l2 => new + { + l2.Id, + l2.Name, + Level1Id = EF.Property(l2, "OneToMany_Required_Inverse2Id"), + Level2Id = l2.Level1_Required_Id, + Level2 = l2.OneToOne_Required_FK_Inverse2 + }) + }), assertOrder: true, elementAsserter: (e, a) => { @@ -565,8 +526,7 @@ public virtual Task Skip_Take_Select_collection_Skip_Take(bool async) }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multi_level_include_one_to_many_optional_and_one_to_many_optional_produces_valid_sql(bool async) => AssertQuery( async, @@ -576,8 +536,7 @@ public virtual Task Multi_level_include_one_to_many_optional_and_one_to_many_opt new ExpectedInclude(l1 => l1.OneToMany_Optional1), new ExpectedInclude(l2 => l2.OneToMany_Optional2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multi_level_include_correct_PK_is_chosen_as_the_join_predicate_for_queries_that_join_same_table_multiple_times( bool async) => AssertQuery( @@ -592,8 +551,7 @@ public virtual Task Multi_level_include_correct_PK_is_chosen_as_the_join_predica new ExpectedInclude( l2 => l2.OneToMany_Optional2, "OneToMany_Optional1.OneToMany_Optional2.OneToMany_Required_Inverse3"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_complex_includes(bool async) => AssertQuery( async, @@ -609,8 +567,7 @@ public virtual Task Multiple_complex_includes(bool async) new ExpectedInclude(l1 => l1.OneToMany_Optional1), new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_complex_includes_EF_Property(bool async) => AssertQuery( async, @@ -626,8 +583,7 @@ public virtual Task Multiple_complex_includes_EF_Property(bool async) new ExpectedInclude(l1 => l1.OneToMany_Optional1), new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_complex_includes_self_ref(bool async) => AssertQuery( async, @@ -642,8 +598,7 @@ public virtual Task Multiple_complex_includes_self_ref(bool async) new ExpectedInclude(l1 => l1.OneToMany_Optional_Self1), new ExpectedInclude(l2 => l2.OneToOne_Optional_Self1, "OneToMany_Optional_Self1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_complex_includes_self_ref_EF_Property(bool async) => AssertQuery( async, @@ -658,8 +613,7 @@ public virtual Task Multiple_complex_includes_self_ref_EF_Property(bool async) new ExpectedInclude(l1 => l1.OneToMany_Optional_Self1), new ExpectedInclude(l2 => l2.OneToOne_Optional_Self1, "OneToMany_Optional_Self1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_and_collection_order_by(bool async) => AssertQuery( async, @@ -671,8 +625,7 @@ public virtual Task Include_reference_and_collection_order_by(bool async) e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1), new ExpectedInclude(l2 => l2.OneToMany_Optional2, "OneToOne_Optional_FK1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_ThenInclude_collection_order_by(bool async) => AssertQuery( async, @@ -685,8 +638,7 @@ public virtual Task Include_reference_ThenInclude_collection_order_by(bool async e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1), new ExpectedInclude(l2 => l2.OneToMany_Optional2, "OneToOne_Optional_FK1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_then_reference(bool async) => AssertQuery( async, @@ -697,8 +649,7 @@ public virtual Task Include_collection_then_reference(bool async) e, a, new ExpectedInclude(l1 => l1.OneToMany_Optional1), new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_conditional_order_by(bool async) => AssertQuery( async, @@ -709,8 +660,7 @@ public virtual Task Include_collection_with_conditional_order_by(bool async) elementSorter: e => e.Id, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(ee => ee.OneToMany_Optional1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_complex_include_select(bool async) => AssertQuery( async, @@ -725,8 +675,7 @@ public virtual Task Multiple_complex_include_select(bool async) new ExpectedInclude(l1 => l1.OneToMany_Optional1), new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_nested_with_optional_navigation(bool async) => AssertQuery( async, @@ -740,8 +689,7 @@ public virtual Task Include_nested_with_optional_navigation(bool async) new ExpectedInclude(l1 => l1.OneToMany_Required2, "OneToOne_Optional_FK1"), new ExpectedInclude(l1 => l1.OneToOne_Required_FK3, "OneToOne_Optional_FK1.OneToMany_Required2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_multi_include_with_order_by_and_paging(bool async) => AssertQuery( async, @@ -755,8 +703,7 @@ public virtual Task Complex_multi_include_with_order_by_and_paging(bool async) new ExpectedInclude(l1 => l1.OneToMany_Optional2, "OneToOne_Required_FK1"), new ExpectedInclude(l1 => l1.OneToMany_Required2, "OneToOne_Required_FK1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_multi_include_with_order_by_and_paging_joins_on_correct_key(bool async) => AssertQuery( async, @@ -771,8 +718,7 @@ public virtual Task Complex_multi_include_with_order_by_and_paging_joins_on_corr new ExpectedInclude(l1 => l1.OneToOne_Required_FK1), new ExpectedInclude(l2 => l2.OneToMany_Required2, "OneToOne_Required_FK1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_multi_include_with_order_by_and_paging_joins_on_correct_key2(bool async) => AssertQuery( async, @@ -785,8 +731,7 @@ public virtual Task Complex_multi_include_with_order_by_and_paging_joins_on_corr new ExpectedInclude(l2 => l2.OneToOne_Required_FK2, "OneToOne_Optional_FK1"), new ExpectedInclude(l3 => l3.OneToMany_Optional3, "OneToOne_Optional_FK1.OneToOne_Required_FK2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_include_with_multiple_optional_navigations(bool async) => AssertQuery( async, @@ -804,8 +749,7 @@ public virtual Task Multiple_include_with_multiple_optional_navigations(bool asy new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2, "OneToOne_Optional_FK1")), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_Include1(bool async) => AssertQuery( async, @@ -814,8 +758,7 @@ public virtual Task SelectMany_with_Include1(bool async) .Include(l2 => l2.OneToMany_Optional2), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToMany_Optional2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Orderby_SelectMany_with_Include1(bool async) => AssertQuery( async, @@ -824,8 +767,7 @@ public virtual Task Orderby_SelectMany_with_Include1(bool async) .Include(l2 => l2.OneToMany_Optional2), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToMany_Optional2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_Include2(bool async) => AssertQuery( async, @@ -834,8 +776,7 @@ public virtual Task SelectMany_with_Include2(bool async) .Include(l2 => l2.OneToOne_Required_FK2), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Required_FK2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_Include_ThenInclude(bool async) => AssertQuery( async, @@ -847,8 +788,7 @@ public virtual Task SelectMany_with_Include_ThenInclude(bool async) e, a, new ExpectedInclude(l2 => l2.OneToOne_Required_FK2), new ExpectedInclude(l3 => l3.OneToMany_Optional3, "OneToOne_Required_FK2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_SelectMany_with_Include(bool async) => AssertQuery( async, @@ -861,8 +801,7 @@ public virtual Task Multiple_SelectMany_with_Include(bool async) e, a, new ExpectedInclude(l3 => l3.OneToOne_Required_FK3), new ExpectedInclude(l3 => l3.OneToMany_Optional3))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Required_navigation_with_Include(bool async) => AssertQuery( async, @@ -871,8 +810,7 @@ public virtual Task Required_navigation_with_Include(bool async) .Select(l3 => l3.OneToOne_Required_FK_Inverse3), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToMany_Required_Inverse2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Required_navigation_with_Include_ThenInclude(bool async) => AssertQuery( async, @@ -884,8 +822,7 @@ public virtual Task Required_navigation_with_Include_ThenInclude(bool async) e, a, new ExpectedInclude(l3 => l3.OneToMany_Required_Inverse3), new ExpectedInclude(l2 => l2.OneToMany_Optional_Inverse2, "OneToMany_Required_Inverse3"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_with_Include_ThenInclude(bool async) => AssertQuery( async, @@ -897,8 +834,7 @@ public virtual Task Optional_navigation_with_Include_ThenInclude(bool async) e, a, new ExpectedInclude(l2 => l2.OneToMany_Optional2), new ExpectedInclude(l3 => l3.OneToOne_Optional_FK3, "OneToMany_Optional2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_optional_navigation_with_Include(bool async) => AssertQuery( async, @@ -907,8 +843,7 @@ public virtual Task Multiple_optional_navigation_with_Include(bool async) .Select(l1 => l1.OneToOne_Optional_FK1.OneToOne_Optional_PK2), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l3 => l3.OneToMany_Optional3))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_optional_navigation_with_string_based_Include(bool async) => AssertQuery( async, @@ -918,8 +853,7 @@ public virtual Task Multiple_optional_navigation_with_string_based_Include(bool .Select(l2 => l2.OneToOne_Optional_PK2), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l3 => l3.OneToMany_Optional3))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_with_order_by_and_Include(bool async) => AssertQuery( async, @@ -930,8 +864,7 @@ public virtual Task Optional_navigation_with_order_by_and_Include(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToMany_Optional2)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_with_Include_and_order(bool async) => AssertQuery( async, @@ -942,8 +875,7 @@ public virtual Task Optional_navigation_with_Include_and_order(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToMany_Optional2)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_order_by_and_Include(bool async) => AssertQuery( async, @@ -954,8 +886,7 @@ public virtual Task SelectMany_with_order_by_and_Include(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToMany_Optional2)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_Include_and_order_by(bool async) => AssertQuery( async, @@ -966,8 +897,7 @@ public virtual Task SelectMany_with_Include_and_order_by(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToMany_Optional2)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_navigation_and_Distinct(bool async) => AssertQuery( async, @@ -977,24 +907,21 @@ from l2 in l1.OneToMany_Optional1.Distinct() select l1, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l1 => l1.OneToMany_Optional1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_navigation_and_Distinct_projecting_columns_including_join_key(bool async) => AssertQuery( async, ss => from l1 in ss.Set().Include(l => l.OneToMany_Optional1) - from l2 in l1.OneToMany_Optional1.Select( - x => new - { - x.Id, - x.Name, - FK = EF.Property(x, "OneToMany_Optional_Inverse2Id") - }).Distinct() + from l2 in l1.OneToMany_Optional1.Select(x => new + { + x.Id, + x.Name, + FK = EF.Property(x, "OneToMany_Optional_Inverse2Id") + }).Distinct() select l1, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l1 => l1.OneToMany_Optional1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_multiple_orderbys_member(bool async) => AssertQuery( async, @@ -1005,8 +932,7 @@ public virtual Task Include_collection_with_multiple_orderbys_member(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.OneToMany_Optional2)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_multiple_orderbys_property(bool async) => AssertQuery( async, @@ -1017,8 +943,7 @@ public virtual Task Include_collection_with_multiple_orderbys_property(bool asyn elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.OneToMany_Optional2)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_multiple_orderbys_methodcall(bool async) => AssertQuery( async, @@ -1029,8 +954,7 @@ public virtual Task Include_collection_with_multiple_orderbys_methodcall(bool as elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.OneToMany_Optional2)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_multiple_orderbys_complex(bool async) => AssertQuery( async, @@ -1041,8 +965,7 @@ public virtual Task Include_collection_with_multiple_orderbys_complex(bool async elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.OneToMany_Optional2)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_multiple_orderbys_complex_repeated(bool async) => AssertQuery( async, @@ -1053,8 +976,7 @@ public virtual Task Include_collection_with_multiple_orderbys_complex_repeated(b elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.OneToMany_Optional2)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_multiple_orderbys_complex_repeated_checked(bool async) { checked @@ -1070,8 +992,7 @@ public virtual Task Include_collection_with_multiple_orderbys_complex_repeated_c } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_groupby_in_subquery(bool async) => AssertQuery( async, @@ -1081,8 +1002,7 @@ public virtual Task Include_collection_with_groupby_in_subquery(bool async) .Select(g => g.OrderBy(e => e.Id).FirstOrDefault()), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.OneToMany_Optional1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_groupby_in_subquery_and_filter_before_groupby(bool async) => AssertQuery( async, @@ -1093,8 +1013,7 @@ public virtual Task Include_collection_with_groupby_in_subquery_and_filter_befor .Select(g => g.OrderBy(e => e.Id).FirstOrDefault()), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.OneToMany_Optional1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_groupby_in_subquery_and_filter_after_groupby(bool async) => AssertQuery( async, @@ -1105,8 +1024,7 @@ public virtual Task Include_collection_with_groupby_in_subquery_and_filter_after .Select(g => g.OrderBy(e => e.Id).FirstOrDefault()), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.OneToMany_Optional1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_collection_order_by_reference_navigation(bool async) => AssertQuery( async, @@ -1119,33 +1037,27 @@ public virtual Task Include_reference_collection_order_by_reference_navigation(b new ExpectedInclude(e => e.OneToMany_Optional2, "OneToOne_Optional_FK1")), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_after_Select(bool async) - => AssertIncludeOnNonEntity( - () => AssertQuery( - async, - ss => ss.Set().Select(l1 => l1.OneToOne_Optional_FK1).Include(l2 => l2.OneToMany_Optional2))); + => AssertIncludeOnNonEntity(() => AssertQuery( + async, + ss => ss.Set().Select(l1 => l1.OneToOne_Optional_FK1).Include(l2 => l2.OneToMany_Optional2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_after_SelectMany_and_reference_navigation(bool async) - => AssertIncludeOnNonEntity( - () => AssertQuery( - async, - ss => ss.Set().SelectMany(l1 => l1.OneToMany_Required1).Select(l2 => l2.OneToOne_Optional_FK2) - .Include(l3 => l3.OneToMany_Optional3))); + => AssertIncludeOnNonEntity(() => AssertQuery( + async, + ss => ss.Set().SelectMany(l1 => l1.OneToMany_Required1).Select(l2 => l2.OneToOne_Optional_FK2) + .Include(l3 => l3.OneToMany_Optional3))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_after_SelectMany(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(l1 => l1.OneToMany_Required1).Include(l2 => l2.OneToMany_Optional2), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.OneToMany_Optional2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_after_multiple_SelectMany_and_reference_navigation(bool async) => AssertQuery( async, @@ -1156,8 +1068,7 @@ public virtual Task Include_after_multiple_SelectMany_and_reference_navigation(b .Select(l3 => l3.OneToOne_Required_FK3), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l4 => l4.OneToMany_Required_Self4))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_after_SelectMany_and_multiple_reference_navigations(bool async) => AssertQuery( async, @@ -1168,16 +1079,14 @@ public virtual Task Include_after_SelectMany_and_multiple_reference_navigations( .Select(l3 => l3.OneToOne_Required_FK3), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l4 => l4.OneToMany_Optional_Self4))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection(bool async) => AssertQuery( async, ss => ss.Set().Include(l1 => l1.OneToMany_Optional1), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l3 => l3.OneToMany_Optional1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_followed_by_include_reference(bool async) => AssertQuery( async, @@ -1186,8 +1095,7 @@ public virtual Task Include_collection_followed_by_include_reference(bool async) e, a, new ExpectedInclude(e1 => e1.OneToMany_Optional1), new ExpectedInclude(e2 => e2.OneToOne_Optional_PK2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_followed_by_include_collection(bool async) => AssertQuery( async, @@ -1196,8 +1104,7 @@ public virtual Task Include_reference_followed_by_include_collection(bool async) e, a, new ExpectedInclude(e1 => e1.OneToOne_Optional_FK1), new ExpectedInclude(e2 => e2.OneToMany_Optional2, "OneToOne_Optional_FK1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_followed_by_projecting_the_included_collection(bool async) => AssertQuery( async, @@ -1205,8 +1112,7 @@ public virtual Task Include_collection_followed_by_projecting_the_included_colle assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_and_ThenInclude_collections_followed_by_projecting_the_first_collection(bool async) => AssertQuery( async, @@ -1221,8 +1127,7 @@ public virtual Task Include_and_ThenInclude_collections_followed_by_projecting_t a, elementAsserter: (ee, aa) => AssertInclude(ee, aa, new ExpectedInclude(x => x.OneToOne_Optional_PK2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_and_another_navigation_chain_followed_by_projecting_the_first_collection(bool async) => AssertQuery( async, @@ -1240,8 +1145,7 @@ public virtual Task Include_collection_and_another_navigation_chain_followed_by_ ee, aa, new ExpectedInclude(e1 => e1.OneToOne_Optional_PK2), new ExpectedInclude(e2 => e2.OneToOne_Optional_FK3, "OneToOne_Optional_PK2")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_ThenInclude_two_references(bool async) => AssertQuery( async, @@ -1254,8 +1158,7 @@ public virtual Task Include_collection_ThenInclude_two_references(bool async) new ExpectedInclude(e2 => e2.OneToOne_Optional_PK2, "OneToMany_Optional1"), new ExpectedInclude(e3 => e3.OneToOne_Optional_FK3, "OneToMany_Optional1.OneToOne_Optional_PK2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_followed_by_complex_includes_and_projecting_the_included_collection(bool async) => AssertQuery( async, @@ -1273,8 +1176,7 @@ public virtual Task Include_collection_followed_by_complex_includes_and_projecti new ExpectedInclude(e3 => e3.OneToOne_Optional_FK2), new ExpectedInclude(e4 => e4.OneToMany_Optional3, "OneToOne_Optional_FK2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_multiple(bool async) => AssertQuery( async, @@ -1290,8 +1192,7 @@ public virtual Task Include_collection_multiple(bool async) new ExpectedInclude(e4 => e4.OneToOne_Optional_FK2, "OneToMany_Optional1"), new ExpectedInclude(e5 => e5.OneToMany_Optional3, "OneToMany_Optional1.OneToOne_Optional_FK2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_ThenInclude_ThenInclude_followed_by_two_nested_selects(bool async) => AssertQuery( async, @@ -1304,8 +1205,7 @@ public virtual Task Include_ThenInclude_ThenInclude_followed_by_two_nested_selec elementAsserter: (e, a) => AssertCollection( e, a, elementAsserter: (ee, aa) => AssertInclude(ee, aa, new ExpectedInclude(x => x.OneToOne_Optional_FK3)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_ThenInclude_reference_followed_by_projection_into_anonmous_type(bool async) => AssertQuery( async, @@ -1325,8 +1225,7 @@ public virtual Task Include_collection_ThenInclude_reference_followed_by_project elementAsserter: (ee, aa) => AssertInclude(ee, aa, new ExpectedInclude(e => e.OneToOne_Optional_PK2))); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_multiple_with_filter(bool async) => AssertQuery( async, @@ -1340,8 +1239,7 @@ public virtual Task Include_collection_multiple_with_filter(bool async) new ExpectedInclude(e2 => e2.OneToOne_Optional_PK2, "OneToMany_Optional1"), new ExpectedInclude(e3 => e3.OneToOne_Optional_FK3, "OneToMany_Optional1.OneToOne_Optional_PK2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_multiple_with_filter_EF_Property(bool async) => AssertQuery( async, @@ -1349,33 +1247,29 @@ public virtual Task Include_collection_multiple_with_filter_EF_Property(bool asy .Include(l1 => EF.Property>(l1, "OneToMany_Optional1")) .ThenInclude(l2 => EF.Property(l2, "OneToOne_Optional_PK2")) .ThenInclude(l3 => EF.Property(l3, "OneToOne_Optional_FK3")) - .Where( - l1 => EF.Property>(l1, "OneToMany_Optional1").Where(l2 => l2.OneToOne_Optional_PK2.Name != "Foo") - .Count() - > 0), + .Where(l1 => EF.Property>(l1, "OneToMany_Optional1").Where(l2 => l2.OneToOne_Optional_PK2.Name != "Foo") + .Count() + > 0), elementAsserter: (e, a) => AssertInclude( e, a, new ExpectedInclude(e1 => e1.OneToMany_Optional1), new ExpectedInclude(e2 => e2.OneToOne_Optional_PK2, "OneToMany_Optional1"), new ExpectedInclude(e3 => e3.OneToOne_Optional_FK3, "OneToMany_Optional1.OneToOne_Optional_PK2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Including_reference_navigation_and_projecting_collection_navigation(bool async) => AssertQuery( async, ss => ss.Set() .Include(e => e.OneToOne_Required_FK1) .ThenInclude(e => e.OneToOne_Optional_FK2) - .Select( - e => new Level1 - { - Id = e.Id, - OneToOne_Required_FK1 = e.OneToOne_Required_FK1, - OneToMany_Required1 = e.OneToMany_Required1 - })); + .Select(e => new Level1 + { + Id = e.Id, + OneToOne_Required_FK1 = e.OneToOne_Required_FK1, + OneToMany_Required1 = e.OneToMany_Required1 + })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LeftJoin_with_Any_on_outer_source_and_projecting_collection_from_inner(bool async) { var validIds = new List { "L1 01", "L1 02" }; @@ -1389,8 +1283,7 @@ from l2 in l2s.DefaultIfEmpty() select new Level2 { Id = l2 == null ? 0 : l2.Id, OneToMany_Required2 = l2 == null ? null : l2.OneToMany_Required2 }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_basic_Where(bool async) => AssertQuery( async, @@ -1401,8 +1294,7 @@ public virtual Task Filtered_include_basic_Where(bool async) e => e.OneToMany_Optional1, includeFilter: x => x.Where(l2 => l2.Id > 5)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_basic_Where_EF_Property(bool async) => AssertQuery( async, @@ -1413,8 +1305,7 @@ public virtual Task Filtered_include_basic_Where_EF_Property(bool async) e => e.OneToMany_Optional1, includeFilter: x => x.Where(l2 => l2.Id > 5)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_OrderBy(bool async) => AssertQuery( async, @@ -1426,8 +1317,7 @@ public virtual Task Filtered_include_OrderBy(bool async) includeFilter: x => x.OrderBy(x => x.Name), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_OrderBy_EF_Property(bool async) => AssertQuery( async, @@ -1439,8 +1329,7 @@ public virtual Task Filtered_include_OrderBy_EF_Property(bool async) includeFilter: x => x.OrderBy(x => x.Name), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_ThenInclude_OrderBy(bool async) => AssertQuery( async, @@ -1454,8 +1343,7 @@ public virtual Task Filtered_ThenInclude_OrderBy(bool async) includeFilter: x => x.OrderBy(x => x.Name), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_ThenInclude_OrderBy(bool async) => AssertQuery( async, @@ -1474,8 +1362,7 @@ public virtual Task Filtered_include_ThenInclude_OrderBy(bool async) includeFilter: x => x.OrderByDescending(x => x.Name), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_basic_OrderBy_Take(bool async) => AssertQuery( async, @@ -1487,8 +1374,7 @@ public virtual Task Filtered_include_basic_OrderBy_Take(bool async) includeFilter: x => x.OrderBy(x => x.Name).Take(3), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_basic_OrderBy_Skip(bool async) => AssertQuery( async, @@ -1500,8 +1386,7 @@ public virtual Task Filtered_include_basic_OrderBy_Skip(bool async) includeFilter: x => x.OrderBy(x => x.Name).Skip(1), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_basic_OrderBy_Skip_Take(bool async) => AssertQuery( async, @@ -1513,14 +1398,12 @@ public virtual Task Filtered_include_basic_OrderBy_Skip_Take(bool async) includeFilter: x => x.OrderBy(x => x.Name).Skip(1).Take(3), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_basic_OrderBy_Skip_Take_EF_Property(bool async) => AssertQuery( async, - ss => ss.Set().Include( - l1 => EF.Property>(l1, "OneToMany_Optional1") - .OrderBy(x => x.Name).Skip(1).Take(3)), + ss => ss.Set().Include(l1 => EF.Property>(l1, "OneToMany_Optional1") + .OrderBy(x => x.Name).Skip(1).Take(3)), elementAsserter: (e, a) => AssertInclude( e, a, new ExpectedFilteredInclude( @@ -1528,8 +1411,7 @@ public virtual Task Filtered_include_basic_OrderBy_Skip_Take_EF_Property(bool as includeFilter: x => x.OrderBy(x => x.Name).Skip(1).Take(3), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_Skip_without_OrderBy(bool async) => AssertQuery( async, @@ -1541,8 +1423,7 @@ public virtual Task Filtered_include_Skip_without_OrderBy(bool async) Assert.Equal(Math.Max(e.OneToMany_Optional1.Count - 1, 0), a.OneToMany_Optional1?.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_Take_without_OrderBy(bool async) => AssertQuery( async, @@ -1554,8 +1435,7 @@ public virtual Task Filtered_include_Take_without_OrderBy(bool async) Assert.Equal(e.OneToMany_Optional1.Any() ? 1 : 0, a.OneToMany_Optional1?.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_on_ThenInclude(bool async) => AssertQuery( async, @@ -1571,16 +1451,14 @@ public virtual Task Filtered_include_on_ThenInclude(bool async) x => x.Where(x => x.Name != "Foo").OrderBy(x => x.Name).Skip(1).Take(3), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_on_ThenInclude_EF_Property(bool async) => AssertQuery( async, ss => ss.Set() .Include(l1 => EF.Property(l1, "OneToOne_Optional_FK1")) - .ThenInclude( - l2 => EF.Property>(l2, "OneToMany_Optional2") - .Where(x => x.Name != "Foo").OrderBy(x => x.Name).Skip(1).Take(3)), + .ThenInclude(l2 => EF.Property>(l2, "OneToMany_Optional2") + .Where(x => x.Name != "Foo").OrderBy(x => x.Name).Skip(1).Take(3)), elementAsserter: (e, a) => AssertInclude( e, a, new ExpectedInclude(e => e.OneToOne_Optional_FK1), @@ -1590,15 +1468,13 @@ public virtual Task Filtered_include_on_ThenInclude_EF_Property(bool async) x => x.Where(x => x.Name != "Foo").OrderBy(x => x.Name).Skip(1).Take(3), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_after_reference_navigation(bool async) => AssertQuery( async, ss => ss.Set() - .Include( - l1 => l1.OneToOne_Optional_FK1.OneToMany_Optional2.Where(x => x.Name != "Foo").OrderBy(x => x.Name).Skip(1) - .Take(3)), + .Include(l1 => l1.OneToOne_Optional_FK1.OneToMany_Optional2.Where(x => x.Name != "Foo").OrderBy(x => x.Name).Skip(1) + .Take(3)), elementAsserter: (e, a) => AssertInclude( e, a, new ExpectedInclude(e => e.OneToOne_Optional_FK1), @@ -1608,8 +1484,7 @@ public virtual Task Filtered_include_after_reference_navigation(bool async) x => x.Where(x => x.Name != "Foo").OrderBy(x => x.Name).Skip(1).Take(3), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_after_different_filtered_include_same_level(bool async) => AssertQuery( async, @@ -1627,8 +1502,7 @@ public virtual Task Filtered_include_after_different_filtered_include_same_level includeFilter: x => x.Where(x => x.Name != "Bar").OrderByDescending(x => x.Name).Skip(1), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_after_different_filtered_include_different_level(bool async) => AssertQuery( async, @@ -1647,43 +1521,38 @@ public virtual Task Filtered_include_after_different_filtered_include_different_ includeFilter: x => x.Where(x => x.Name != "Bar").OrderByDescending(x => x.Name).Skip(1), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Filtered_include_different_filter_set_on_same_navigation_twice(bool async) => Assert.Equal( CoreStrings.MultipleFilteredIncludesOnSameNavigation( "navigation .Where(x => x.Name != \"Bar\") .OrderByDescending(x => x.Name) .Take(3)", "navigation .Where(x => x.Name != \"Foo\") .OrderBy(x => x.Id) .Take(3)") .Replace("\r", "").Replace("\n", ""), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Include(l1 => l1.OneToMany_Optional1.Where(x => x.Name != "Foo").OrderBy(x => x.Id).Take(3)) - .Include(l1 => l1.OneToMany_Optional1.Where(x => x.Name != "Bar").OrderByDescending(x => x.Name).Take(3))))) + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Include(l1 => l1.OneToMany_Optional1.Where(x => x.Name != "Foo").OrderBy(x => x.Id).Take(3)) + .Include(l1 => l1.OneToMany_Optional1.Where(x => x.Name != "Bar").OrderByDescending(x => x.Name).Take(3))))) .Message .Replace("\r", "").Replace("\n", "")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Filtered_include_different_filter_set_on_same_navigation_twice_multi_level(bool async) => Assert.Equal( CoreStrings.MultipleFilteredIncludesOnSameNavigation( "navigation .Where(x => x.Name != \"Bar\")", "navigation .Where(x => x.Name != \"Foo\")") .Replace("\r", "").Replace("\n", ""), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Include(l1 => l1.OneToMany_Optional1.Where(x => x.Name != "Foo")).ThenInclude(l2 => l2.OneToMany_Optional2) - .Include(l1 => l1.OneToMany_Optional1.Where(x => x.Name != "Bar")) - .ThenInclude(l2 => l2.OneToOne_Required_FK2)))) + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Include(l1 => l1.OneToMany_Optional1.Where(x => x.Name != "Foo")).ThenInclude(l2 => l2.OneToMany_Optional2) + .Include(l1 => l1.OneToMany_Optional1.Where(x => x.Name != "Bar")) + .ThenInclude(l2 => l2.OneToOne_Required_FK2)))) .Message .Replace("\r", "").Replace("\n", "")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_same_filter_set_on_same_navigation_twice(bool async) => AssertQuery( async, @@ -1697,8 +1566,7 @@ public virtual Task Filtered_include_same_filter_set_on_same_navigation_twice(bo includeFilter: x => x.Where(x => x.Name != "Foo").OrderByDescending(x => x.Id).Take(2), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_same_filter_set_on_same_navigation_twice_followed_by_ThenIncludes(bool async) => AssertQuery( async, @@ -1716,8 +1584,7 @@ public virtual Task Filtered_include_same_filter_set_on_same_navigation_twice_fo new ExpectedInclude(e => e.OneToMany_Optional2), new ExpectedInclude(e => e.OneToOne_Required_FK2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_multiple_multi_level_includes_with_first_level_using_filter_include_on_one_of_the_chains_only( bool async) => AssertQuery( @@ -1735,8 +1602,7 @@ public virtual Task Filtered_include_multiple_multi_level_includes_with_first_le new ExpectedInclude(e => e.OneToMany_Optional2, "OneToMany_Optional1"), new ExpectedInclude(e => e.OneToOne_Required_FK2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_and_non_filtered_include_on_same_navigation1(bool async) => AssertQuery( async, @@ -1750,8 +1616,7 @@ public virtual Task Filtered_include_and_non_filtered_include_on_same_navigation includeFilter: x => x.Where(x => x.Name != "Foo").OrderBy(x => x.Id).Take(3), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_and_non_filtered_include_on_same_navigation2(bool async) => AssertQuery( async, @@ -1765,8 +1630,7 @@ public virtual Task Filtered_include_and_non_filtered_include_on_same_navigation includeFilter: x => x.Where(x => x.Name != "Foo").OrderBy(x => x.Id).Take(3), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_and_non_filtered_include_followed_by_then_include_on_same_navigation(bool async) => AssertQuery( async, @@ -1786,8 +1650,7 @@ public virtual Task Filtered_include_and_non_filtered_include_followed_by_then_i "OneToMany_Optional1.OneToOne_Optional_PK2", includeFilter: x => x.Where(x => x.Id > 1)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_complex_three_level_with_middle_having_filter1(bool async) => AssertQuery( async, @@ -1809,8 +1672,7 @@ public virtual Task Filtered_include_complex_three_level_with_middle_having_filt new ExpectedInclude(e => e.OneToMany_Optional3, "OneToMany_Optional1.OneToMany_Optional2"), new ExpectedInclude(e => e.OneToMany_Required3, "OneToMany_Optional1.OneToMany_Optional2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_complex_three_level_with_middle_having_filter2(bool async) => AssertQuery( async, @@ -1831,8 +1693,7 @@ public virtual Task Filtered_include_complex_three_level_with_middle_having_filt new ExpectedInclude(e => e.OneToMany_Optional3, "OneToMany_Optional1.OneToMany_Optional2"), new ExpectedInclude(e => e.OneToMany_Required3, "OneToMany_Optional1.OneToMany_Optional2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_variable_used_inside_filter(bool async) { var prm = "Foo"; @@ -1849,8 +1710,7 @@ public virtual Task Filtered_include_variable_used_inside_filter(bool async) includeFilter: x => x.Where(xx => xx.Name != "Foo").OrderBy(x => x.Id).Take(3)))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_context_accessed_inside_filter(bool async) => AssertQuery( async, @@ -1863,15 +1723,13 @@ public virtual Task Filtered_include_context_accessed_inside_filter(bool async) x => x.OneToMany_Optional1, includeFilter: x => x.OrderBy(x => x.Id).Take(3)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_context_accessed_inside_filter_correlated(bool async) => AssertQuery( async, ss => ss.Set() - .Include( - l1 => l1.OneToMany_Optional1.Where(x => ss.Set().Count(xx => xx.Id != x.Id) > 1).OrderBy(x => x.Id) - .Take(3)), + .Include(l1 => l1.OneToMany_Optional1.Where(x => ss.Set().Count(xx => xx.Id != x.Id) > 1).OrderBy(x => x.Id) + .Take(3)), elementAsserter: (e, a) => AssertInclude( e, a, @@ -1879,8 +1737,7 @@ public virtual Task Filtered_include_context_accessed_inside_filter_correlated(b x => x.OneToMany_Optional1, includeFilter: x => x.OrderBy(x => x.Id).Take(3)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_include_parameter_used_inside_filter_throws(bool async) => AssertInvalidMaterializationType( () => AssertQuery( @@ -1889,18 +1746,16 @@ public virtual Task Filtered_include_include_parameter_used_inside_filter_throws .Select(l1 => ss.Set().Include(l2 => l2.OneToMany_Optional2.Where(x => x.Id != l2.Id)))), "IEnumerable"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_outer_parameter_used_inside_filter(bool async) => AssertQuery( async, - ss => ss.Set().Select( - l1 => new - { - l1.Id, - FullInclude = ss.Set().Include(l2 => l2.OneToMany_Optional2).ToList(), - FilteredInclude = ss.Set().Include(l2 => l2.OneToMany_Optional2.Where(x => x.Id != l1.Id)).ToList() - }), + ss => ss.Set().Select(l1 => new + { + l1.Id, + FullInclude = ss.Set().Include(l2 => l2.OneToMany_Optional2).ToList(), + FilteredInclude = ss.Set().Include(l2 => l2.OneToMany_Optional2.Where(x => x.Id != l1.Id)).ToList() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -1914,8 +1769,7 @@ public virtual Task Filtered_include_outer_parameter_used_inside_filter(bool asy includeFilter: x => x.Where(x => x.Id != e.Id))); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Filtered_include_is_considered_loaded(bool async) { using var ctx = CreateContext(); @@ -1928,30 +1782,25 @@ public virtual async Task Filtered_include_is_considered_loaded(bool async) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Filtered_include_with_Distinct_throws(bool async) => Assert.Equal( CoreStrings.InvalidIncludeExpression("l1.OneToMany_Optional1.AsQueryable().Distinct()"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(l1 => l1.OneToMany_Optional1.Distinct())))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(l1 => l1.OneToMany_Optional1.Distinct())))).Message); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Filtered_include_calling_methods_directly_on_parameter_throws(bool async) => Assert.Equal( CoreStrings.InvalidIncludeExpression("l2.AsQueryable().Where(xx => (xx.Id != 42))"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Include(l1 => l1.OneToMany_Optional1) - .ThenInclude(l2 => l2.AsQueryable().Where(xx => xx.Id != 42))))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Include(l1 => l1.OneToMany_Optional1) + .ThenInclude(l2 => l2.AsQueryable().Where(xx => xx.Id != 42))))).Message); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_Take_with_another_Take_on_top_level(bool async) => AssertQuery( async, @@ -1969,8 +1818,7 @@ public virtual Task Filtered_include_Take_with_another_Take_on_top_level(bool as includeFilter: x => x.OrderByDescending(xx => xx.Name).Take(4)), new ExpectedInclude(x => x.OneToOne_Optional_FK2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_Skip_Take_with_another_Skip_Take_on_top_level(bool async) => AssertQuery( async, @@ -1989,8 +1837,7 @@ public virtual Task Filtered_include_Skip_Take_with_another_Skip_Take_on_top_lev includeFilter: x => x.OrderByDescending(xx => xx.Name).Skip(2).Take(4)), new ExpectedInclude(x => x.OneToOne_Optional_FK2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_with_Take_without_order_by_followed_by_ThenInclude_and_FirstOrDefault_on_top_level(bool async) => AssertFirstOrDefault( async, @@ -2006,8 +1853,7 @@ public virtual Task Filtered_include_with_Take_without_order_by_followed_by_Then includeFilter: x => x.Take(40)), new ExpectedInclude(x => x.OneToOne_Optional_FK2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_with_Take_without_order_by_followed_by_ThenInclude_and_unordered_Take_on_top_level(bool async) => AssertQuery( async, @@ -2025,8 +1871,7 @@ public virtual Task Filtered_include_with_Take_without_order_by_followed_by_Then includeFilter: x => x.Take(40)), new ExpectedInclude(x => x.OneToOne_Optional_FK2, "OneToMany_Optional1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_collection_with_FirstOrDefault(bool async) => AssertFirstOrDefault( async, @@ -2039,8 +1884,7 @@ public virtual Task Projecting_collection_with_FirstOrDefault(bool async) AssertCollection(e.Level2s, a.Level2s); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_on_grouping_element(bool async) => AssertQuery( async, @@ -2054,8 +1898,7 @@ public virtual Task Skip_on_grouping_element(bool async) AssertCollection(e.Level1s, a.Level1s); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_on_grouping_element(bool async) => AssertQuery( async, @@ -2069,8 +1912,7 @@ public virtual Task Take_on_grouping_element(bool async) AssertCollection(e.Level1s, a.Level1s); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_on_grouping_element(bool async) => AssertQuery( async, @@ -2084,8 +1926,7 @@ public virtual Task Skip_Take_on_grouping_element(bool async) AssertCollection(e.Level1s, a.Level1s); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_Distinct_on_grouping_element(bool async) => AssertQuery( async, @@ -2099,8 +1940,7 @@ public virtual Task Skip_Take_Distinct_on_grouping_element(bool async) AssertCollection(e.Level1s, a.Level1s); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_ToList_on_grouping_element(bool async) => AssertQuery( async, @@ -2114,8 +1954,7 @@ public virtual Task Skip_Take_ToList_on_grouping_element(bool async) AssertCollection(e.Level1s, a.Level1s); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_on_grouping_element_into_non_entity(bool async) => AssertQuery( async, @@ -2129,8 +1968,7 @@ public virtual Task Skip_Take_on_grouping_element_into_non_entity(bool async) AssertCollection(e.Level1s, a.Level1s, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_on_grouping_element_with_collection_include(bool async) => AssertQuery( async, @@ -2147,8 +1985,7 @@ public virtual Task Skip_Take_on_grouping_element_with_collection_include(bool a elementAsserter: (ee, aa) => AssertInclude(ee, aa, new ExpectedInclude(l => l.OneToMany_Optional1))); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_on_grouping_element_with_reference_include(bool async) => AssertQuery( async, @@ -2165,21 +2002,19 @@ public virtual Task Skip_Take_on_grouping_element_with_reference_include(bool as elementAsserter: (ee, aa) => AssertInclude(ee, aa, new ExpectedInclude(l => l.OneToOne_Optional_FK1))); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_on_grouping_element_inside_collection_projection(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - l1 => new - { - l1.Id, - group = ss.Set() - .Where(l => l.Name == l1.Name) - .GroupBy(l => l.Date) - .Select(g => new { g.Key, Level1s = g.OrderBy(e => e.Name).Skip(1).Take(5) }).ToList() - }), + .Select(l1 => new + { + l1.Id, + group = ss.Set() + .Where(l => l.Name == l1.Name) + .GroupBy(l => l.Date) + .Select(g => new { g.Key, Level1s = g.OrderBy(e => e.Name).Skip(1).Take(5) }).ToList() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2194,8 +2029,7 @@ public virtual Task Skip_Take_on_grouping_element_inside_collection_projection(b }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_over_GroupBy_over_parameter(bool async) { var validIds = new List { "L1 01", "L1 02" }; @@ -2214,32 +2048,25 @@ public virtual Task Collection_projection_over_GroupBy_over_parameter(bool async }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_over_conditional_null_source(bool async) - => AssertTranslationFailed( - () => AssertQueryScalar( - async, - ss => ss.Set() - .SelectMany( - l2 => l2.Id == 1 - ? l2.OneToMany_Required_Inverse2.OneToMany_Optional1.Select(e => e.Id) - : null))); + => AssertTranslationFailed(() => AssertQueryScalar( + async, + ss => ss.Set() + .SelectMany(l2 => l2.Id == 1 + ? l2.OneToMany_Required_Inverse2.OneToMany_Optional1.Select(e => e.Id) + : null))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_over_conditional_empty_source(bool async) - => AssertTranslationFailed( - () => AssertQueryScalar( - async, - ss => ss.Set() - .SelectMany( - l2 => l2.Id == 1 - ? l2.OneToMany_Required_Inverse2.OneToMany_Optional1.Select(e => e.Id) - : Enumerable.Empty()))); + => AssertTranslationFailed(() => AssertQueryScalar( + async, + ss => ss.Set() + .SelectMany(l2 => l2.Id == 1 + ? l2.OneToMany_Required_Inverse2.OneToMany_Optional1.Select(e => e.Id) + : Enumerable.Empty()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_partially_added_before_Where_and_then_build_upon(bool async) => AssertQuery( async, @@ -2253,8 +2080,7 @@ public virtual Task Include_partially_added_before_Where_and_then_build_upon(boo new ExpectedInclude(l2 => l2.OneToMany_Optional2, "OneToOne_Optional_FK1"), new ExpectedInclude(l3 => l3.OneToOne_Optional_FK3, "OneToOne_Optional_FK1.OneToMany_Optional2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_partially_added_before_Where_and_then_build_upon_with_filtered_include(bool async) => AssertQuery( async, @@ -2268,8 +2094,7 @@ public virtual Task Include_partially_added_before_Where_and_then_build_upon_wit new ExpectedInclude(l2 => l2.OneToMany_Optional2, "OneToOne_Optional_FK1"), new ExpectedInclude(l3 => l3.OneToOne_Optional_FK3, "OneToOne_Optional_FK1.OneToMany_Optional2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_on_correlated_collection_in_projection(bool async) => AssertQuery( async, @@ -2281,8 +2106,7 @@ public virtual Task Take_on_correlated_collection_in_projection(bool async) AssertCollection(e.Collection, a.Collection); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_with_predicate_on_correlated_collection_in_projection(bool async) => AssertQuery( async, @@ -2294,8 +2118,7 @@ public virtual Task FirstOrDefault_with_predicate_on_correlated_collection_in_pr AssertEqual(e.Element, a.Element); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_predicate_and_DefaultIfEmpty_projecting_root_collection_element_and_another_collection( bool async) => AssertQuery( @@ -2316,35 +2139,32 @@ from l2 in ss.Set().Where(x => x.Level1_Required_Id == l1.Id * 2 || x.Na AssertCollection(e.Collection, a.Collection); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_issue_21665(bool async) => AssertFirstOrDefault( async, ss => ss.Set() .OrderBy(l1 => l1.Name) - .Select( - l1 => new - { - Level1 = l1, - Level2Name = l1.OneToOne_Optional_FK1.Name, - ChildCount = l1.OneToMany_Optional_Self1.Count, - Level2Count = l1.OneToMany_Optional1.Count(), - IsLevel2There = l1.OneToMany_Optional1.Any(l2 => l2.Id == 2), - Children = l1.OneToMany_Optional_Self1 - .OrderBy(e => e.Name) - .Skip(1) - .Take(5) - .Select( - lc1 => new - { - Level1 = lc1, - ChildCount = lc1.OneToMany_Optional_Self1.Count, - Level2Name = lc1.OneToOne_Optional_FK1.Name, - Level2Count = lc1.OneToMany_Optional1.Count(), - IsLevel2There = lc1.OneToMany_Optional1.Any(l2 => l2.Id == 2) - }) - }), + .Select(l1 => new + { + Level1 = l1, + Level2Name = l1.OneToOne_Optional_FK1.Name, + ChildCount = l1.OneToMany_Optional_Self1.Count, + Level2Count = l1.OneToMany_Optional1.Count(), + IsLevel2There = l1.OneToMany_Optional1.Any(l2 => l2.Id == 2), + Children = l1.OneToMany_Optional_Self1 + .OrderBy(e => e.Name) + .Skip(1) + .Take(5) + .Select(lc1 => new + { + Level1 = lc1, + ChildCount = lc1.OneToMany_Optional_Self1.Count, + Level2Name = lc1.OneToOne_Optional_FK1.Name, + Level2Count = lc1.OneToMany_Optional1.Count(), + IsLevel2There = lc1.OneToMany_Optional1.Any(l2 => l2.Id == 2) + }) + }), e => e.Level1.Id == 2, asserter: (e, a) => { @@ -2365,31 +2185,25 @@ public virtual Task Complex_query_issue_21665(bool async) }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_collection_after_optional_reference_correlated_with_parent(bool async) => AssertQuery( async, - ss => ss.Set().Select( - l1 => new - { - l1.Id, - Collection = l1.OneToOne_Optional_FK1.OneToMany_Optional2.Select( - l3 => new { ChildId = l3.Id, ParentName = l1.OneToOne_Optional_FK1.Name }) - }), - ss => ss.Set().Select( - l1 => new - { - l1.Id, - Collection = l1.Maybe( - x => x.OneToOne_Optional_FK1.Maybe( - xx => xx.OneToMany_Optional2.Select( - l3 => new - { - ChildId = (int)l3.MaybeScalar(xxx => xxx.Id), - ParentName = l1.OneToOne_Optional_FK1.Maybe(xxx => xxx.Name) - }))) - }), + ss => ss.Set().Select(l1 => new + { + l1.Id, + Collection = l1.OneToOne_Optional_FK1.OneToMany_Optional2.Select(l3 + => new { ChildId = l3.Id, ParentName = l1.OneToOne_Optional_FK1.Name }) + }), + ss => ss.Set().Select(l1 => new + { + l1.Id, + Collection = l1.Maybe(x => x.OneToOne_Optional_FK1.Maybe(xx => xx.OneToMany_Optional2.Select(l3 + => new + { + ChildId = (int)l3.MaybeScalar(xxx => xxx.Id), ParentName = l1.OneToOne_Optional_FK1.Maybe(xxx => xxx.Name) + }))) + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2401,28 +2215,25 @@ public virtual Task Projecting_collection_after_optional_reference_correlated_wi } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_collection_with_group_by_after_optional_reference_correlated_with_parent(bool async) => AssertQuery( async, - ss => ss.Set().Select( - l1 => new - { - l1.Id, - Entity = l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2, - Collection = l1.OneToOne_Optional_FK1.OneToMany_Optional2.GroupBy(x => x.Name) - .Select(g => new { g.Key, Count = g.Count() }) - }), - ss => ss.Set().Select( - l1 => new - { - l1.Id, - Entity = l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2, - Collection = l1.Maybe( - x => x.OneToOne_Optional_FK1.Maybe( - xx => xx.OneToMany_Optional2.GroupBy(x => x.Name).Select(g => new { g.Key, Count = g.Count() }))) - }), + ss => ss.Set().Select(l1 => new + { + l1.Id, + Entity = l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2, + Collection = l1.OneToOne_Optional_FK1.OneToMany_Optional2.GroupBy(x => x.Name) + .Select(g => new { g.Key, Count = g.Count() }) + }), + ss => ss.Set().Select(l1 => new + { + l1.Id, + Entity = l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2, + Collection = l1.Maybe(x + => x.OneToOne_Optional_FK1.Maybe(xx + => xx.OneToMany_Optional2.GroupBy(x => x.Name).Select(g => new { g.Key, Count = g.Count() }))) + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2434,8 +2245,7 @@ public virtual Task Projecting_collection_with_group_by_after_optional_reference } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_Include_collection(bool async) => AssertQuery( async, @@ -2445,8 +2255,7 @@ public virtual Task Final_GroupBy_property_entity_Include_collection(bool async) e, a, elementAsserter: (ee, aa) => AssertInclude(ee, aa, new ExpectedInclude(i => i.OneToMany_Optional1)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_Include_collection_nested(bool async) => AssertQuery( async, @@ -2459,8 +2268,7 @@ public virtual Task Final_GroupBy_property_entity_Include_collection_nested(bool new ExpectedInclude(i => i.OneToMany_Optional1), new ExpectedInclude(l2 => l2.OneToMany_Optional2, "OneToManyOptional1")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_Include_collection_reference(bool async) => AssertQuery( async, @@ -2473,8 +2281,7 @@ public virtual Task Final_GroupBy_property_entity_Include_collection_reference(b new ExpectedInclude(i => i.OneToMany_Optional1), new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2, "OneToManyOptional1")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_Include_collection_multiple(bool async) => AssertQuery( async, @@ -2487,8 +2294,7 @@ public virtual Task Final_GroupBy_property_entity_Include_collection_multiple(bo new ExpectedInclude(i => i.OneToMany_Optional1), new ExpectedInclude(l2 => l2.OneToMany_Required1)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_Include_collection_reference_same_level(bool async) => AssertQuery( async, @@ -2501,8 +2307,7 @@ public virtual Task Final_GroupBy_property_entity_Include_collection_reference_s new ExpectedInclude(i => i.OneToMany_Optional1), new ExpectedInclude(l2 => l2.OneToOne_Optional_FK1)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_Include_reference(bool async) => AssertQuery( async, @@ -2514,8 +2319,7 @@ public virtual Task Final_GroupBy_property_entity_Include_reference(bool async) ee, aa, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK1)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_Include_reference_multiple(bool async) => AssertQuery( async, @@ -2528,23 +2332,21 @@ public virtual Task Final_GroupBy_property_entity_Include_reference_multiple(boo new ExpectedInclude(l2 => l2.OneToOne_Optional_FK1), new ExpectedInclude(l2 => l2.OneToOne_Required_FK1)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_and_nested_conditional(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(x => x.Id).Select( - x => new - { - Collection = x.OneToMany_Optional1.OrderBy(xx => xx.Id).Select(xx => xx.Name).ToList(), - Condition = x.Id == 1 - ? "01" - : x.Id == 2 - ? "02" - : x.Id == 3 - ? "03" - : null - }).Where(x => x.Condition == "02"), + ss => ss.Set().OrderBy(x => x.Id).Select(x => new + { + Collection = x.OneToMany_Optional1.OrderBy(xx => xx.Id).Select(xx => xx.Name).ToList(), + Condition = x.Id == 1 + ? "01" + : x.Id == 2 + ? "02" + : x.Id == 3 + ? "03" + : null + }).Where(x => x.Condition == "02"), assertOrder: true, elementAsserter: (e, a) => { diff --git a/test/EFCore.Specification.Tests/Query/ComplexNavigationsCollectionsSharedTypeQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/ComplexNavigationsCollectionsSharedTypeQueryTestBase.cs index 9d2a03cc7ae..32c50b43b22 100644 --- a/test/EFCore.Specification.Tests/Query/ComplexNavigationsCollectionsSharedTypeQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/ComplexNavigationsCollectionsSharedTypeQueryTestBase.cs @@ -11,21 +11,19 @@ public abstract class public override async Task Multiple_complex_includes_self_ref(bool async) => Assert.Equal( CoreStrings.InvalidIncludeExpression("e.OneToOne_Optional_Self1"), - (await Assert.ThrowsAsync( - () => base.Multiple_complex_includes_self_ref(async))).Message); + (await Assert.ThrowsAsync(() => base.Multiple_complex_includes_self_ref(async))).Message); public override async Task Multiple_complex_includes_self_ref_EF_Property(bool async) => Assert.Equal( CoreStrings.InvalidIncludeExpression("Property(e, \"OneToOne_Optional_Self1\")"), - (await Assert.ThrowsAsync( - () => base.Multiple_complex_includes_self_ref_EF_Property(async))).Message); + (await Assert.ThrowsAsync(() => base.Multiple_complex_includes_self_ref_EF_Property(async))) + .Message); public override Task Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_with_other_query_operators_composed_on_top(bool async) - => AssertTranslationFailed( - () => base - .Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_with_other_query_operators_composed_on_top( - async)); + => AssertTranslationFailed(() => base + .Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_with_other_query_operators_composed_on_top( + async)); public override Task Include_collection_with_multiple_orderbys_complex(bool async) => AssertIncludeOnNonEntity(() => base.Include_collection_with_multiple_orderbys_complex(async)); diff --git a/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryFixtureBase.cs index d81b7c92023..e2c43dcc323 100644 --- a/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryFixtureBase.cs @@ -474,10 +474,9 @@ protected override Task SeedAsync(ComplexNavigationsContext context) => ComplexNavigationsData.SeedAsync(context); public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - c => c - .Log(CoreEventId.PossibleUnintendedCollectionNavigationNullComparisonWarning) - .Log(CoreEventId.RowLimitingOperationWithoutOrderByWarning)); + => base.AddOptions(builder).ConfigureWarnings(c => c + .Log(CoreEventId.PossibleUnintendedCollectionNavigationNullComparisonWarning) + .Log(CoreEventId.RowLimitingOperationWithoutOrderByWarning)); public override ComplexNavigationsContext CreateContext() { diff --git a/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs index 7bdf2d95a83..d7ad4b9ca7c 100644 --- a/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs @@ -17,105 +17,88 @@ protected ComplexNavigationsContext CreateContext() protected override Expression RewriteExpectedQueryExpression(Expression expectedQueryExpression) => new ExpectedQueryRewritingVisitor(Fixture.GetShadowPropertyMappings()).Visit(expectedQueryExpression); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_empty(bool async) => AssertQuery( async, ss => ss.Set().Where(l => l.OneToOne_Optional_FK1 == new Level2()), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_when_sentinel_ef_property(bool async) => AssertQuery( async, ss => ss.Set().Where(l => EF.Property(l.OneToOne_Optional_FK1, "Id") == 0), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_using_property_method_required(bool async) => AssertQuery( async, ss => ss.Set().Where(l => EF.Property(l.OneToOne_Required_FK1, "Id") > 7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_using_property_method_required2(bool async) => AssertQuery( async, ss => ss.Set().Where(l => EF.Property(l.OneToOne_Required_FK_Inverse2, "Id") > 7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_using_property_method_nested(bool async) => AssertQuery( async, ss => ss.Set().Where(l => EF.Property(EF.Property(l, "OneToOne_Required_FK1"), "Id") == 7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_using_property_method_nested2(bool async) => AssertQuery( async, ss => ss.Set().Where(l => EF.Property(EF.Property(l, "OneToOne_Required_FK_Inverse2"), "Id") == 7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_using_property_method_and_member_expression1(bool async) => AssertQuery( async, ss => ss.Set().Where(l => EF.Property(l, "OneToOne_Required_FK1").Id == 7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_using_property_method_and_member_expression2(bool async) => AssertQuery( async, ss => ss.Set().Where(l => EF.Property(l.OneToOne_Required_FK1, "Id") == 7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_using_property_method_and_member_expression3(bool async) => AssertQuery( async, ss => ss.Set().Where(l => EF.Property(l.OneToOne_Required_FK_Inverse2, "Id") == 7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_navigation_converted_to_FK(bool async) => AssertQuery( async, ss => ss.Set().Where(l => l.OneToOne_Required_FK_Inverse2 == new Level1 { Id = 1 }), ss => ss.Set().Where(l => l.OneToOne_Required_FK_Inverse2.Id == 1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_two_conditions_on_same_navigation(bool async) => AssertQuery( async, - ss => ss.Set().Where( - l => l.OneToOne_Required_FK1 == new Level2 { Id = 1 } - || l.OneToOne_Required_FK1 == new Level2 { Id = 2 }), - ss => ss.Set().Where( - l => l.OneToOne_Required_FK1.Id == 1 - || l.OneToOne_Required_FK1.Id == 2)); + ss => ss.Set().Where(l => l.OneToOne_Required_FK1 == new Level2 { Id = 1 } + || l.OneToOne_Required_FK1 == new Level2 { Id = 2 }), + ss => ss.Set().Where(l => l.OneToOne_Required_FK1.Id == 1 + || l.OneToOne_Required_FK1.Id == 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_equality_two_conditions_on_same_navigation2(bool async) => AssertQuery( async, - ss => ss.Set().Where( - l => l.OneToOne_Required_FK_Inverse2 == new Level1 { Id = 1 } - || l.OneToOne_Required_FK_Inverse2 == new Level1 { Id = 2 }), - ss => ss.Set().Where( - l => l.OneToOne_Required_FK_Inverse2.Id == 1 - || l.OneToOne_Required_FK_Inverse2.Id == 2)); + ss => ss.Set().Where(l => l.OneToOne_Required_FK_Inverse2 == new Level1 { Id = 1 } + || l.OneToOne_Required_FK_Inverse2 == new Level1 { Id = 2 }), + ss => ss.Set().Where(l => l.OneToOne_Required_FK_Inverse2.Id == 1 + || l.OneToOne_Required_FK_Inverse2.Id == 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Multi_level_include_with_short_circuiting(bool async) { using var context = CreateContext(); @@ -161,8 +144,7 @@ public virtual async Task Multi_level_include_with_short_circuiting(bool async) Assert.Equal("Language9", globalizations_1_placeholder[0].Language.Name); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_key_access_optional(bool async) => AssertQuery( async, @@ -171,8 +153,7 @@ join e2 in ss.Set() on e1.Id equals e2.OneToOne_Optional_FK_Inverse2.Id select new { Id1 = e1.Id, Id2 = e2.Id }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_key_access_required(bool async) => AssertQuery( async, @@ -181,8 +162,7 @@ join e2 in ss.Set() on e1.Id equals e2.OneToOne_Required_FK_Inverse2.Id select new { Id1 = e1.Id, Id2 = e2.Id }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_key_access_optional_comparison(bool async) => AssertQueryScalar( async, @@ -190,38 +170,32 @@ public virtual Task Navigation_key_access_optional_comparison(bool async) where e2.OneToOne_Optional_PK_Inverse2.Id > 5 select e2.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Simple_level1_include(bool async) => AssertQuery( async, ss => ss.Set().Include(l1 => l1.OneToOne_Required_PK1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Simple_level1(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Simple_level1_level2_include(bool async) => AssertQuery( async, ss => ss.Set().Include(l1 => l1.OneToOne_Required_PK1.OneToOne_Required_PK2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Simple_level1_level2_GroupBy_Count(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - l1 => l1.OneToOne_Required_PK1.OneToOne_Required_PK2.Name) + ss => ss.Set().GroupBy(l1 => l1.OneToOne_Required_PK1.OneToOne_Required_PK2.Name) .Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Simple_level1_level2_GroupBy_Having_Count(bool async) => AssertQueryScalar( async, @@ -231,15 +205,13 @@ public virtual Task Simple_level1_level2_GroupBy_Having_Count(bool async) .Where(g => g.Min(l1 => l1.Id) > 0) .Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Simple_level1_level2_level3_include(bool async) => AssertQuery( async, ss => ss.Set().Include(l1 => l1.OneToOne_Required_PK1.OneToOne_Required_PK2.OneToOne_Required_PK3)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_key_access_required_comparison(bool async) => AssertQueryScalar( async, @@ -247,8 +219,7 @@ public virtual Task Navigation_key_access_required_comparison(bool async) where e2.OneToOne_Required_PK_Inverse2.Id > 5 select e2.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_inside_method_call_translated_to_join(bool async) => AssertQuery( async, @@ -259,8 +230,7 @@ where e1.OneToOne_Required_FK1.Name.StartsWith("L") where e1.OneToOne_Required_FK1.Name.MaybeScalar(x => x.StartsWith("L")) == true select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_inside_method_call_translated_to_join2(bool async) => AssertQuery( async, @@ -268,8 +238,7 @@ public virtual Task Navigation_inside_method_call_translated_to_join2(bool async where e3.OneToOne_Required_FK_Inverse3.Name.StartsWith("L") select e3); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_inside_method_call_translated_to_join(bool async) => AssertQuery( async, @@ -280,8 +249,7 @@ where e1.OneToOne_Optional_FK1.Name.StartsWith("L") where e1.OneToOne_Optional_FK1.Name.MaybeScalar(x => x.StartsWith("L")) == true select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_inside_property_method_translated_to_join(bool async) => AssertQuery( async, @@ -289,8 +257,7 @@ public virtual Task Optional_navigation_inside_property_method_translated_to_joi where EF.Property(EF.Property(e1, "OneToOne_Optional_FK1"), "Name") == "L2 01" select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_inside_nested_method_call_translated_to_join(bool async) => AssertQuery( async, @@ -302,8 +269,7 @@ where e1.OneToOne_Optional_FK1.Name.MaybeScalar(x => x.ToUpper().StartsWith("L") == true select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Method_call_on_optional_navigation_translates_to_null_conditional_properly_for_arguments(bool async) => AssertQuery( async, @@ -314,8 +280,7 @@ where e1.OneToOne_Optional_FK1.Name.StartsWith(e1.OneToOne_Optional_FK1.Name) where e1.OneToOne_Optional_FK1.Name.MaybeScalar(x => x.StartsWith(e1.OneToOne_Optional_FK1.Name)) == true select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_inside_method_call_translated_to_join_keeps_original_nullability(bool async) => AssertQuery( async, @@ -328,8 +293,7 @@ from e1 in ss.Set() where e1.OneToOne_Optional_FK1.MaybeScalar(x => x.Date.AddDays(10)) > new DateTime(2000, 2, 1) select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_inside_nested_method_call_translated_to_join_keeps_original_nullability(bool async) => AssertQuery( async, @@ -342,8 +306,7 @@ from e1 in ss.Set() where e1.OneToOne_Optional_FK1.MaybeScalar(x => x.Date.AddDays(10).AddDays(15).AddMonths(2)) > new DateTime(2000, 2, 1) select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_inside_nested_method_call_translated_to_join_keeps_original_nullability_also_for_arguments( bool async) => AssertQuery( @@ -357,8 +320,7 @@ from e1 in ss.Set() where e1.OneToOne_Optional_FK1.MaybeScalar(x => x.Date.AddDays(15).AddDays(x.Id)) > new DateTime(2000, 2, 1) select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_in_outer_selector_translated_to_extra_join(bool async) => AssertQuery( async, @@ -367,8 +329,7 @@ join e2 in ss.Set() on e1.OneToOne_Optional_FK1.Id equals e2.Id select new { Id1 = e1.Id, Id2 = e2.Id }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_in_outer_selector_translated_to_extra_join_nested(bool async) => AssertQuery( async, @@ -377,8 +338,7 @@ join e3 in ss.Set() on e1.OneToOne_Required_FK1.OneToOne_Optional_FK2.Id select new { Id1 = e1.Id, Id3 = e3.Id }, e => (e.Id1, e.Id3)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_in_outer_selector_translated_to_extra_join_nested2(bool async) => AssertQuery( async, @@ -387,8 +347,7 @@ join e1 in ss.Set() on e3.OneToOne_Required_FK_Inverse3.OneToOne_Optiona select new { Id3 = e3.Id, Id1 = e1.Id }, e => (e.Id1, e.Id3)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_in_inner_selector(bool async) => AssertQuery( async, @@ -397,8 +356,7 @@ join e1 in ss.Set() on e2.Id equals e1.OneToOne_Optional_FK1.Id select new { Id2 = e2.Id, Id1 = e1.Id }, e => (e.Id2, e.Id1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigations_in_inner_selector_translated_without_collision(bool async) => AssertQuery( async, @@ -413,8 +371,7 @@ join e3 in ss.Set() on e2.Id equals e3.OneToOne_Optional_FK_Inverse3.Id }, e => (e.Id2, e.Id1, e.Id3)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_non_key_join(bool async) => AssertQuery( async, @@ -430,8 +387,7 @@ join e1 in ss.Set() on e2.Name equals e1.OneToOne_Optional_FK1.Name }, e => (e.Id2, e.Name2, e.Id1, e.Name1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_orderby_on_inner_sequence_navigation_non_key_join(bool async) => AssertQuery( async, @@ -447,8 +403,7 @@ join e1 in ss.Set().OrderBy(l1 => l1.Id) on e2.Name equals e1.OneToOne_O }, e => (e.Id2, e.Name2, e.Id1, e.Name1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_self_ref(bool async) => AssertQuery( async, @@ -457,8 +412,7 @@ join e2 in ss.Set() on e1.Id equals e2.OneToMany_Optional_Self_Inverse1. select new { Id1 = e1.Id, Id2 = e2.Id }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_nested(bool async) => AssertQuery( async, @@ -467,8 +421,7 @@ join e1 in ss.Set() on e3.Id equals e1.OneToOne_Required_FK1.OneToOne_Op select new { Id3 = e3.Id, Id1 = e1.Id }, e => (e.Id3, e.Id1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_nested2(bool async) => AssertQuery( async, @@ -477,8 +430,7 @@ join e1 in ss.Set().OrderBy(ll => ll.Id) on e3.Id equals e1.OneToOne_Req select new { Id3 = e3.Id, Id1 = e1.Id }, e => (e.Id3, e.Id1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_deeply_nested_non_key_join(bool async) => AssertQuery( async, @@ -494,8 +446,7 @@ join e1 in ss.Set() on e4.Name equals e1.OneToOne_Required_FK1.OneToOne_ }, e => (e.Id4, e.Name4, e.Id1, e.Name1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_deeply_nested_required(bool async) => AssertQuery( async, @@ -512,8 +463,7 @@ join e4 in ss.Set() on e1.Name equals e4.OneToOne_Required_FK_Inverse4.O }, e => (e.Id4, e.Name4, e.Id1, e.Name1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_and_project_into_anonymous_type(bool async) => AssertQuery( async, @@ -525,15 +475,13 @@ public virtual Task Include_reference_and_project_into_anonymous_type(bool async AssertEqual(e.Id, a.Id); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nav_prop_reference_optional1(bool async) => AssertQuery( async, ss => ss.Set().Select(e => e.OneToOne_Optional_FK1.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nav_prop_reference_optional1_via_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -543,15 +491,13 @@ join l2 in ss.Set() on l1.Id equals l2.Level1_Optional_Id into groupJoin from l2 in groupJoin.DefaultIfEmpty() select l2 == null ? null : l2.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nav_prop_reference_optional2(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => (int?)e.OneToOne_Optional_FK1.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nav_prop_reference_optional2_via_DefaultIfEmpty(bool async) => AssertQueryScalar( async, @@ -560,15 +506,13 @@ join l2 in ss.Set() on l1.Id equals l2.Level1_Optional_Id into groupJoin from l2 in groupJoin.DefaultIfEmpty() select l2 == null ? null : (int?)l2.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nav_prop_reference_optional3(bool async) => AssertQuery( async, ss => ss.Set().Select(e => e.OneToOne_Optional_FK_Inverse2.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_nav_prop_reference_optional1(bool async) => AssertQueryScalar( async, @@ -576,8 +520,7 @@ public virtual Task Where_nav_prop_reference_optional1(bool async) .Where(e => e.OneToOne_Optional_FK1.Name == "L2 05" || e.OneToOne_Optional_FK1.Name == "L2 07") .Select(e => e.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_nav_prop_reference_optional1_via_DefaultIfEmpty(bool async) => AssertQueryScalar( async, @@ -589,8 +532,7 @@ from l2Right in groupJoinRight.DefaultIfEmpty() where (l2Left == null ? null : l2Left.Name) == "L2 05" || (l2Right == null ? null : l2Right.Name) == "L2 07" select l1.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_nav_prop_reference_optional2(bool async) => AssertQueryScalar( async, @@ -598,8 +540,7 @@ public virtual Task Where_nav_prop_reference_optional2(bool async) .Where(e => e.OneToOne_Optional_FK1.Name == "L2 05" || e.OneToOne_Optional_FK1.Name != "L2 42") .Select(e => e.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_nav_prop_reference_optional2_via_DefaultIfEmpty(bool async) => AssertQueryScalar( async, @@ -611,15 +552,13 @@ from l2Right in groupJoinRight.DefaultIfEmpty() where (l2Left == null ? null : l2Left.Name) == "L2 05" || (l2Right == null ? null : l2Right.Name) != "L2 42" select l1.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_multiple_nav_prop_reference_optional(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => (int?)e.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_multiple_nav_prop_reference_optional_member_compared_to_value(bool async) => AssertQuery( async, @@ -628,8 +567,7 @@ from l1 in ss.Set() where l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Name != "L3 05" select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_multiple_nav_prop_reference_optional_member_compared_to_null(bool async) => AssertQuery( async, @@ -638,8 +576,7 @@ from l1 in ss.Set() where l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Name != null select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_multiple_nav_prop_reference_optional_compared_to_null1(bool async) => AssertQuery( async, @@ -648,8 +585,7 @@ from l1 in ss.Set() where l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 == null select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_multiple_nav_prop_reference_optional_compared_to_null2(bool async) => AssertQuery( async, @@ -658,8 +594,7 @@ from l3 in ss.Set() where l3.OneToOne_Optional_FK_Inverse3.OneToOne_Optional_FK_Inverse2 == null select l3); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_multiple_nav_prop_reference_optional_compared_to_null3(bool async) => AssertQuery( async, @@ -668,8 +603,7 @@ from l1 in ss.Set() where null != l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_multiple_nav_prop_reference_optional_compared_to_null4(bool async) => AssertQuery( async, @@ -678,37 +612,32 @@ from l3 in ss.Set() where null != l3.OneToOne_Optional_FK_Inverse3.OneToOne_Optional_FK_Inverse2 select l3); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_multiple_nav_prop_reference_optional_compared_to_null5(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.OneToOne_Optional_FK1.OneToOne_Required_FK2.OneToOne_Required_FK3 == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_multiple_nav_prop_reference_required(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => (int?)e.OneToOne_Required_FK1.OneToOne_Required_FK2.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_multiple_nav_prop_reference_required2(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => e.OneToOne_Required_FK_Inverse3.OneToOne_Required_FK_Inverse2.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_multiple_nav_prop_optional_required(bool async) => AssertQueryScalar( async, ss => from l1 in ss.Set() select (int?)l1.OneToOne_Optional_FK1.OneToOne_Required_FK2.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_multiple_nav_prop_optional_required(bool async) => AssertQuery( async, @@ -717,8 +646,7 @@ from l1 in ss.Set() where l1.OneToOne_Optional_FK1.OneToOne_Required_FK2.Name != "L3 05" select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_navigation_comparison1(bool async) => AssertQuery( async, @@ -734,8 +662,7 @@ from l12 in ss.Set() select new { Id1 = l11.Id, Id2 = l12.Id }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_navigation_comparison2(bool async) => AssertQuery( async, @@ -751,8 +678,7 @@ from l2 in ss.Set() select new { Id1 = l1.Id, Id2 = l2.Id }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_navigation_comparison3(bool async) => AssertQuery( async, @@ -768,8 +694,7 @@ from l2 in ss.Set() select new { Id1 = l1.Id, Id2 = l2.Id }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_complex_predicate_with_with_nav_prop_and_OrElse1(bool async) => AssertQuery( async, @@ -780,8 +705,7 @@ from l2 in ss.Set() select new { Id1 = (int?)l1.Id, Id2 = (int?)l2.Id }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_complex_predicate_with_with_nav_prop_and_OrElse2(bool async) => AssertQueryScalar( async, @@ -789,8 +713,7 @@ public virtual Task Where_complex_predicate_with_with_nav_prop_and_OrElse2(bool where l1.OneToOne_Optional_FK1.OneToOne_Required_FK2.Name == "L3 05" || l1.OneToOne_Optional_FK1.Name != "L2 05" select l1.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_complex_predicate_with_with_nav_prop_and_OrElse3(bool async) => AssertQueryScalar( async, @@ -798,8 +721,7 @@ public virtual Task Where_complex_predicate_with_with_nav_prop_and_OrElse3(bool where l1.OneToOne_Optional_FK1.Name != "L2 05" || l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.Name == "L3 05" select l1.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_complex_predicate_with_with_nav_prop_and_OrElse4(bool async) => AssertQueryScalar( async, @@ -808,20 +730,17 @@ public virtual Task Where_complex_predicate_with_with_nav_prop_and_OrElse4(bool || l3.OneToOne_Required_FK_Inverse3.OneToOne_Optional_FK_Inverse2.Name == "L1 05" select l3.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_navigations_with_predicate_projected_into_anonymous_type(bool async) => AssertQuery( async, ss => ss.Set() - .Where( - e => e.OneToOne_Required_FK1.OneToOne_Required_FK2 == e.OneToOne_Required_FK1.OneToOne_Optional_FK2 - && e.OneToOne_Required_FK1.OneToOne_Optional_FK2.Id != 7) + .Where(e => e.OneToOne_Required_FK1.OneToOne_Required_FK2 == e.OneToOne_Required_FK1.OneToOne_Optional_FK2 + && e.OneToOne_Required_FK1.OneToOne_Optional_FK2.Id != 7) .Select(e => new { e.Name, Id = (int?)e.OneToOne_Required_FK1.OneToOne_Optional_FK2.Id }), elementSorter: e => (e.Name, e.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_navigations_with_predicate_projected_into_anonymous_type2(bool async) => AssertQuery( async, @@ -832,20 +751,18 @@ where e.OneToOne_Required_FK_Inverse3.OneToOne_Required_FK_Inverse2 select new { e.Name, Id = (int?)e.OneToOne_Required_FK_Inverse3.OneToOne_Optional_FK_Inverse2.Id }, e => (e.Name, e.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_projected_into_DTO(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new MyOuterDto - { - Id = e.Id, - Name = e.Name, - Inner = e.OneToOne_Optional_FK1 != null - ? new MyInnerDto { Id = e.OneToOne_Optional_FK1.Id, Name = e.OneToOne_Optional_FK1.Name } - : null - }), + ss => ss.Set().Select(e => new MyOuterDto + { + Id = e.Id, + Name = e.Name, + Inner = e.OneToOne_Optional_FK1 != null + ? new MyInnerDto { Id = e.OneToOne_Optional_FK1.Id, Name = e.OneToOne_Optional_FK1.Name } + : null + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -869,16 +786,14 @@ public class MyInnerDto public string Name { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_nav_prop_reference_optional(bool async) => AssertQueryScalar( async, ss => ss.Set().OrderBy(e => e.OneToOne_Optional_FK1.Name).ThenBy(e => e.Id).Select(e => e.Id), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_nav_prop_reference_optional_via_DefaultIfEmpty(bool async) => AssertQueryScalar( async, @@ -889,8 +804,7 @@ from l2 in groupJoin.DefaultIfEmpty() select l1.Id, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Result_operator_nav_prop_reference_optional_Sum(bool async) => AssertSum( async, @@ -899,8 +813,7 @@ public virtual Task Result_operator_nav_prop_reference_optional_Sum(bool async) actualSelector: e => e.OneToOne_Optional_FK1.Level1_Required_Id, expectedSelector: e => e.OneToOne_Optional_FK1.MaybeScalar(x => x.Level1_Required_Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Result_operator_nav_prop_reference_optional_Min(bool async) => AssertMin( async, @@ -909,8 +822,7 @@ public virtual Task Result_operator_nav_prop_reference_optional_Min(bool async) actualSelector: e => e.OneToOne_Optional_FK1.Level1_Required_Id, expectedSelector: e => e.OneToOne_Optional_FK1.MaybeScalar(x => x.Level1_Required_Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Result_operator_nav_prop_reference_optional_Max(bool async) => AssertMax( async, @@ -919,8 +831,7 @@ public virtual Task Result_operator_nav_prop_reference_optional_Max(bool async) actualSelector: e => e.OneToOne_Optional_FK1.Level1_Required_Id, expectedSelector: e => e.OneToOne_Optional_FK1.MaybeScalar(x => x.Level1_Required_Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Result_operator_nav_prop_reference_optional_Average(bool async) => AssertAverage( async, @@ -929,23 +840,20 @@ public virtual Task Result_operator_nav_prop_reference_optional_Average(bool asy actualSelector: e => e.OneToOne_Optional_FK1.Level1_Required_Id, expectedSelector: e => e.OneToOne_Optional_FK1.MaybeScalar(x => x.Level1_Required_Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Result_operator_nav_prop_reference_optional_Average_with_identity_selector(bool async) => AssertAverage( async, ss => ss.Set().Select(e => (int?)e.OneToOne_Optional_FK1.Level1_Required_Id), selector: e => e); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Result_operator_nav_prop_reference_optional_Average_without_selector(bool async) => AssertAverage( async, ss => ss.Set().Select(e => (int?)e.OneToOne_Optional_FK1.Level1_Required_Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Result_operator_nav_prop_reference_optional_via_DefaultIfEmpty(bool async) => AssertSum( async, @@ -955,8 +863,7 @@ from l2 in groupJoin.DefaultIfEmpty() select l2, selector: e => e == null ? 0 : e.Level1_Required_Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_optional_navigation(bool async) => AssertQuery( async, @@ -965,8 +872,7 @@ public virtual Task Include_with_optional_navigation(bool async) select l1, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_flattening_bug_4539(bool async) => AssertQuery( async, @@ -979,8 +885,7 @@ join l2_Required_Reverse in ss.Set() on l2.Level1_Required_Id equals l2_ select new { l1_Optional, l2_Required_Reverse }, elementSorter: e => (e.l1_Optional?.Id, e.l2_Required_Reverse.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_source_materialization_bug_4547(bool async) => AssertQueryScalar( async, @@ -1004,44 +909,38 @@ from subQuery3 in grouping.DefaultIfEmpty() ).Where(x => x != null).FirstOrDefault() select e1.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_navigation_property(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(l1 => l1.OneToMany_Optional1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_navigation_property_and_projection(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(l1 => l1.OneToMany_Optional1).Select(e => e.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_navigation_property_and_filter_before(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.Id == 1).SelectMany(l1 => l1.OneToMany_Optional1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_navigation_property_and_filter_after(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(l1 => l1.OneToMany_Optional1).Where(e => e.Id != 6)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_nested_navigation_property_required(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(l1 => l1.OneToOne_Required_FK1.OneToMany_Optional2), ss => ss.Set().SelectMany(l1 => l1.OneToOne_Required_FK1.OneToMany_Optional2 ?? new List())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_nested_navigation_property_optional_and_projection(bool async) => AssertQuery( async, @@ -1049,48 +948,40 @@ public virtual Task SelectMany_nested_navigation_property_optional_and_projectio ss => ss.Set().SelectMany(l1 => l1.OneToOne_Optional_FK1.OneToMany_Optional2 ?? new List()) .Select(e => e.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_SelectMany_calls(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(e => e.OneToMany_Optional1).SelectMany(e => e.OneToMany_Optional2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_navigation_property_with_another_navigation_in_subquery(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(l1 => l1.OneToMany_Optional1.Select(l2 => l2.OneToOne_Optional_FK2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_navigation_property_to_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(l1 => l1.OneToOne_Required_FK1.OneToMany_Optional2.Count > 0), ss => ss.Set().Where(l1 => l1.OneToOne_Required_FK1.OneToMany_Optional2.MaybeScalar(x => x.Count) > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_navigation_property_to_collection2(bool async) => AssertQuery( async, ss => ss.Set().Where(l3 => l3.OneToOne_Required_FK_Inverse3.OneToMany_Optional2.Count > 0), - ss => ss.Set().Where( - l3 => l3.OneToOne_Required_FK_Inverse3.OneToMany_Optional2.MaybeScalar(x => x.Count) > 0)); + ss => ss.Set().Where(l3 => l3.OneToOne_Required_FK_Inverse3.OneToMany_Optional2.MaybeScalar(x => x.Count) > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_navigation_property_to_collection_of_original_entity_type(bool async) => AssertQuery( async, ss => ss.Set().Where(l2 => l2.OneToMany_Required_Inverse2.OneToMany_Optional1.Count() > 0), - ss => ss.Set().Where( - l2 => l2.OneToMany_Required_Inverse2.OneToMany_Optional1.MaybeScalar(x => x.Count()) > 0)); + ss => ss.Set().Where(l2 => l2.OneToMany_Required_Inverse2.OneToMany_Optional1.MaybeScalar(x => x.Count()) > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_subquery_doesnt_project_unnecessary_columns_in_top_level(bool async) => AssertQuery( async, @@ -1099,8 +990,7 @@ public virtual Task Correlated_subquery_doesnt_project_unnecessary_columns_in_to where ss.Set().Any(l2 => l2.Level1_Required_Id == l1.Id) select l1.Name).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_subquery_doesnt_project_unnecessary_columns_in_top_level_join(bool async) => AssertQuery( async, @@ -1110,8 +1000,7 @@ where ss.Set().Any(l2 => l2.Level1_Required_Id == e1.Id) select new { Name1 = e1.Name, Id2 = e2.Id }, e => (e.Name1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_nested_subquery_doesnt_project_unnecessary_columns_in_top_level(bool async) => AssertQuery( async, @@ -1119,8 +1008,7 @@ public virtual Task Correlated_nested_subquery_doesnt_project_unnecessary_column where ss.Set().Any(l2 => ss.Set().Select(l3 => l2.Id).Any()) select l1.Name).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_nested_two_levels_up_subquery_doesnt_project_unnecessary_columns_in_top_level(bool async) => AssertQuery( async, @@ -1129,15 +1017,13 @@ where ss.Set().Any(l2 => ss.Set().Select(l3 => l1.Id).Any()) select l1.Name).Distinct() ); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_where_with_subquery(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(l1 => l1.OneToMany_Required1).Where(l2 => l2.OneToMany_Required2.Any())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_key_of_projected_navigation_doesnt_get_optimized_into_FK_access1(bool async) => AssertQuery( async, @@ -1145,8 +1031,7 @@ public virtual Task Order_by_key_of_projected_navigation_doesnt_get_optimized_in elementAsserter: (e, a) => AssertEqual(e, a), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_key_of_projected_navigation_doesnt_get_optimized_into_FK_access2(bool async) => AssertQuery( async, @@ -1155,8 +1040,7 @@ public virtual Task Order_by_key_of_projected_navigation_doesnt_get_optimized_in elementAsserter: (e, a) => AssertEqual(e, a), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_key_of_projected_navigation_doesnt_get_optimized_into_FK_access3(bool async) => AssertQuery( async, @@ -1165,8 +1049,7 @@ public virtual Task Order_by_key_of_projected_navigation_doesnt_get_optimized_in elementAsserter: (e, a) => AssertEqual(e, a), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_key_of_navigation_similar_to_projected_gets_optimized_into_FK_access(bool async) => AssertQuery( async, @@ -1176,8 +1059,7 @@ orderby l3.OneToOne_Required_FK_Inverse3.Id elementAsserter: (e, a) => AssertEqual(e, a), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_key_of_projected_navigation_doesnt_get_optimized_into_FK_access_subquery(bool async) => AssertQuery( async, @@ -1188,21 +1070,18 @@ public virtual Task Order_by_key_of_projected_navigation_doesnt_get_optimized_in .Select(l2 => l2.OneToOne_Required_FK_Inverse2.Name), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_key_of_anonymous_type_projected_navigation_doesnt_get_optimized_into_FK_access_subquery(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - l3 => new { l3.OneToOne_Required_FK_Inverse3, name = l3.Name }) + .Select(l3 => new { l3.OneToOne_Required_FK_Inverse3, name = l3.Name }) .OrderBy(l3 => l3.OneToOne_Required_FK_Inverse3.Id) .Take(10) .Select(l2 => l2.OneToOne_Required_FK_Inverse3.Name), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_take_optional_navigation(bool async) => AssertQuery( async, @@ -1213,8 +1092,7 @@ public virtual Task Optional_navigation_take_optional_navigation(bool async) .Select(l2 => l2.OneToOne_Optional_FK2.Name), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_select_correct_table_from_subquery_when_materialization_is_not_required(bool async) => AssertQuery( async, @@ -1225,8 +1103,7 @@ public virtual Task Projection_select_correct_table_from_subquery_when_materiali .Select(l2 => l2.Name)); // see issue #31887 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_select_correct_table_with_anonymous_projection_in_subquery(bool async) => AssertQuery( async, @@ -1241,8 +1118,7 @@ join l3 in ss.Set() on l1.Id equals l3.Level2_Required_Id .Select(l => l.l2.Name)); // see issue #31887 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_select_correct_table_in_subquery_when_materialization_is_not_required_in_multiple_joins(bool async) => AssertQuery( async, @@ -1253,8 +1129,7 @@ join l3 in ss.Set() on l1.Id equals l3.Level2_Required_Id //where l3.Name == "L3 08" select l1).OrderBy(l1 => l1.Id).Take(3).Select(l1 => l1.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_predicate_on_optional_reference_navigation(bool async) => AssertQuery( async, @@ -1264,8 +1139,7 @@ public virtual Task Where_predicate_on_optional_reference_navigation(bool async) .Take(3) .Select(l1 => l1.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_string_based_Include1(bool async) => AssertQuery( async, @@ -1274,8 +1148,7 @@ public virtual Task SelectMany_with_string_based_Include1(bool async) .Include("OneToOne_Required_FK2"), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Required_FK2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_EF_Property_Include1(bool async) => AssertQuery( async, @@ -1284,8 +1157,7 @@ public virtual Task SelectMany_with_EF_Property_Include1(bool async) .Include(l2 => EF.Property(l2, "OneToOne_Required_FK2")), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Required_FK2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_string_based_Include2(bool async) => AssertQuery( async, @@ -1296,8 +1168,7 @@ public virtual Task SelectMany_with_string_based_Include2(bool async) e, a, new ExpectedInclude(l2 => l2.OneToOne_Required_FK2), new ExpectedInclude(l3 => l3.OneToOne_Required_FK3, "OneToOne_Required_FK2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_SelectMany_with_string_based_Include(bool async) => AssertQuery( async, @@ -1307,8 +1178,7 @@ public virtual Task Multiple_SelectMany_with_string_based_Include(bool async) .Include("OneToOne_Required_FK3"), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l3 => l3.OneToOne_Required_FK3))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_SelectMany_with_EF_Property_Include(bool async) => AssertQuery( async, @@ -1318,95 +1188,80 @@ public virtual Task Multiple_SelectMany_with_EF_Property_Include(bool async) .Include(l3 => EF.Property(l3, "OneToOne_Required_FK3")), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l3 => l3.OneToOne_Required_FK3))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_required_navigations_with_Include(bool async) // Include after select. Issue #16752. - => AssertIncludeOnNonEntity( - () => AssertQuery( - async, - ss => ss.Set() - .Select(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3) - .Include(l2 => l2.OneToOne_Optional_FK2), - elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); + => AssertIncludeOnNonEntity(() => AssertQuery( + async, + ss => ss.Set() + .Select(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3) + .Include(l2 => l2.OneToOne_Optional_FK2), + elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_required_navigation_using_multiple_selects_with_Include(bool async) // Include after select. Issue #16752. - => AssertIncludeOnNonEntity( - () => AssertQuery( - async, - ss => ss.Set() - .Select(l4 => l4.OneToOne_Required_FK_Inverse4) - .Select(l3 => l3.OneToOne_Required_FK_Inverse3) - .Include(l2 => l2.OneToOne_Optional_FK2), - elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertIncludeOnNonEntity(() => AssertQuery( + async, + ss => ss.Set() + .Select(l4 => l4.OneToOne_Required_FK_Inverse4) + .Select(l3 => l3.OneToOne_Required_FK_Inverse3) + .Include(l2 => l2.OneToOne_Optional_FK2), + elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_required_navigation_with_string_based_Include(bool async) // Include after select. Issue #16752. - => AssertIncludeOnNonEntity( - () => AssertQuery( - async, - ss => ss.Set() - .Select(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3) - .Include("OneToOne_Optional_FK2"), - elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); + => AssertIncludeOnNonEntity(() => AssertQuery( + async, + ss => ss.Set() + .Select(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3) + .Include("OneToOne_Optional_FK2"), + elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_required_navigation_with_EF_Property_Include(bool async) // Include after select. Issue #16752. - => AssertIncludeOnNonEntity( - () => AssertQuery( - async, - ss => ss.Set() - .Select(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3) - .Include(l2 => EF.Property(l2, "OneToOne_Optional_FK2")), - elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); + => AssertIncludeOnNonEntity(() => AssertQuery( + async, + ss => ss.Set() + .Select(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3) + .Include(l2 => EF.Property(l2, "OneToOne_Optional_FK2")), + elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_required_navigation_using_multiple_selects_with_string_based_Include(bool async) // Include after select. Issue #16752. - => AssertIncludeOnNonEntity( - () => AssertQuery( - async, - ss => ss.Set() - .Select(l4 => l4.OneToOne_Required_FK_Inverse4) - .Select(l3 => l3.OneToOne_Required_FK_Inverse3) - .Include("OneToOne_Optional_FK2"), - elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertIncludeOnNonEntity(() => AssertQuery( + async, + ss => ss.Set() + .Select(l4 => l4.OneToOne_Required_FK_Inverse4) + .Select(l3 => l3.OneToOne_Required_FK_Inverse3) + .Include("OneToOne_Optional_FK2"), + elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_required_navigation_using_multiple_selects_with_EF_Property_Include(bool async) // Include after select. Issue #16752. - => AssertIncludeOnNonEntity( - () => AssertQuery( - async, - ss => ss.Set() - .Select(l4 => l4.OneToOne_Required_FK_Inverse4) - .Select(l3 => l3.OneToOne_Required_FK_Inverse3) - .Include(l2 => EF.Property(l2, "OneToOne_Optional_FK2")), - elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertIncludeOnNonEntity(() => AssertQuery( + async, + ss => ss.Set() + .Select(l4 => l4.OneToOne_Required_FK_Inverse4) + .Select(l3 => l3.OneToOne_Required_FK_Inverse3) + .Include(l2 => EF.Property(l2, "OneToOne_Optional_FK2")), + elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_with_Include(bool async) // Include after select. Issue #16752. - => AssertIncludeOnNonEntity( - () => AssertQuery( - async, - ss => ss.Set() - .Select(l1 => l1.OneToOne_Optional_FK1) - .Include(l2 => l2.OneToOne_Optional_FK2), - elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); + => AssertIncludeOnNonEntity(() => AssertQuery( + async, + ss => ss.Set() + .Select(l1 => l1.OneToOne_Optional_FK1) + .Include(l2 => l2.OneToOne_Optional_FK2), + elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_navigation_and_explicit_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -1416,8 +1271,7 @@ from l2 in l1.OneToMany_Optional1.DefaultIfEmpty() where l2 != null select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_navigation_filter_and_explicit_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -1426,8 +1280,7 @@ from l2 in l1.OneToMany_Optional1.Where(l => l.Id > 5).DefaultIfEmpty() where l2 != null select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_nested_navigation_and_explicit_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -1440,8 +1293,7 @@ from l3 in l1.OneToOne_Required_FK1.OneToMany_Optional2.DefaultIfEmpty() where l3 != null select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_nested_navigation_filter_and_explicit_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -1454,8 +1306,7 @@ from l3 in l1.OneToOne_Optional_FK1.OneToMany_Optional2.Where(l => l.Id > 5).Def where l3 != null select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_nested_required_navigation_filter_and_explicit_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -1468,20 +1319,19 @@ from l3 in l1.OneToOne_Required_FK1.OneToMany_Required2.Where(l => l.Id > 5).Def where l3 != null select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_nested_navigations_and_additional_joins_outside_of_SelectMany(bool async) => AssertQuery( async, ss => from l1 in ss.Set() - join l2 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2) on l1.Id + join l2 in ss.Set().SelectMany(l4 + => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2) on l1.Id equals l2.Level1_Optional_Id select new { l1, l2 }, ss => from l1 in ss.Set() - join l2 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2 - ?? new List()) on l1.Id + join l2 in ss.Set().SelectMany(l4 + => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2 + ?? new List()) on l1.Id equals l2.Level1_Optional_Id select new { l1, l2 }, elementSorter: e => (e.l1.Id, e.l2.Id), @@ -1491,16 +1341,15 @@ equals l2.Level1_Optional_Id AssertEqual(e.l2, a.l2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany( bool async) => AssertQuery( async, ss => from l1 in ss.Set() - join l2 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2 - .DefaultIfEmpty()) + join l2 in ss.Set().SelectMany(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3 + .OneToMany_Required_Self2 + .DefaultIfEmpty()) on l1.Id equals l2.Level1_Optional_Id select new { l1, l2 }, elementSorter: e => (e.l1?.Id, e.l2?.Id), @@ -1510,14 +1359,13 @@ on l1.Id equals l2.Level1_Optional_Id AssertEqual(e.l2, a.l2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany2( bool async) => AssertQuery( async, - ss => from l2 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2.DefaultIfEmpty()) + ss => from l2 in ss.Set().SelectMany(l4 + => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2.DefaultIfEmpty()) join l1 in ss.Set() on l2.Level1_Optional_Id equals l1.Id select new { l2, l1 }, elementSorter: e => (e.l2?.Id, e.l1?.Id), @@ -1527,14 +1375,13 @@ join l1 in ss.Set() on l2.Level1_Optional_Id equals l1.Id AssertEqual(e.l1, a.l1); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany3( bool async) => AssertQuery( async, - ss => from l4 in ss.Set().SelectMany( - l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) + ss => from l4 in ss.Set() + .SelectMany(l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) join l2 in ss.Set() on l4.Id equals l2.Id select new { l4, l2 }, elementSorter: e => (e.l4?.Id, e.l2?.Id), @@ -1544,14 +1391,13 @@ join l2 in ss.Set() on l4.Id equals l2.Id AssertEqual(e.l2, a.l2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany4( bool async) => AssertQuery( async, - ss => from l4 in ss.Set().SelectMany( - l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) + ss => from l4 in ss.Set() + .SelectMany(l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) join l2 in ss.Set() on l4.Id equals l2.Id into grouping from l2 in grouping.DefaultIfEmpty() select new { l4, l2 }, @@ -1562,16 +1408,15 @@ from l2 in grouping.DefaultIfEmpty() AssertEqual(e.l2, a.l2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_joined_together(bool async) => AssertQuery( async, - ss => from l4 in ss.Set().SelectMany( - l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) - join l2 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2 - .DefaultIfEmpty()) + ss => from l4 in ss.Set() + .SelectMany(l1 => l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty()) + join l2 in ss.Set().SelectMany(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3 + .OneToMany_Required_Self2 + .DefaultIfEmpty()) on l4.Id equals l2.Id select new { l4, l2 }, elementSorter: e => (e.l4?.Id, e.l2?.Id), @@ -1581,19 +1426,17 @@ on l4.Id equals l2.Id AssertEqual(e.l2, a.l2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_followed_by_Select_required_navigation_using_same_navs( bool async) => AssertQuery( async, - ss => from l3 in ss.Set().SelectMany( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty()) + ss => from l3 in ss.Set().SelectMany(l4 + => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty()) select l3.OneToOne_Required_FK_Inverse3.OneToOne_Required_PK_Inverse2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_followed_by_Select_required_navigation_using_different_navs( bool async) @@ -1602,8 +1445,7 @@ public virtual Task ss => from l3 in ss.Set().SelectMany(l1 => l1.OneToOne_Optional_FK1.OneToMany_Optional2.DefaultIfEmpty()) select l3.OneToOne_Required_FK_Inverse3.OneToOne_Required_PK_Inverse2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_SelectMany_with_navigation_and_explicit_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -1613,8 +1455,7 @@ from l3 in l2.OneToMany_Optional2.Where(l => l.Id > 5).DefaultIfEmpty() where l3 != null select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_navigation_filter_paging_and_explicit_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -1623,8 +1464,7 @@ from l2 in l1.OneToMany_Required1.Where(l => l.Id > 5).OrderBy(l => l.Id).Take(3 where l2 != null select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_join_subquery_containing_filter_and_distinct(bool async) => AssertQuery( async, @@ -1639,8 +1479,7 @@ join l2 in ss.Set().Where(l => l.Id > 2).Distinct() on l1.Id equals l2.L AssertEqual(e.l2, a.l2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_join_with_key_selector_being_a_subquery(bool async) => AssertQuery( async, @@ -1654,45 +1493,38 @@ join l2 in ss.Set() on l1.Id equals ss.Set().Select(l => l.Id).O AssertEqual(e.l2, a.l2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_subquery_optional_navigation_and_constant_item(bool async) => AssertQuery( async, ss => ss.Set().Where(l1 => l1.OneToOne_Optional_FK1.OneToMany_Optional2.Distinct().Select(l3 => l3.Id).Contains(6)), - ss => ss.Set().Where( - l1 => l1.OneToOne_Optional_FK1.OneToMany_Optional2.MaybeScalar(x => x.Distinct().Select(l3 => l3.Id).Contains(6)) - == true)); + ss => ss.Set().Where(l1 + => l1.OneToOne_Optional_FK1.OneToMany_Optional2.MaybeScalar(x => x.Distinct().Select(l3 => l3.Id).Contains(6)) + == true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_subquery_optional_navigation_scalar_distinct_and_constant_item(bool async) => AssertQuery( async, - ss => ss.Set().Where( - l1 => l1.OneToOne_Optional_FK1.OneToMany_Optional2.Select(l3 => l3.Name.Length).Distinct().Contains(5)), - ss => ss.Set().Where( - l1 => l1.OneToOne_Optional_FK1.OneToMany_Optional2.MaybeScalar( - x => x.Select(l3 => l3.Name.Length).Distinct().Contains(5)) - == true)); + ss => ss.Set().Where(l1 + => l1.OneToOne_Optional_FK1.OneToMany_Optional2.Select(l3 => l3.Name.Length).Distinct().Contains(5)), + ss => ss.Set().Where(l1 + => l1.OneToOne_Optional_FK1.OneToMany_Optional2.MaybeScalar(x => x.Select(l3 => l3.Name.Length).Distinct().Contains(5)) + == true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_optional_navigations_and_client_side_evaluation(bool async) => AssertQuery( async, - ss => ss.Set().Where( - l1 => l1.Id < 3 - && !l1.OneToMany_Optional1.Select(l2 => l2.OneToOne_Optional_FK2.OneToOne_Optional_FK3.Id) - .All(l4 => ClientMethod(l4))), - ss => ss.Set().Where( - l1 => l1.Id < 3 - && !l1.OneToMany_Optional1.Select(l2 => l2.OneToOne_Optional_FK2.OneToOne_Optional_FK3.MaybeScalar(x => x.Id)) - .All(a => true)), + ss => ss.Set().Where(l1 => l1.Id < 3 + && !l1.OneToMany_Optional1.Select(l2 => l2.OneToOne_Optional_FK2.OneToOne_Optional_FK3.Id) + .All(l4 => ClientMethod(l4))), + ss => ss.Set().Where(l1 => l1.Id < 3 + && !l1.OneToMany_Optional1.Select(l2 => l2.OneToOne_Optional_FK2.OneToOne_Optional_FK3.MaybeScalar(x => x.Id)) + .All(a => true)), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Required_navigation_on_a_subquery_with_First_in_projection(bool async) => AssertQuery( async, @@ -1700,8 +1532,7 @@ public virtual Task Required_navigation_on_a_subquery_with_First_in_projection(b .Where(l2o => l2o.Id == 7) .Select(l2o => ss.Set().OrderBy(l2i => l2i.Id).First().OneToOne_Required_FK_Inverse2.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Required_navigation_on_a_subquery_with_complex_projection_and_First(bool async) => AssertQuery( async, @@ -1716,20 +1547,18 @@ orderby l2i.Id select new { Navigation = l2i.OneToOne_Required_FK_Inverse2, Constant = 7 }).First().Navigation.Name); // see issue #31887 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Required_navigation_on_a_subquery_with_First_in_predicate(bool async) => AssertQuery( async, ss => ss.Set() .Where(l2o => l2o.Id == 7) - .Where( - l1 => EF.Property( - ss.Set().OrderBy(l2i => l2i.Id).First().OneToOne_Required_FK_Inverse2, "Name") - == "L1 10" - || EF.Property( - ss.Set().OrderBy(l2i => l2i.Id).First().OneToOne_Required_FK_Inverse2, "Name") - == "L1 01")); + .Where(l1 => EF.Property( + ss.Set().OrderBy(l2i => l2i.Id).First().OneToOne_Required_FK_Inverse2, "Name") + == "L1 10" + || EF.Property( + ss.Set().OrderBy(l2i => l2i.Id).First().OneToOne_Required_FK_Inverse2, "Name") + == "L1 01")); //=> AssertQuery( // async, // ss => ss.Set() @@ -1739,8 +1568,7 @@ public virtual Task Required_navigation_on_a_subquery_with_First_in_predicate(bo // ss.Set().OrderBy(l2i => l2i.Id).First().OneToOne_Required_FK_Inverse2, "Name") // == "L1 10")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Manually_created_left_join_propagates_nullability_to_navigations(bool async) => AssertQuery( async, @@ -1750,8 +1578,7 @@ from l2_manual in grouping.DefaultIfEmpty() where l2_manual.OneToOne_Required_FK_Inverse2.Name != "L3 02" select l2_manual.OneToOne_Required_FK_Inverse2.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_propagates_nullability_to_manually_created_left_join1(bool async) => AssertQuery( async, @@ -1761,8 +1588,7 @@ from l2 in grouping.DefaultIfEmpty() select new { Id1 = (int?)l2_nav.Id, Id2 = (int?)l2.Id }, elementSorter: e => e.Id1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_propagates_nullability_to_manually_created_left_join2(bool async) => AssertQuery( async, @@ -1773,8 +1599,7 @@ from l2_nav in grouping.DefaultIfEmpty() select new { Name1 = l3.Name, Name2 = l2_nav.Name }, elementSorter: e => (e.Name1, e.Name2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_reference_protection_complex(bool async) => AssertQuery( async, @@ -1788,8 +1613,7 @@ on l3.Level2_Required_Id equals l2_outer.Id into grouping_outer from l2_outer in grouping_outer.DefaultIfEmpty() select l2_outer.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_reference_protection_complex_materialization(bool async) => AssertQuery( async, @@ -1812,8 +1636,7 @@ from l2_outer in grouping_outer.DefaultIfEmpty() private static TResult ClientMethodReturnSelf(TResult element) => element; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_reference_protection_complex_client_eval(bool async) => AssertQuery( async, @@ -1827,8 +1650,7 @@ on l3.Level2_Required_Id equals l2_outer.Id into grouping_outer from l2_outer in grouping_outer.DefaultIfEmpty() select ClientMethodReturnSelf(l2_outer.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_with_complex_subquery_with_joins_does_not_get_flattened(bool async) => AssertQueryScalar( async, @@ -1841,8 +1663,7 @@ on l1_outer.Id equals subquery.Level1_Optional_Id into grouping from subquery in grouping.DefaultIfEmpty() select (int?)subquery.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_with_complex_subquery_with_joins_does_not_get_flattened2(bool async) => AssertQueryScalar( async, @@ -1855,8 +1676,7 @@ on l1_outer.Id equals subquery.Level1_Optional_Id into grouping from subquery in grouping.DefaultIfEmpty() select subquery != null ? (int?)subquery.Id : null); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_with_complex_subquery_with_joins_does_not_get_flattened3(bool async) => AssertQueryScalar( async, @@ -1870,8 +1690,7 @@ on l1_outer.Id equals subquery.Level1_Required_Id into grouping from subquery in grouping.DefaultIfEmpty() select (int?)subquery.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_on_a_subquery_containing_another_GroupJoin_projecting_outer(bool async) => AssertQuery( async, @@ -1886,39 +1705,36 @@ join l2_outer in ss.Set() on x.Id equals l2_outer.Level1_Optional_Id int from l2_outer in grouping_outer.DefaultIfEmpty() select l2_outer.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_on_a_subquery_containing_another_GroupJoin_projecting_outer_with_client_method(bool async) // Translation failed message. Issue #17328. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => - from x in - (from l1 in ss.Set() - join l2 in ss.Set() on l1.Id equals l2.Level1_Optional_Id into grouping - from l2 in grouping.DefaultIfEmpty() - orderby l1.Id - select ClientLevel1(l1)).Take(2) - join l2_outer in ss.Set() on x.Id equals l2_outer.Level1_Optional_Id into grouping_outer - from l2_outer in grouping_outer.DefaultIfEmpty() - select l2_outer.Name, - ss => - from x in - (from l1 in ss.Set() - join l2 in ss.Set() on l1.Id equals l2.Level1_Optional_Id into grouping - from l2 in grouping.DefaultIfEmpty() - orderby l1.Id - select ClientLevel1(l1)).Take(2) - join l2_outer in ss.Set() on x.Id equals l2_outer.Level1_Optional_Id into grouping_outer - from l2_outer in grouping_outer.DefaultIfEmpty() - select l2_outer.Name)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => + from x in + (from l1 in ss.Set() + join l2 in ss.Set() on l1.Id equals l2.Level1_Optional_Id into grouping + from l2 in grouping.DefaultIfEmpty() + orderby l1.Id + select ClientLevel1(l1)).Take(2) + join l2_outer in ss.Set() on x.Id equals l2_outer.Level1_Optional_Id into grouping_outer + from l2_outer in grouping_outer.DefaultIfEmpty() + select l2_outer.Name, + ss => + from x in + (from l1 in ss.Set() + join l2 in ss.Set() on l1.Id equals l2.Level1_Optional_Id into grouping + from l2 in grouping.DefaultIfEmpty() + orderby l1.Id + select ClientLevel1(l1)).Take(2) + join l2_outer in ss.Set() on x.Id equals l2_outer.Level1_Optional_Id into grouping_outer + from l2_outer in grouping_outer.DefaultIfEmpty() + select l2_outer.Name)); private static Level1 ClientLevel1(Level1 arg) => arg; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_on_a_subquery_containing_another_GroupJoin_projecting_inner(bool async) => AssertQuery( async, @@ -1933,8 +1749,7 @@ join l1_outer in ss.Set() on x.Level1_Optional_Id equals l1_outer.Id int from l1_outer in grouping_outer.DefaultIfEmpty() select l1_outer.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_on_a_subquery_containing_another_GroupJoin_with_orderby_on_inner_sequence_projecting_inner( bool async) => AssertQuery( @@ -1950,8 +1765,7 @@ join l1_outer in ss.Set() on x.Level1_Optional_Id equals l1_outer.Id int from l1_outer in grouping_outer.DefaultIfEmpty() select l1_outer.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_on_left_side_being_a_subquery(bool async) => AssertQuery( async, @@ -1961,8 +1775,7 @@ public virtual Task GroupJoin_on_left_side_being_a_subquery(bool async) .Select(x => new { x.Id, Brand = x.OneToOne_Optional_FK1.Name }), e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_on_right_side_being_a_subquery(bool async) => AssertQuery( async, @@ -1977,8 +1790,7 @@ from l1 in grouping.DefaultIfEmpty() private static bool ClientMethod(int? id) => true; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_in_subquery_with_client_result_operator(bool async) => AssertQuery( async, @@ -1992,8 +1804,7 @@ from l2_inner in grouping.DefaultIfEmpty() where l1.Id < 3 select l1.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_in_subquery_with_client_projection(bool async) => AssertQuery( async, @@ -2007,8 +1818,7 @@ select ClientStringMethod(l1_inner.Name)).Count() where l1.Id < 3 select l1.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_in_subquery_with_client_projection_nested1(bool async) => AssertQuery( async, @@ -2027,8 +1837,7 @@ select ClientStringMethod(l1_inner.Name)).Count() where l1_outer.Id < 2 select l1_outer.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_in_subquery_with_client_projection_nested2(bool async) => AssertQuery( async, @@ -2050,8 +1859,7 @@ where l1_outer.Id < 2 private static string ClientStringMethod(string argument) => argument; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_client_method_on_outer(bool async) => AssertQuery( async, @@ -2062,8 +1870,7 @@ from l2 in groupJoin.DefaultIfEmpty() select new { l1.Id, client = ClientMethodNullableInt(l1.Id) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_client_method_in_OrderBy(bool async) => AssertQueryScalar( async, @@ -2077,8 +1884,7 @@ orderby ClientMethodNullableInt(l1.Id), ClientMethodNullableInt(l2 != null ? l2. private static int ClientMethodNullableInt(int? id) => id ?? 0; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_without_DefaultIfEmpty(bool async) => AssertQueryScalar( async, @@ -2087,8 +1893,7 @@ join l2 in ss.Set() on l1.Id equals l2.Level1_Optional_Id into groupJoin from l2 in groupJoin.Select(gg => gg) select l1.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_with_subquery_on_inner(bool async) => AssertQueryScalar( async, @@ -2097,8 +1902,7 @@ join l2 in ss.Set() on l1.Id equals l2.Level1_Optional_Id into groupJoin from l2 in groupJoin.Where(gg => gg.Id > 0).OrderBy(gg => gg.Id).Take(10).DefaultIfEmpty() select l1.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_with_subquery_on_inner_and_no_DefaultIfEmpty(bool async) => AssertQueryScalar( async, @@ -2107,8 +1911,7 @@ join l2 in ss.Set() on l1.Id equals l2.Level1_Optional_Id into groupJoin from l2 in groupJoin.Where(gg => gg.Id > 0).OrderBy(gg => gg.Id).Take(10) select l1.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_in_subquery_with_unrelated_projection(bool async) => AssertQueryScalar( async, @@ -2117,8 +1920,7 @@ public virtual Task Optional_navigation_in_subquery_with_unrelated_projection(bo .Take(15) .Select(l1 => l1.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Explicit_GroupJoin_in_subquery_with_unrelated_projection(bool async) => AssertQueryScalar( async, @@ -2131,8 +1933,7 @@ from l2 in grouping.DefaultIfEmpty() select l1).OrderBy(l1 => l1.Id).Take(15) select l1.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Explicit_GroupJoin_in_subquery_with_unrelated_projection2(bool async) => AssertQueryScalar( async, @@ -2143,8 +1944,7 @@ from l2 in grouping.DefaultIfEmpty() select l1).Distinct() select l1.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Explicit_GroupJoin_in_subquery_with_unrelated_projection3(bool async) => AssertQueryScalar( async, @@ -2155,8 +1955,7 @@ from l2 in grouping.DefaultIfEmpty() select l1.Id).Distinct() select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Explicit_GroupJoin_in_subquery_with_unrelated_projection4(bool async) => AssertQueryScalar( async, @@ -2167,8 +1966,7 @@ from l2 in grouping.DefaultIfEmpty() select l1.Id).Distinct().OrderBy(id => id).Take(20) select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Explicit_GroupJoin_in_subquery_with_scalar_result_operator(bool async) => AssertQuery( async, @@ -2181,8 +1979,7 @@ from l2 in grouping.DefaultIfEmpty() > 4 select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Explicit_GroupJoin_in_subquery_with_multiple_result_operator_distinct_count_materializes_main_clause( bool async) => AssertQuery( @@ -2197,22 +1994,19 @@ from l2 in grouping.DefaultIfEmpty() select l1); // issue #31887 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_on_multilevel_reference_in_subquery_with_outer_projection(bool async) => AssertQuery( async, ss => ss.Set() - .Where( - l3 => l3.OneToMany_Required_Inverse3.OneToOne_Required_FK_Inverse2.Name == "L1 10" - || l3.OneToMany_Required_Inverse3.OneToOne_Required_FK_Inverse2.Name == "L1 01") + .Where(l3 => l3.OneToMany_Required_Inverse3.OneToOne_Required_FK_Inverse2.Name == "L1 10" + || l3.OneToMany_Required_Inverse3.OneToOne_Required_FK_Inverse2.Name == "L1 01") .OrderBy(l3 => l3.Level2_Required_Id) .Skip(0) .Take(10) .Select(l3 => l3.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_condition_optimizations_applied_correctly_when_anonymous_type_with_single_property(bool async) => AssertQuery( async, @@ -2222,8 +2016,7 @@ join l2 in ss.Set() equals new { A = EF.Property(l2, "Level1_Optional_Id") } select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_condition_optimizations_applied_correctly_when_anonymous_type_with_multiple_properties(bool async) => AssertQuery( async, @@ -2241,8 +2034,7 @@ join l2 in ss.Set() } select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_group_join_with_take(bool async) => AssertQuery( async, @@ -2257,8 +2049,7 @@ join l2_outer in ss.Set() on l1_outer.Id equals l2_outer.Level1_Optional from l2_outer in grouping_outer.DefaultIfEmpty() select l2_outer.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_with_same_navigation_compared_to_null(bool async) => AssertQueryScalar( async, @@ -2266,8 +2057,7 @@ public virtual Task Navigation_with_same_navigation_compared_to_null(bool async) where l2.OneToMany_Required_Inverse2.Name != "L1 07" && l2.OneToMany_Required_Inverse2 != null select l2.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multi_level_navigation_compared_to_null(bool async) => AssertQueryScalar( async, @@ -2275,8 +2065,7 @@ public virtual Task Multi_level_navigation_compared_to_null(bool async) where l3.OneToMany_Optional_Inverse3.OneToOne_Required_FK_Inverse2 != null select l3.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multi_level_navigation_with_same_navigation_compared_to_null(bool async) => AssertQueryScalar( async, @@ -2285,8 +2074,7 @@ public virtual Task Multi_level_navigation_with_same_navigation_compared_to_null where l3.OneToMany_Optional_Inverse3.OneToOne_Required_FK_Inverse2 != null select l3.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigations_compared_to_each_other1(bool async) => AssertQuery( async, @@ -2294,8 +2082,7 @@ public virtual Task Navigations_compared_to_each_other1(bool async) where l2.OneToMany_Required_Inverse2 == l2.OneToMany_Required_Inverse2 select l2.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigations_compared_to_each_other2(bool async) => AssertQuery( async, @@ -2303,8 +2090,7 @@ public virtual Task Navigations_compared_to_each_other2(bool async) where l2.OneToMany_Required_Inverse2 == l2.OneToOne_Optional_PK_Inverse2 select l2.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigations_compared_to_each_other3(bool async) => AssertQuery( async, @@ -2312,8 +2098,7 @@ public virtual Task Navigations_compared_to_each_other3(bool async) where l2.OneToMany_Optional2.Select(i => i.OneToOne_Optional_PK_Inverse3 == l2).Any() select l2.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigations_compared_to_each_other4(bool async) => AssertQuery( async, @@ -2322,13 +2107,12 @@ where l2.OneToOne_Required_FK2.OneToMany_Optional3 .Select(i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Required_FK2).Any() select l2.Name, ss => from l2 in ss.Set() - where l2.OneToOne_Required_FK2.OneToMany_Optional3.MaybeScalar( - x => x.Select(i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Required_FK2).Any()) + where l2.OneToOne_Required_FK2.OneToMany_Optional3.MaybeScalar(x + => x.Select(i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Required_FK2).Any()) == true select l2.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigations_compared_to_each_other5(bool async) => AssertQuery( async, @@ -2337,61 +2121,53 @@ where l2.OneToOne_Required_FK2.OneToMany_Optional3 .Select(i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Optional_PK2).Any() select l2.Name, ss => from l2 in ss.Set() - where l2.OneToOne_Required_FK2.OneToMany_Optional3.MaybeScalar( - x => x.Select(i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Optional_PK2).Any()) + where l2.OneToOne_Required_FK2.OneToMany_Optional3.MaybeScalar(x + => x.Select(i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Optional_PK2).Any()) == true select l2.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Level4_Include(bool async) // Include after select. Issue #16752. - => AssertIncludeOnNonEntity( - () => AssertQuery( - async, - ss => ss.Set().Select(l1 => l1.OneToOne_Required_PK1) - .Where(t => t != null) - .Select(l2 => l2.OneToOne_Required_PK2) - .Where(t => t != null) - .Select(l3 => l3.OneToOne_Required_PK3) - .Where(t => t != null) - .Select(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3) - .Include(l2 => l2.OneToOne_Optional_FK2), - elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)), - elementSorter: e => e.Id)); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertIncludeOnNonEntity(() => AssertQuery( + async, + ss => ss.Set().Select(l1 => l1.OneToOne_Required_PK1) + .Where(t => t != null) + .Select(l2 => l2.OneToOne_Required_PK2) + .Where(t => t != null) + .Select(l3 => l3.OneToOne_Required_PK3) + .Where(t => t != null) + .Select(l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3) + .Include(l2 => l2.OneToOne_Optional_FK2), + elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2)), + elementSorter: e => e.Id)); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_collection_navigation_on_optional_reference_to_null(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(l1 => l1.OneToOne_Optional_FK1.OneToMany_Optional2 == null).Select(l1 => l1.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_with_client_eval_and_navigation1(bool async) => AssertQuery( async, ss => ss.Set().Select(l2 => ss.Set().OrderBy(l => l.Id).First().OneToOne_Required_FK_Inverse2.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_with_client_eval_and_navigation2(bool async) => AssertQueryScalar( async, - ss => ss.Set().Select( - l2 => ss.Set().OrderBy(l => l.Id).First().OneToOne_Required_FK_Inverse2.Name == "L1 02")); + ss => ss.Set().Select(l2 => ss.Set().OrderBy(l => l.Id).First().OneToOne_Required_FK_Inverse2.Name == "L1 02")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_with_client_eval_and_multi_level_navigation(bool async) => AssertQuery( async, - ss => ss.Set().Select( - l3 => ss.Set().OrderBy(l => l.Id).First().OneToOne_Required_FK_Inverse3.OneToOne_Required_FK_Inverse2.Name)); + ss => ss.Set().Select(l3 + => ss.Set().OrderBy(l => l.Id).First().OneToOne_Required_FK_Inverse3.OneToOne_Required_FK_Inverse2.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Member_doesnt_get_pushed_down_into_subquery_with_result_operator(bool async) => AssertQuery( async, @@ -2401,8 +2177,7 @@ where l1.Id < 3 select (from l3 in ss.Set() select l3).Distinct().OrderBy(l => l.Id).Skip(1).FirstOrDefault().Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_with_Distinct_Skip_FirstOrDefault_without_OrderBy(bool async) => AssertQuery( async, @@ -2418,8 +2193,7 @@ orderby l3.Id elementSorter: e => e.Key, elementAsserter: (e, a) => Assert.Equal(e.Key, a.Key)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_count(bool async) => AssertQuery( async, @@ -2429,8 +2203,7 @@ public virtual Task Project_collection_navigation_count(bool async) select new { l1.Id, Count = l1.OneToOne_Optional_FK1.OneToMany_Optional2.MaybeScalar(x => x.Count) ?? 0 }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_optional_navigation_property_string_concat(bool async) => AssertQuery( async, @@ -2438,8 +2211,7 @@ public virtual Task Select_optional_navigation_property_string_concat(bool async from l2 in l1.OneToMany_Optional1.Where(l => l.Id > 5).OrderByDescending(l => l.Name).DefaultIfEmpty() select l1.Name + " " + (l2 != null ? l2.Name : "NULL")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Entries_for_detached_entities_are_removed(bool async) { using var context = CreateContext(); @@ -2457,8 +2229,7 @@ public virtual async Task Entries_for_detached_entities_are_removed(bool async) context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_groupby_in_subquery(bool async) => AssertQuery( async, @@ -2468,8 +2239,7 @@ public virtual Task Include_reference_with_groupby_in_subquery(bool async) .Select(g => g.OrderBy(e => e.Id).FirstOrDefault()), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.OneToOne_Optional_FK1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multi_include_with_groupby_in_subquery(bool async) => AssertQuery( async, @@ -2481,8 +2251,7 @@ public virtual Task Multi_include_with_groupby_in_subquery(bool async) e, a, new ExpectedInclude(e1 => e1.OneToOne_Optional_FK1), new ExpectedInclude(e2 => e2.OneToMany_Optional2, "OneToOne_Optional_FK1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_include_multiple_derived_navigation_with_same_name_and_same_type(bool async) => AssertQuery( async, @@ -2491,8 +2260,7 @@ public virtual Task String_include_multiple_derived_navigation_with_same_name_an e, a, new ExpectedInclude(e1 => e1.ReferenceSameType), new ExpectedInclude(e2 => e2.ReferenceSameType))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_include_multiple_derived_navigation_with_same_name_and_different_type(bool async) => AssertQuery( async, @@ -2501,8 +2269,7 @@ public virtual Task String_include_multiple_derived_navigation_with_same_name_an e, a, new ExpectedInclude(e1 => e1.ReferenceDifferentType), new ExpectedInclude(e2 => e2.ReferenceDifferentType))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_include_multiple_derived_navigation_with_same_name_and_different_type_nested_also_includes_partially_matching_navigation_chains( bool async) @@ -2514,8 +2281,7 @@ public virtual Task new ExpectedInclude(e2 => e2.ReferenceDifferentType), new ExpectedInclude(e3 => e3.BaseCollection, "ReferenceDifferentType"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_include_multiple_derived_collection_navigation_with_same_name_and_same_type(bool async) => AssertQuery( async, @@ -2524,8 +2290,7 @@ public virtual Task String_include_multiple_derived_collection_navigation_with_s e, a, new ExpectedInclude(e1 => e1.CollectionSameType), new ExpectedInclude(e2 => e2.CollectionSameType))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_include_multiple_derived_collection_navigation_with_same_name_and_different_type(bool async) => AssertQuery( async, @@ -2534,8 +2299,7 @@ public virtual Task String_include_multiple_derived_collection_navigation_with_s e, a, new ExpectedInclude(e1 => e1.CollectionDifferentType), new ExpectedInclude(e2 => e2.CollectionDifferentType))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_include_multiple_derived_collection_navigation_with_same_name_and_different_type_nested_also_includes_partially_matching_navigation_chains( bool async) @@ -2547,8 +2311,7 @@ public virtual Task new ExpectedInclude(e2 => e2.CollectionDifferentType), new ExpectedInclude(e3 => e3.BaseCollection, "CollectionDifferentType"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_include_multiple_derived_navigations_complex(bool async) => AssertQuery( async, @@ -2561,16 +2324,14 @@ public virtual Task String_include_multiple_derived_navigations_complex(bool asy new ExpectedInclude(e5 => e5.ReferenceSameType, "Collection"), new ExpectedInclude(e6 => e6.ReferenceSameType, "Collection"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nav_rewrite_doesnt_apply_null_protection_for_function_arguments(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(l1 => l1.OneToOne_Optional_PK1 != null) .Select(l1 => Math.Max(l1.OneToOne_Optional_PK1.Level1_Required_Id, 7))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Accessing_optional_property_inside_result_operator_subquery(bool async) { var names = new[] { "Name1", "Name2" }; @@ -2580,25 +2341,20 @@ public virtual Task Accessing_optional_property_inside_result_operator_subquery( ss => ss.Set().Where(l1 => names.All(n => l1.OneToOne_Optional_FK1.Name != n))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_subquery_with_custom_projection(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(l1 => l1.Id).SelectMany( - l1 => l1.OneToMany_Optional1.Select( - l2 => new { l2.Name })).Take(1)); + ss => ss.Set().OrderBy(l1 => l1.Id).SelectMany(l1 => l1.OneToMany_Optional1.Select(l2 => new { l2.Name })).Take(1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include1(bool async) => AssertQuery( async, ss => ss.Set().Include(l1 => l1.OneToOne_Optional_FK1), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include2(bool async) => AssertQuery( async, @@ -2607,8 +2363,7 @@ public virtual Task Include2(bool async) e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1), new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include3(bool async) => AssertQuery( async, @@ -2617,8 +2372,7 @@ public virtual Task Include3(bool async) e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1), new ExpectedInclude(l1 => l1.OneToOne_Optional_PK1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include4(bool async) => AssertQuery( async, @@ -2627,8 +2381,7 @@ public virtual Task Include4(bool async) e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1), new ExpectedInclude(l2 => l2.OneToOne_Optional_PK2, "OneToOne_Optional_FK1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include5(bool async) => AssertQuery( async, @@ -2637,24 +2390,21 @@ public virtual Task Include5(bool async) e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1), new ExpectedInclude(l2 => l2.OneToOne_Optional_PK2, "OneToOne_Optional_FK1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include6(bool async) => AssertQuery( async, ss => ss.Set().Include(l1 => l1.OneToOne_Optional_FK1.OneToOne_Optional_PK2).Select(l1 => l1.OneToOne_Optional_FK1), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_PK2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include7(bool async) => AssertQuery( async, ss => ss.Set().Include(l1 => l1.OneToOne_Optional_FK1.OneToOne_Optional_PK2) .Select(l1 => l1.OneToOne_Optional_PK1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include8(bool async) => AssertQuery( async, @@ -2663,8 +2413,7 @@ public virtual Task Include8(bool async) .Include(l2 => l2.OneToOne_Optional_FK_Inverse2), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK_Inverse2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include9(bool async) => AssertQuery( async, @@ -2673,8 +2422,7 @@ public virtual Task Include9(bool async) .Where(l2 => l2.OneToOne_Optional_FK_Inverse2.Name != "Fubar"), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK_Inverse2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include10(bool async) => AssertQuery( async, @@ -2688,8 +2436,7 @@ public virtual Task Include10(bool async) new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2, "OneToOne_Optional_PK1"), new ExpectedInclude(l3 => l3.OneToOne_Optional_PK3, "OneToOne_Optional_FK1.OneToOne_Optional_FK2"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include11(bool async) => AssertQuery( async, @@ -2711,8 +2458,7 @@ public virtual Task Include11(bool async) new ExpectedInclude(l3 => l3.OneToOne_Optional_PK3, "OneToOne_Optional_PK1.OneToOne_Optional_FK2"), new ExpectedInclude(l2 => l2.OneToOne_Optional_PK2, "OneToOne_Optional_PK1"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include12(bool async) => AssertQuery( async, @@ -2721,8 +2467,7 @@ public virtual Task Include12(bool async) .Select(l1 => l1.OneToOne_Optional_FK1), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l2 => l2.OneToOne_Optional_FK2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include13(bool async) { var expectedIncludes = new IExpectedInclude[] { new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1) }; @@ -2740,20 +2485,18 @@ public virtual Task Include13(bool async) elementSorter: e => e.one.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include14(bool async) => AssertQuery( async, ss => ss.Set() .Include(l1 => l1.OneToOne_Optional_FK1).ThenInclude(l2 => l2.OneToOne_Optional_FK2) - .Select( - l1 => new - { - one = l1, - two = l1.OneToOne_Optional_FK1, - three = l1.OneToOne_Optional_PK1 - }), + .Select(l1 => new + { + one = l1, + two = l1.OneToOne_Optional_FK1, + three = l1.OneToOne_Optional_PK1 + }), elementAsserter: (e, a) => { AssertInclude( @@ -2764,8 +2507,7 @@ public virtual Task Include14(bool async) }, elementSorter: e => e.one.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include17(bool async) { using var ctx = CreateContext(); @@ -2773,45 +2515,40 @@ public virtual Task Include17(bool async) .Include(x => x.foo.OneToOne_Optional_FK2).Distinct(); // Include after select. Issue #16752. - return AssertIncludeOnNonEntity( - () => + return AssertIncludeOnNonEntity(() => + { + if (async) { - if (async) - { - return query.ToListAsync(); - } + return query.ToListAsync(); + } - query.ToList(); - return Task.CompletedTask; - }); + query.ToList(); + return Task.CompletedTask; + }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include18_1(bool async) => AssertQuery( async, ss => ss.Set().Include(x => x.OneToOne_Optional_FK1).Distinct(), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include18_1_1(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(x => x.OneToOne_Required_FK1.Name).Include(x => x.OneToOne_Optional_FK1).Take(10), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include18_2(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.OneToOne_Required_FK1.Name != "Foo").Include(x => x.OneToOne_Optional_FK1).Distinct(), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include18_3(bool async) { using var ctx = CreateContext(); @@ -2824,8 +2561,7 @@ public virtual async Task Include18_3(bool async) _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include18_3_1(bool async) { using var ctx = CreateContext(); @@ -2840,8 +2576,7 @@ public virtual async Task Include18_3_1(bool async) _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include18_3_2(bool async) { using var ctx = CreateContext(); @@ -2855,8 +2590,7 @@ public virtual async Task Include18_3_2(bool async) _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include18_3_3(bool async) => AssertQuery( async, @@ -2866,8 +2600,7 @@ public virtual Task Include18_3_3(bool async) .Distinct(), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(l1 => l1.OneToOne_Optional_FK2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include18_4(bool async) { using var ctx = CreateContext(); @@ -2877,8 +2610,7 @@ public virtual async Task Include18_4(bool async) _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include18(bool async) { using var ctx = CreateContext(); @@ -2892,8 +2624,7 @@ public virtual async Task Include18(bool async) _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include19(bool async) { using var ctx = CreateContext(); @@ -2906,24 +2637,21 @@ public virtual async Task Include19(bool async) _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_all_method_include_gets_ignored(bool async) => AssertAll( async, ss => ss.Set().Include(l1 => l1.OneToOne_Optional_FK1).Include(l1 => l1.OneToMany_Optional1), predicate: l1 => l1.Name != "Foo"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_navigations_in_the_result_selector1(bool async) => AssertQuery( async, ss => ss.Set().Join( ss.Set(), l1 => l1.Id, l2 => l2.Level1_Required_Id, (o, i) => new { o.OneToOne_Optional_FK1, i })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Join_with_navigations_in_the_result_selector2(bool async) { using var ctx = CreateContext(); @@ -2935,8 +2663,7 @@ public virtual async Task Join_with_navigations_in_the_result_selector2(bool asy _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Member_pushdown_chain_3_levels_deep(bool async) { using var ctx = CreateContext(); @@ -2945,25 +2672,25 @@ public virtual async Task Member_pushdown_chain_3_levels_deep(bool async) var query = ctx.LevelOne .OrderBy(l1 => l1.Id) .Where(l1 => ctx.LevelTwo - .OrderBy(l2 => l2.Id) - .Where(l2 => l2.Level1_Optional_Id == l1.Id) - .Select(l2 => ctx.LevelThree - .OrderBy(l3 => l3.Id) - .Where(l3 => l3.Level2_Required_Id == l2.Id) - .Select(l3 => ctx.LevelFour - .Where(bool (Level4 l4) => l4.Level3_Required_Id == l3.Id) - .OrderBy(int (Level4 l4) => l4.Id) + .OrderBy(l2 => l2.Id) + .Where(l2 => l2.Level1_Optional_Id == l1.Id) + .Select(l2 => ctx.LevelThree + .OrderBy(l3 => l3.Id) + .Where(l3 => l3.Level2_Required_Id == l2.Id) + .Select(l3 => ctx.LevelFour + .Where(bool (l4) => l4.Level3_Required_Id == l3.Id) + .OrderBy(int (l4) => l4.Id) + .FirstOrDefault()) .FirstOrDefault()) - .FirstOrDefault()) - .FirstOrDefault() - .Name != "Foo"); + .FirstOrDefault() + .Name + != "Foo"); #pragma warning restore CS9236 _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Member_pushdown_chain_3_levels_deep_entity(bool async) { using var ctx = CreateContext(); @@ -2977,8 +2704,8 @@ public virtual async Task Member_pushdown_chain_3_levels_deep_entity(bool async) .OrderBy(l3 => l3.Id) .Where(l3 => l3.Level2_Required_Id == l2.Id) .Select(l3 => ctx.LevelFour - .Where(bool (Level4 l4) => l4.Level3_Required_Id == l3.Id) - .OrderBy(int (Level4 l4) => l4.Id) + .Where(bool (l4) => l4.Level3_Required_Id == l3.Id) + .OrderBy(int (l4) => l4.Id) .FirstOrDefault()) .FirstOrDefault()) .FirstOrDefault()); @@ -2986,8 +2713,7 @@ public virtual async Task Member_pushdown_chain_3_levels_deep_entity(bool async) _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Member_pushdown_with_collection_navigation_in_the_middle(bool async) { using var ctx = CreateContext(); @@ -2997,30 +2723,27 @@ orderby l1.Id select (from l2 in ctx.LevelTwo orderby l2.Id where l2.Level1_Required_Id == l1.Id - select l2.OneToMany_Optional2.Select( - l3 => (from l4 in ctx.LevelFour - where l4.Level3_Required_Id == l3.Id - orderby l4.Id - select l4).FirstOrDefault()).FirstOrDefault()).FirstOrDefault().Name; + select l2.OneToMany_Optional2.Select(l3 => (from l4 in ctx.LevelFour + where l4.Level3_Required_Id == l3.Id + orderby l4.Id + select l4).FirstOrDefault()).FirstOrDefault()).FirstOrDefault() + .Name; _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Member_pushdown_with_multiple_collections(bool async) => AssertQuery( async, - ss => ss.Set().Select( - l1 => l1.OneToMany_Optional1.OrderBy(l2 => l2.Id).FirstOrDefault().OneToMany_Optional2.OrderBy(l3 => l3.Id) - .FirstOrDefault().Name), - ss => ss.Set().Select( - l1 => l1.OneToMany_Optional1.OrderBy(l2 => l2.Id).FirstOrDefault().Maybe( - x => x.OneToMany_Optional2.OrderBy(l3 => l3.Id) - .FirstOrDefault().Maybe(xx => xx.Name)))); + ss => ss.Set().Select(l1 => l1.OneToMany_Optional1.OrderBy(l2 => l2.Id).FirstOrDefault().OneToMany_Optional2 + .OrderBy(l3 => l3.Id) + .FirstOrDefault().Name), + ss => ss.Set().Select(l1 => l1.OneToMany_Optional1.OrderBy(l2 => l2.Id).FirstOrDefault().Maybe(x => x + .OneToMany_Optional2.OrderBy(l3 => l3.Id) + .FirstOrDefault().Maybe(xx => xx.Name)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_collections_on_same_level(bool async) => AssertQuery( async, @@ -3031,42 +2754,37 @@ public virtual Task Include_multiple_collections_on_same_level(bool async) new ExpectedInclude(l1 => l1.OneToMany_Required1)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_check_removal_applied_recursively(bool async) => AssertQuery( async, - ss => ss.Set().Where( - l1 => - (((l1.OneToOne_Optional_FK1 == null - ? null - : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2) - == null - ? null - : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3) + ss => ss.Set().Where(l1 => + (((l1.OneToOne_Optional_FK1 == null + ? null + : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2) == null ? null - : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3.Name) - == "L4 01")); + : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3) + == null + ? null + : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3.Name) + == "L4 01")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_check_different_structure_does_not_remove_null_checks(bool async) => AssertQuery( async, - ss => ss.Set().Where( - l1 => - (l1.OneToOne_Optional_FK1 == null + ss => ss.Set().Where(l1 => + (l1.OneToOne_Optional_FK1 == null + ? null + : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 == null ? null - : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 == null + : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3 == null ? null - : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3 == null - ? null - : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3.Name) - == "L4 01")); + : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3.Name) + == "L4 01")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_entities_with_different_nullability(bool async) => AssertQueryScalar( async, @@ -3087,8 +2805,7 @@ public virtual Task Union_over_entities_with_different_nullability(bool async) .Where(e => e.l1 == null)) .Select(e => e.l1.MaybeScalar(x => x.Id))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Including_reference_navigation_and_projecting_collection_navigation_2(bool async) => AssertQuery( async, @@ -3097,8 +2814,7 @@ public virtual Task Including_reference_navigation_and_projecting_collection_nav .Include(e => e.OneToMany_Required1) .Select(e => new { e, First = e.OneToMany_Required1.OrderByDescending(e => e.Id).FirstOrDefault() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_collection_count_ThenBy_reference_navigation(bool async) => AssertQuery( async, @@ -3110,36 +2826,31 @@ public virtual Task OrderBy_collection_count_ThenBy_reference_navigation(bool as .ThenBy(l1 => l1.OneToOne_Required_FK1.OneToOne_Required_FK2.Name), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_conditional_is_not_applied_explicitly_for_optional_navigation(bool async) => AssertQuery( async, ss => ss.Set().Where(l1 => l1.OneToOne_Optional_FK1 != null && l1.OneToOne_Optional_FK1.Name == "L2 01")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_selector_cast_using_as(bool async) => AssertSum( async, ss => ss.Set().Select(s => s.Id as int?)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_filter_with_include_selector_cast_using_as(bool async) => AssertQuery( async, ss => ss.Set().Where(l1 => l1.Id > l1.OneToMany_Optional1.Select(l2 => l2.Id as int?).Sum())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_with_joined_where_clause_cast_using_as(bool async) => AssertQuery( async, ss => ss.Set().Where(w => (w.Id + 7) == w.OneToOne_Optional_FK1.Id as int?)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_outside_reference_to_joined_table_correctly_translated_to_apply(bool async) => AssertQuery( async, @@ -3150,24 +2861,20 @@ join l4 in ss.Set() on l3.Id equals l4.Level3_Required_Id from other in ss.Set().Where(x => x.Id <= l2.Id && x.Name == l4.Name).DefaultIfEmpty() select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_SelectMany_correlated_with_join_table_correctly_translated_to_apply(bool async) => AssertQuery( async, - ss => ss.Set().SelectMany( - l1 => l1.OneToMany_Optional1.DefaultIfEmpty().SelectMany( - l2 => l2.OneToOne_Required_PK2.OneToMany_Optional3.DefaultIfEmpty() - .Select( - l4 => new - { - l1Name = l1.Name, - l2Name = l2.OneToOne_Required_PK2.Name, - l3Name = l4.OneToOne_Optional_PK_Inverse4.Name - })))); + ss => ss.Set().SelectMany(l1 => l1.OneToMany_Optional1.DefaultIfEmpty().SelectMany(l2 => l2.OneToOne_Required_PK2 + .OneToMany_Optional3.DefaultIfEmpty() + .Select(l4 => new + { + l1Name = l1.Name, + l2Name = l2.OneToOne_Required_PK2.Name, + l3Name = l4.OneToOne_Optional_PK_Inverse4.Name + })))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_over_optional_navigation_with_null_constant(bool async) { using var ctx = CreateContext(); @@ -3179,44 +2886,38 @@ public virtual async Task Contains_over_optional_navigation_with_null_constant(b Assert.Equal(expected, result); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_optional_navigation_with_null_parameter(bool async) => AssertSingleResult( async, ss => ss.Set().Select(l1 => l1.OneToOne_Optional_FK1).Contains(null), ss => ss.Set().Select(l1 => l1.OneToOne_Optional_FK1).ContainsAsync(null, default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_optional_navigation_with_null_column(bool async) => AssertQuery( async, - ss => ss.Set().Select( - l1 => new - { - l1.Name, - OptionalName = l1.OneToOne_Optional_FK1.Name, - Contains = ss.Set().Select(x => x.OneToOne_Optional_FK1.Name).Contains(l1.OneToOne_Optional_FK1.Name) - }), + ss => ss.Set().Select(l1 => new + { + l1.Name, + OptionalName = l1.OneToOne_Optional_FK1.Name, + Contains = ss.Set().Select(x => x.OneToOne_Optional_FK1.Name).Contains(l1.OneToOne_Optional_FK1.Name) + }), elementSorter: e => (e.Name, e.OptionalName, e.Contains)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_optional_navigation_with_null_entity_reference(bool async) => AssertQuery( async, - ss => ss.Set().Select( - l1 => new - { - l1.Name, - OptionalName = l1.OneToOne_Optional_FK1.Name, - Contains = ss.Set().Select(x => x.OneToOne_Optional_FK1).Contains(l1.OneToOne_Optional_PK1) - }), + ss => ss.Set().Select(l1 => new + { + l1.Name, + OptionalName = l1.OneToOne_Optional_FK1.Name, + Contains = ss.Set().Select(x => x.OneToOne_Optional_FK1).Contains(l1.OneToOne_Optional_PK1) + }), elementSorter: e => (e.Name, e.OptionalName, e.Contains)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Element_selector_with_coalesce_repeated_in_aggregate(bool async) => AssertQueryScalar( async, @@ -3226,47 +2927,43 @@ public virtual Task Element_selector_with_coalesce_repeated_in_aggregate(bool as .Where(g => g.Min(l1 => l1.Id + l1.Id) > 0) .Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_object_constructed_from_group_key_properties(bool async) => AssertQuery( async, ss => ss.Set() .Where(l1 => l1.OneToOne_Optional_FK1 != null) - .GroupBy( - l1 => new - { - l1.Id, - l1.Date, - l1.Name, - InnerId = l1.OneToOne_Optional_FK1.Id, - InnerDate = l1.OneToOne_Optional_FK1.Date, - InnerOptionalId = l1.OneToOne_Optional_FK1.Level1_Optional_Id, - InnerRequiredId = l1.OneToOne_Optional_FK1.Level1_Required_Id, - InnerName = l1.OneToOne_Required_FK1.Name - }) - .Select( - g => new + .GroupBy(l1 => new + { + l1.Id, + l1.Date, + l1.Name, + InnerId = l1.OneToOne_Optional_FK1.Id, + InnerDate = l1.OneToOne_Optional_FK1.Date, + InnerOptionalId = l1.OneToOne_Optional_FK1.Level1_Optional_Id, + InnerRequiredId = l1.OneToOne_Optional_FK1.Level1_Required_Id, + InnerName = l1.OneToOne_Required_FK1.Name + }) + .Select(g => new + { + NestedEntity = new Level1 { - NestedEntity = new Level1 + Id = g.Key.Id, + Name = g.Key.Name, + Date = g.Key.Date, + OneToOne_Optional_FK1 = new Level2 { - Id = g.Key.Id, - Name = g.Key.Name, - Date = g.Key.Date, - OneToOne_Optional_FK1 = new Level2 - { - Id = g.Key.InnerId, - Name = g.Key.InnerName, - Date = g.Key.InnerDate, - Level1_Optional_Id = g.Key.InnerOptionalId, - Level1_Required_Id = g.Key.InnerRequiredId - } - }, - Aggregate = g.Sum(x => x.Name.Length) - })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + Id = g.Key.InnerId, + Name = g.Key.InnerName, + Date = g.Key.InnerDate, + Level1_Optional_Id = g.Key.InnerOptionalId, + Level1_Required_Id = g.Key.InnerRequiredId + } + }, + Aggregate = g.Sum(x => x.Name.Length) + })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_where_required_relationship(bool async) => AssertQuery( async, @@ -3275,8 +2972,7 @@ public virtual Task GroupBy_aggregate_where_required_relationship(bool async) .Select(g => new { g.Key, Max = g.Max(e => e.Id) }) .Where(x => x.Max != 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_where_required_relationship_2(bool async) => AssertQuery( async, @@ -3285,24 +2981,22 @@ public virtual Task GroupBy_aggregate_where_required_relationship_2(bool async) .Select(g => new { g.Key, Max = g.Max(e => e.Id) }) .Where(x => x.Max < 2 || x.Max > 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Member_over_null_check_ternary_and_nested_dto_type(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - l1 => new Level1Dto - { - Id = l1.Id, - Name = l1.Name, - Level2 = l1.OneToOne_Optional_FK1 == null - ? null - : new Level2Dto - { - Id = l1.OneToOne_Optional_FK1.Id, Name = l1.OneToOne_Optional_FK1.Name, - } - }) + .Select(l1 => new Level1Dto + { + Id = l1.Id, + Name = l1.Name, + Level2 = l1.OneToOne_Optional_FK1 == null + ? null + : new Level2Dto + { + Id = l1.OneToOne_Optional_FK1.Id, Name = l1.OneToOne_Optional_FK1.Name, + } + }) .OrderBy(e => e.Level2.Name) .ThenBy(e => e.Id), assertOrder: true, @@ -3335,32 +3029,30 @@ private class Level2Dto public string Name { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Member_over_null_check_ternary_and_nested_anonymous_type(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - l1 => new - { - l1.Id, - l1.Name, - Level2 = l1.OneToOne_Optional_FK1 == null - ? null - : new - { - l1.OneToOne_Optional_FK1.Id, - l1.OneToOne_Optional_FK1.Name, - Level3 = l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 == null - ? null - : new - { - l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Id, - l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Name - } - } - }) + .Select(l1 => new + { + l1.Id, + l1.Name, + Level2 = l1.OneToOne_Optional_FK1 == null + ? null + : new + { + l1.OneToOne_Optional_FK1.Id, + l1.OneToOne_Optional_FK1.Name, + Level3 = l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 == null + ? null + : new + { + l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Id, + l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Name + } + } + }) .Where(e => e.Level2.Level3.Name != "L"), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -3379,8 +3071,7 @@ public virtual Task Member_over_null_check_ternary_and_nested_anonymous_type(boo } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Let_let_contains_from_outer_let(bool async) => AssertQuery( async, @@ -3398,19 +3089,17 @@ from level3 in level3s.DefaultIfEmpty() AssertEqual(e.level3, a.level3); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_conditionals_in_projection(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - l2 => new Level1Dto - { - Id = l2.Id, - Name = l2.OneToOne_Optional_FK2 == null ? null : l2.OneToOne_Optional_FK2.Name, - Level2 = l2.OneToOne_Optional_FK_Inverse2 == null ? null : new Level2Dto() - }), + .Select(l2 => new Level1Dto + { + Id = l2.Id, + Name = l2.OneToOne_Optional_FK2 == null ? null : l2.OneToOne_Optional_FK2.Name, + Level2 = l2.OneToOne_Optional_FK_Inverse2 == null ? null : new Level2Dto() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -3427,8 +3116,7 @@ public virtual Task Multiple_conditionals_in_projection(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Composite_key_join_on_groupby_aggregate_projecting_only_grouping_key(bool async) => AssertQueryScalar( async, @@ -3442,8 +3130,7 @@ public virtual Task Composite_key_join_on_groupby_aggregate_projecting_only_grou }, (o, i) => i.Key)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Composite_key_join_on_groupby_aggregate_projecting_only_grouping_key2(bool async) => AssertQueryScalar( async, @@ -3457,8 +3144,7 @@ public virtual Task Composite_key_join_on_groupby_aggregate_projecting_only_grou }, (o, i) => i.Key)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_joins_groupby_predicate(bool async) => AssertQuery( async, @@ -3479,8 +3165,7 @@ from x in grouping2.DefaultIfEmpty() }, elementSorter: e => (e.Id, e.Name, e.Foo)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_FirstOrDefault_property_accesses_in_projection(bool async) => AssertQuery( async, @@ -3489,38 +3174,34 @@ public virtual Task Collection_FirstOrDefault_property_accesses_in_projection(bo .Where(l1 => l1.Id < 3) .Select(l1 => new { l1.Id, Pushdown = l1.OneToMany_Optional1.Where(x => x.Name == "L2 02").FirstOrDefault().Name })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_FirstOrDefault_entity_reference_accesses_in_projection(bool async) => AssertQuery( async, ss => ss.Set() .Include(x => x.OneToMany_Optional1).ThenInclude(x => x.OneToMany_Optional2) .Where(l1 => l1.Id < 3) - .Select( - l1 => new - { - l1.Id, - Pushdown = l1.OneToMany_Optional1 - .Where(x => x.Name == "L2 02") - .FirstOrDefault().OneToOne_Optional_FK2 - })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .Select(l1 => new + { + l1.Id, + Pushdown = l1.OneToMany_Optional1 + .Where(x => x.Name == "L2 02") + .FirstOrDefault().OneToOne_Optional_FK2 + })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_FirstOrDefault_entity_collection_accesses_in_projection(bool async) => AssertQuery( async, ss => ss.Set() .Where(l1 => l1.Id < 2) - .Select( - l1 => new - { - l1.Id, - Pushdown = l1.OneToMany_Optional1 - .Where(x => x.Name == "L2 02") - .FirstOrDefault().OneToMany_Optional2.ToList() - }), + .Select(l1 => new + { + l1.Id, + Pushdown = l1.OneToMany_Optional1 + .Where(x => x.Name == "L2 02") + .FirstOrDefault().OneToMany_Optional2.ToList() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -3528,26 +3209,23 @@ public virtual Task Collection_FirstOrDefault_entity_collection_accesses_in_proj AssertCollection(e.Pushdown, a.Pushdown); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_collection_FirstOrDefault_followed_by_member_access_in_projection(bool async) => AssertQuery( async, ss => ss.Set() .Where(l1 => l1.Id < 2) - .Select( - l1 => new - { - l1.Id, - Pushdown = l1.OneToMany_Optional1 - .Where(x => x.Name == "L2 02") - .FirstOrDefault().OneToMany_Optional2 - .OrderBy(x => x.Id) - .FirstOrDefault().Name - })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .Select(l1 => new + { + l1.Id, + Pushdown = l1.OneToMany_Optional1 + .Where(x => x.Name == "L2 02") + .FirstOrDefault().OneToMany_Optional2 + .OrderBy(x => x.Id) + .FirstOrDefault().Name + })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_columns_with_same_name_from_different_entities_making_sure_aliasing_works_after_Distinct(bool async) => AssertQuery( async, @@ -3561,17 +3239,15 @@ join l3 in ss.Set() on l2.Id equals l3.Level2_Optional_Id Id3 = l3.Id, Name1 = l1.Name, Name2 = l2.Name - }).Distinct().Select( - x => new - { - Foo = x.Id1, - Bar = x.Id2, - Baz = x.Id3 - }).Take(10), + }).Distinct().Select(x => new + { + Foo = x.Id1, + Bar = x.Id2, + Baz = x.Id3 + }).Take(10), elementSorter: e => (e.Foo, e.Bar, e.Baz)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_let_collection_SelectMany(bool async) // Materialization type. Issue #23302. => AssertInvalidMaterializationType( @@ -3586,15 +3262,13 @@ from die in inner.DefaultIfEmpty() select die ?? l1), "IQueryable"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_without_collection_selector_returning_queryable(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(x => ss.Set().Where(l2 => l2.Id < 10))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_projecting_queryable_followed_by_SelectMany(bool async) => AssertInvalidMaterializationType( () => AssertQuery( @@ -3602,8 +3276,7 @@ public virtual Task Select_projecting_queryable_followed_by_SelectMany(bool asyn ss => ss.Set().Select(x => ss.Set().Where(l2 => l2.Id < 10)).SelectMany(x => x)), "IQueryable"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_result_selector_returning_queryable_throws_validation_error(bool async) => AssertQuery( async, @@ -3611,36 +3284,31 @@ public virtual Task Join_with_result_selector_returning_queryable_throws_validat join l2 in ss.Set() on l1.Id equals l2.Level1_Optional_Id select ss.Set().Where(x => x.Id < 5)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_projecting_queryable_followed_by_Join(bool async) // Materialization type. Issue #23302. => AssertInvalidMaterializationType( () => AssertQuery( async, - ss => ss.Set().Select( - x => ss.Set().Where(l2 => l2.Id < 10)) + ss => ss.Set().Select(x => ss.Set().Where(l2 => l2.Id < 10)) .Join(ss.Set(), o => 7, i => i.Id, (o, i) => i)), "IQueryable"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_projecting_queryable_in_anonymous_projection_followed_by_Join(bool async) // Materialization type. Issue #23302. => AssertInvalidMaterializationType( () => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - Subquery = ss.Set() - .Where(l2 => l2.Id < 10) - }) + ss => ss.Set().Select(x => new + { + Subquery = ss.Set() + .Where(l2 => l2.Id < 10) + }) .Join(ss.Set(), o => 7, i => i.Id, (o, i) => i)), "IQueryable"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties1(bool async) => AssertQuery( async, @@ -3654,8 +3322,7 @@ public virtual Task Project_shadow_properties1(bool async) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties2(bool async) => AssertQuery( async, @@ -3672,8 +3339,7 @@ public virtual Task Project_shadow_properties2(bool async) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties3(bool async) => AssertQuery( async, @@ -3690,8 +3356,7 @@ public virtual Task Project_shadow_properties3(bool async) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties4(bool async) => AssertQuery( async, @@ -3708,8 +3373,7 @@ public virtual Task Project_shadow_properties4(bool async) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties5(bool async) => AssertQuery( async, @@ -3722,8 +3386,7 @@ public virtual Task Project_shadow_properties5(bool async) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties6(bool async) => AssertQuery( async, @@ -3736,8 +3399,7 @@ public virtual Task Project_shadow_properties6(bool async) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties7(bool async) => AssertQuery( async, @@ -3750,8 +3412,7 @@ public virtual Task Project_shadow_properties7(bool async) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties8(bool async) => AssertQuery( async, @@ -3762,8 +3423,7 @@ public virtual Task Project_shadow_properties8(bool async) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties9(bool async) => AssertQuery( async, @@ -3781,8 +3441,7 @@ public virtual Task Project_shadow_properties9(bool async) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties10(bool async) => AssertQuery( async, @@ -3796,8 +3455,7 @@ public virtual Task Project_shadow_properties10(bool async) }, elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Prune_does_not_throw_null_ref(bool async) => AssertQuery( async, @@ -3806,8 +3464,7 @@ public virtual Task Prune_does_not_throw_null_ref(bool async) from l1 in ss.Set().Where(x => x.Id != ids) select l1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_SelectMany_DefaultIfEmpty_with_predicate_using_closure(bool async) { var prm = 10; @@ -3826,8 +3483,7 @@ from l2 in grouping.Where(x => x.Id != prm).DefaultIfEmpty() }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_SelectMany_with_predicate_using_closure(bool async) { var prm = 10; @@ -3846,8 +3502,7 @@ from l2 in grouping.Where(x => x.Id != prm) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_SelectMany_DefaultIfEmpty_with_predicate_using_closure_nested(bool async) { var prm1 = 10; @@ -3875,8 +3530,7 @@ from l3 in grouping2.Where(x => x.Id != prm2).DefaultIfEmpty() }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_SelectMany_with_predicate_using_closure_nested(bool async) { var prm1 = 10; @@ -3904,8 +3558,7 @@ from l3 in grouping2.Where(x => x.Id != prm2) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_SelectMany_DefaultIfEmpty_with_predicate_using_closure_nested_same_param(bool async) { var prm = 10; @@ -3932,8 +3585,7 @@ from l3 in grouping2.Where(x => x.Id != prm).DefaultIfEmpty() }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_SelectMany_with_predicate_using_closure_nested_same_param(bool async) { var prm = 10; @@ -3960,19 +3612,16 @@ from l3 in grouping2.Where(x => x.Id != prm) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_optional_navs_should_not_deadlock(bool async) => AssertCount( async, - ss => ss.Set().Where( - x => x.OneToMany_Optional_Inverse2 != null - && x.OneToMany_Optional_Inverse2.Name.Contains("L1 01") - || x.OneToOne_Optional_FK_Inverse2 != null - && x.OneToOne_Optional_FK_Inverse2.Name.Contains("L1 01"))); + ss => ss.Set().Where(x => x.OneToMany_Optional_Inverse2 != null + && x.OneToMany_Optional_Inverse2.Name.Contains("L1 01") + || x.OneToOne_Optional_FK_Inverse2 != null + && x.OneToOne_Optional_FK_Inverse2.Name.Contains("L1 01"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_check_removal_applied_recursively_complex(bool async) { var userParam = Expression.Parameter(typeof(Level3), "l3"); @@ -4011,26 +3660,23 @@ public virtual Task Null_check_removal_applied_recursively_complex(bool async) new ExpectedInclude(x => x.OneToMany_Optional3))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_projection_with_first(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Results = x.OneToMany_Optional1.OrderBy(xx => xx.Id).First().OneToMany_Optional2 - .Select(xx => xx.OneToOne_Required_FK3.Id) - }), - ss => ss.Set().Select( - x => new - { - x.Id, - Results = x.OneToMany_Optional1.OrderBy(xx => xx.Id).Any() - ? x.OneToMany_Optional1.OrderBy(xx => xx.Id).First().OneToMany_Optional2.Select(xx => xx.OneToOne_Required_FK3.Id) - : new List() - }), + ss => ss.Set().Select(x => new + { + x.Id, + Results = x.OneToMany_Optional1.OrderBy(xx => xx.Id).First().OneToMany_Optional2 + .Select(xx => xx.OneToOne_Required_FK3.Id) + }), + ss => ss.Set().Select(x => new + { + x.Id, + Results = x.OneToMany_Optional1.OrderBy(xx => xx.Id).Any() + ? x.OneToMany_Optional1.OrderBy(xx => xx.Id).First().OneToMany_Optional2.Select(xx => xx.OneToOne_Required_FK3.Id) + : new List() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -4038,31 +3684,28 @@ public virtual Task Correlated_projection_with_first(bool async) AssertCollection(e.Results, a.Results); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_in_multi_level_nested_subquery(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(l1 => l1.Id).Take(2).Select( - x => new + ss => ss.Set().OrderBy(l1 => l1.Id).Take(2).Select(x => new + { + x.Id, + LevelTwos = x.OneToMany_Optional1.AsQueryable().Select(xx => new { - x.Id, - LevelTwos = x.OneToMany_Optional1.AsQueryable().Select( - xx => new + xx.Id, + LevelThree = new + { + xx.OneToOne_Required_FK2.Id, + LevelFour = new { - xx.Id, - LevelThree = new - { - xx.OneToOne_Required_FK2.Id, - LevelFour = new - { - xx.OneToOne_Required_FK2.OneToOne_Required_FK3.Id, - Result = (xx.OneToOne_Required_FK2.OneToMany_Optional3.Max(int? (Level4 xxx) => (int?)xxx.Id) ?? 0) - > 1 - } - } - }).ToList() - }), + xx.OneToOne_Required_FK2.OneToOne_Required_FK3.Id, + Result = (xx.OneToOne_Required_FK2.OneToMany_Optional3.Max(int? (xxx) => xxx.Id) ?? 0) + > 1 + } + } + }).ToList() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -4080,22 +3723,20 @@ public virtual Task Max_in_multi_level_nested_subquery(bool async) }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_select_many_in_projection(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Collection = x.OneToMany_Optional1 - .SelectMany(xx => xx.OneToMany_Optional2) - .OrderBy(xx => xx.Id).Take(12) - .Select(xx => new { xx.Id, RefId = xx.OneToOne_Optional_FK3.Id }).ToList(), - Count = x.OneToMany_Optional1 - .SelectMany(xx => xx.OneToMany_Optional2).Count(xx => xx.Name != "") - }), + ss => ss.Set().Select(x => new + { + x.Id, + Collection = x.OneToMany_Optional1 + .SelectMany(xx => xx.OneToMany_Optional2) + .OrderBy(xx => xx.Id).Take(12) + .Select(xx => new { xx.Id, RefId = xx.OneToOne_Optional_FK3.Id }).ToList(), + Count = x.OneToMany_Optional1 + .SelectMany(xx => xx.OneToMany_Optional2).Count(xx => xx.Name != "") + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -4112,20 +3753,18 @@ public virtual Task Multiple_select_many_in_projection(bool async) AssertEqual(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Single_select_many_in_projection_with_take(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Collection = x.OneToMany_Optional1 - .SelectMany(xx => xx.OneToMany_Optional2) - .OrderBy(xx => xx.Id).Take(12) - .Select(xx => new { xx.Id, RefId = xx.OneToOne_Optional_FK3.Id }).ToList(), - }), + ss => ss.Set().Select(x => new + { + x.Id, + Collection = x.OneToMany_Optional1 + .SelectMany(xx => xx.OneToMany_Optional2) + .OrderBy(xx => xx.Id).Take(12) + .Select(xx => new { xx.Id, RefId = xx.OneToOne_Optional_FK3.Id }).ToList(), + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { diff --git a/test/EFCore.Specification.Tests/Query/ComplexNavigationsSharedTypeQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/ComplexNavigationsSharedTypeQueryTestBase.cs index 1c7c4db433d..569d5b79e5f 100644 --- a/test/EFCore.Specification.Tests/Query/ComplexNavigationsSharedTypeQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/ComplexNavigationsSharedTypeQueryTestBase.cs @@ -11,26 +11,26 @@ public override Task Join_navigation_self_ref(bool async) => AssertTranslationFailed(() => base.Join_navigation_self_ref(async)); public override Task Join_condition_optimizations_applied_correctly_when_anonymous_type_with_multiple_properties(bool async) - => AssertUnableToTranslateEFProperty( - () => base.Join_condition_optimizations_applied_correctly_when_anonymous_type_with_multiple_properties(async)); + => AssertUnableToTranslateEFProperty(() + => base.Join_condition_optimizations_applied_correctly_when_anonymous_type_with_multiple_properties(async)); public override Task Join_condition_optimizations_applied_correctly_when_anonymous_type_with_single_property(bool async) - => AssertUnableToTranslateEFProperty( - () => base.Join_condition_optimizations_applied_correctly_when_anonymous_type_with_single_property(async)); + => AssertUnableToTranslateEFProperty(() + => base.Join_condition_optimizations_applied_correctly_when_anonymous_type_with_single_property(async)); public override Task Multiple_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_joined_together(bool async) - => AssertTranslationFailed( - () => base.Multiple_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_joined_together(async)); + => AssertTranslationFailed(() + => base.Multiple_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_joined_together(async)); public override Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany( bool async) - => AssertTranslationFailed( - () => base.SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany(async)); + => AssertTranslationFailed(() + => base.SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany(async)); public override Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany2( bool async) - => AssertTranslationFailed( - () => base.SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany2(async)); + => AssertTranslationFailed(() + => base.SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany2(async)); public override Task SelectMany_with_nested_navigations_and_additional_joins_outside_of_SelectMany(bool async) => AssertTranslationFailed(() => base.SelectMany_with_nested_navigations_and_additional_joins_outside_of_SelectMany(async)); diff --git a/test/EFCore.Specification.Tests/Query/ComplexTypeQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/ComplexTypeQueryFixtureBase.cs index 857e0dd3ac2..72449e639cd 100644 --- a/test/EFCore.Specification.Tests/Query/ComplexTypeQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/ComplexTypeQueryFixtureBase.cs @@ -27,39 +27,35 @@ protected override Task SeedAsync(PoolableDbContext context) protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - cb => - { - cb.Property(c => c.Id).ValueGeneratedNever(); + modelBuilder.Entity(cb => + { + cb.Property(c => c.Id).ValueGeneratedNever(); - cb.ComplexProperty(c => c.ShippingAddress, sab => sab.ComplexProperty(sa => sa.Country)); - cb.ComplexProperty(c => c.BillingAddress, sab => sab.ComplexProperty(sa => sa.Country)); - }); + cb.ComplexProperty(c => c.ShippingAddress, sab => sab.ComplexProperty(sa => sa.Country)); + cb.ComplexProperty(c => c.BillingAddress, sab => sab.ComplexProperty(sa => sa.Country)); + }); - modelBuilder.Entity( - cgb => - { - cgb.Property(cg => cg.Id).ValueGeneratedNever(); - cgb.Navigation(cg => cg.RequiredCustomer).AutoInclude(); - cgb.Navigation(cg => cg.OptionalCustomer).AutoInclude(); - }); + modelBuilder.Entity(cgb => + { + cgb.Property(cg => cg.Id).ValueGeneratedNever(); + cgb.Navigation(cg => cg.RequiredCustomer).AutoInclude(); + cgb.Navigation(cg => cg.OptionalCustomer).AutoInclude(); + }); - modelBuilder.Entity( - cb => - { - cb.Property(c => c.Id).ValueGeneratedNever(); + modelBuilder.Entity(cb => + { + cb.Property(c => c.Id).ValueGeneratedNever(); - cb.ComplexProperty(c => c.ShippingAddress, sab => sab.ComplexProperty(sa => sa.Country)); - cb.ComplexProperty(c => c.BillingAddress, sab => sab.ComplexProperty(sa => sa.Country)); - }); + cb.ComplexProperty(c => c.ShippingAddress, sab => sab.ComplexProperty(sa => sa.Country)); + cb.ComplexProperty(c => c.BillingAddress, sab => sab.ComplexProperty(sa => sa.Country)); + }); - modelBuilder.Entity( - cgb => - { - cgb.Property(cg => cg.Id).ValueGeneratedNever(); - cgb.Navigation(cg => cg.RequiredCustomer).AutoInclude(); - cgb.Navigation(cg => cg.OptionalCustomer).AutoInclude(); - }); + modelBuilder.Entity(cgb => + { + cgb.Property(cg => cg.Id).ValueGeneratedNever(); + cgb.Navigation(cg => cg.RequiredCustomer).AutoInclude(); + cgb.Navigation(cg => cg.OptionalCustomer).AutoInclude(); + }); } public Func GetContextCreator() diff --git a/test/EFCore.Specification.Tests/Query/ComplexTypeQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/ComplexTypeQueryTestBase.cs index 489de9ba4fe..02543feb6b2 100644 --- a/test/EFCore.Specification.Tests/Query/ComplexTypeQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/ComplexTypeQueryTestBase.cs @@ -26,8 +26,7 @@ protected ComplexTypeQueryTestBase(TFixture fixture) // async, // ss => ss.Set().Where(c => c.ShippingAddress.Country.Code == "DE")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_property_inside_complex_type_after_subquery(bool async) => AssertQuery( async, @@ -37,8 +36,7 @@ public virtual Task Filter_on_property_inside_complex_type_after_subquery(bool a .Distinct() .Where(c => c.ShippingAddress.ZipCode == 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_property_inside_nested_complex_type_after_subquery(bool async) => AssertQuery( async, @@ -48,37 +46,32 @@ public virtual Task Filter_on_property_inside_nested_complex_type_after_subquery .Distinct() .Where(c => c.ShippingAddress.Country.Code == "DE")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_required_property_inside_required_complex_type_on_optional_navigation(bool async) => AssertQuery( async, ss => ss.Set().Where(cg => cg.OptionalCustomer!.ShippingAddress.ZipCode != 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_required_property_inside_required_complex_type_on_required_navigation(bool async) => AssertQuery( async, ss => ss.Set().Where(cg => cg.RequiredCustomer.ShippingAddress.ZipCode != 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_complex_type_via_optional_navigation(bool async) => AssertQuery( async, ss => ss.Set().Select(cg => cg.OptionalCustomer!.ShippingAddress), ss => ss.Set().Select(cg => cg.OptionalCustomer != null ? cg.OptionalCustomer.ShippingAddress : default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_complex_type_via_required_navigation(bool async) => AssertQuery( async, ss => ss.Set().Select(cg => cg.RequiredCustomer.ShippingAddress)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Load_complex_type_after_subquery_on_entity_type(bool async) => AssertQuery( async, @@ -87,71 +80,61 @@ public virtual Task Load_complex_type_after_subquery_on_entity_type(bool async) .Skip(1) .Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress.Country)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_single_property_on_nested_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress.Country.FullName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_complex_type_Where(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress).Where(a => a.ZipCode == 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_complex_type_Distinct(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_type_equals_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.ShippingAddress == c.BillingAddress)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_type_equals_constant(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => c.ShippingAddress - == new Address - { - AddressLine1 = "804 S. Lakeshore Road", - ZipCode = 38654, - Country = new Country { FullName = "United States", Code = "US" }, - Tags = new List { "foo", "bar" } - }), - ss => ss.Set().Where( - c => - c.ShippingAddress.AddressLine1 == "804 S. Lakeshore Road" - && c.ShippingAddress.ZipCode == 38654 - && c.ShippingAddress.Country == new Country { FullName = "United States", Code = "US" } - && c.ShippingAddress.Tags.SequenceEqual(new List { "foo", "bar" }))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + ss => ss.Set().Where(c => c.ShippingAddress + == new Address + { + AddressLine1 = "804 S. Lakeshore Road", + ZipCode = 38654, + Country = new Country { FullName = "United States", Code = "US" }, + Tags = new List { "foo", "bar" } + }), + ss => ss.Set().Where(c => + c.ShippingAddress.AddressLine1 == "804 S. Lakeshore Road" + && c.ShippingAddress.ZipCode == 38654 + && c.ShippingAddress.Country == new Country { FullName = "United States", Code = "US" } + && c.ShippingAddress.Tags.SequenceEqual(new List { "foo", "bar" }))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_type_equals_parameter(bool async) { var address = new Address @@ -159,22 +142,20 @@ public virtual Task Complex_type_equals_parameter(bool async) AddressLine1 = "804 S. Lakeshore Road", ZipCode = 38654, Country = new Country { FullName = "United States", Code = "US" }, - Tags = new List { "foo", "bar" } + Tags = ["foo", "bar"] }; return AssertQuery( async, ss => ss.Set().Where(c => c.ShippingAddress == address), - ss => ss.Set().Where( - c => - c.ShippingAddress.AddressLine1 == "804 S. Lakeshore Road" - && c.ShippingAddress.ZipCode == 38654 - && c.ShippingAddress.Country == new Country { FullName = "United States", Code = "US" } - && c.ShippingAddress.Tags.SequenceEqual(new List { "foo", "bar" }))); + ss => ss.Set().Where(c => + c.ShippingAddress.AddressLine1 == "804 S. Lakeshore Road" + && c.ShippingAddress.ZipCode == 38654 + && c.ShippingAddress.Country == new Country { FullName = "United States", Code = "US" } + && c.ShippingAddress.Tags.SequenceEqual(new List { "foo", "bar" }))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_over_complex_type(bool async) { var address = new Address @@ -186,12 +167,11 @@ public virtual Task Subquery_over_complex_type(bool async) return AssertQuery( async, - ss => ss.Set().Where( - c => ss.Set().Select(c => c.ShippingAddress).OrderBy(a => a.ZipCode).First() == address)); + ss => ss.Set() + .Where(c => ss.Set().Select(c => c.ShippingAddress).OrderBy(a => a.ZipCode).First() == address)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_complex_type(bool async) { var address = new Address @@ -199,98 +179,84 @@ public virtual Task Contains_over_complex_type(bool async) AddressLine1 = "804 S. Lakeshore Road", ZipCode = 38654, Country = new Country { FullName = "United States", Code = "US" }, - Tags = new List { "foo", "bar" } + Tags = ["foo", "bar"] }; return AssertQuery( async, - ss => ss.Set().Where( - c => ss.Set().Select(c => c.ShippingAddress).Contains(address)), - ss => ss.Set().Where( - c => ss.Set().Select(c => c.ShippingAddress).Any( - a => - a.AddressLine1 == "804 S. Lakeshore Road" - && a.ZipCode == 38654 - && a.Country == new Country { FullName = "United States", Code = "US" } - && a.Tags.SequenceEqual(new List { "foo", "bar" })))); + ss => ss.Set().Where(c => ss.Set().Select(c => c.ShippingAddress).Contains(address)), + ss => ss.Set().Where(c => ss.Set().Select(c => c.ShippingAddress).Any(a => + a.AddressLine1 == "804 S. Lakeshore Road" + && a.ZipCode == 38654 + && a.Country == new Country { FullName = "United States", Code = "US" } + && a.Tags.SequenceEqual(new List { "foo", "bar" })))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_entity_type_containing_complex_property(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Id == 1).Concat(ss.Set().Where(c => c.Id == 2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_entity_type_containing_complex_property(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Id == 1).Union(ss.Set().Where(c => c.Id == 2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Id == 1).Select(c => c.ShippingAddress) .Concat(ss.Set().Where(c => c.Id == 2).Select(c => c.ShippingAddress))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Id == 1).Select(c => c.ShippingAddress) .Union(ss.Set().Where(c => c.Id == 2).Select(c => c.ShippingAddress))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_property_in_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress.AddressLine1) .Concat(ss.Set().Select(c => c.BillingAddress.AddressLine1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_property_in_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress.AddressLine1) .Union(ss.Set().Select(c => c.BillingAddress.AddressLine1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_two_different_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress).Concat(ss.Set().Select(c => c.BillingAddress))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_two_different_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress).Union(ss.Set().Select(c => c.BillingAddress))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_property_inside_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.ShippingAddress.ZipCode == 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_property_inside_nested_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.ShippingAddress.Country.Code == "DE")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_property_inside_struct_complex_type_after_subquery(bool async) => AssertQuery( async, @@ -300,8 +266,7 @@ public virtual Task Filter_on_property_inside_struct_complex_type_after_subquery .Distinct() .Where(c => c.ShippingAddress.ZipCode == 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_property_inside_nested_struct_complex_type_after_subquery(bool async) => AssertQuery( async, @@ -311,8 +276,7 @@ public virtual Task Filter_on_property_inside_nested_struct_complex_type_after_s .Distinct() .Where(c => c.ShippingAddress.Country.Code == "DE")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_required_property_inside_required_struct_complex_type_on_optional_navigation(bool async) => AssertQuery( async, @@ -320,30 +284,26 @@ public virtual Task Filter_on_required_property_inside_required_struct_complex_t ss => ss.Set() .Where(cg => cg.OptionalCustomer == null || cg.OptionalCustomer.ShippingAddress.ZipCode != 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_required_property_inside_required_struct_complex_type_on_required_navigation(bool async) => AssertQuery( async, ss => ss.Set().Where(cg => cg.RequiredCustomer.ShippingAddress.ZipCode != 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_struct_complex_type_via_optional_navigation(bool async) => AssertQuery( async, ss => ss.Set().Select(cg => cg.OptionalCustomer!.ShippingAddress), ss => ss.Set().Select(cg => cg.OptionalCustomer != null ? cg.OptionalCustomer.ShippingAddress : default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_struct_complex_type_via_required_navigation(bool async) => AssertQuery( async, ss => ss.Set().Select(cg => cg.RequiredCustomer.ShippingAddress)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Load_struct_complex_type_after_subquery_on_entity_type(bool async) => AssertQuery( async, @@ -352,64 +312,55 @@ public virtual Task Load_struct_complex_type_after_subquery_on_entity_type(bool .Skip(1) .Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress.Country)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_single_property_on_nested_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress.Country.FullName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_struct_complex_type_Where(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress).Where(a => a.ZipCode == 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_struct_complex_type_Distinct(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Struct_complex_type_equals_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.ShippingAddress == c.BillingAddress)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Struct_complex_type_equals_constant(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => c.ShippingAddress - == new AddressStruct - { - AddressLine1 = "804 S. Lakeshore Road", - ZipCode = 38654, - Country = new CountryStruct { FullName = "United States", Code = "US" } - })); + ss => ss.Set().Where(c => c.ShippingAddress + == new AddressStruct + { + AddressLine1 = "804 S. Lakeshore Road", + ZipCode = 38654, + Country = new CountryStruct { FullName = "United States", Code = "US" } + })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Struct_complex_type_equals_parameter(bool async) { var address = new AddressStruct @@ -424,8 +375,7 @@ public virtual Task Struct_complex_type_equals_parameter(bool async) ss => ss.Set().Where(c => c.ShippingAddress == address)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_over_struct_complex_type(bool async) { var address = new AddressStruct @@ -437,12 +387,11 @@ public virtual Task Subquery_over_struct_complex_type(bool async) return AssertQuery( async, - ss => ss.Set().Where( - c => ss.Set().Select(c => c.ShippingAddress).OrderBy(a => a.ZipCode).First() == address)); + ss => ss.Set().Where(c + => ss.Set().Select(c => c.ShippingAddress).OrderBy(a => a.ZipCode).First() == address)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_struct_complex_type(bool async) { var address = new AddressStruct @@ -454,72 +403,62 @@ public virtual Task Contains_over_struct_complex_type(bool async) return AssertQuery( async, - ss => ss.Set().Where( - c => ss.Set().Select(c => c.ShippingAddress).Contains(address))); + ss => ss.Set().Where(c => ss.Set().Select(c => c.ShippingAddress).Contains(address))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_entity_type_containing_struct_complex_property(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Id == 1).Concat(ss.Set().Where(c => c.Id == 2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_entity_type_containing_struct_complex_property(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Id == 1).Union(ss.Set().Where(c => c.Id == 2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Id == 1).Select(c => c.ShippingAddress) .Concat(ss.Set().Where(c => c.Id == 2).Select(c => c.ShippingAddress))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Id == 1).Select(c => c.ShippingAddress) .Union(ss.Set().Where(c => c.Id == 2).Select(c => c.ShippingAddress))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_property_in_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress.AddressLine1) .Concat(ss.Set().Select(c => c.BillingAddress.AddressLine1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_property_in_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress.AddressLine1) .Union(ss.Set().Select(c => c.BillingAddress.AddressLine1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_two_different_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress).Concat(ss.Set().Select(c => c.BillingAddress))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_two_different_struct_complex_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.ShippingAddress).Union(ss.Set().Select(c => c.BillingAddress))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_same_nested_complex_type_twice_with_pushdown(bool async) => AssertQuery( async, @@ -535,8 +474,7 @@ from c2 in ss.Set() AssertEqual(e.BA2, a.BA2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_same_entity_with_nested_complex_type_twice_with_pushdown(bool async) => AssertQuery( async, @@ -552,8 +490,7 @@ from c2 in ss.Set() AssertEqual(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_same_nested_complex_type_twice_with_double_pushdown(bool async) => AssertQuery( async, @@ -571,8 +508,7 @@ from c2 in ss.Set() AssertEqual(e.BA2, a.BA2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_same_entity_with_nested_complex_type_twice_with_double_pushdown(bool async) => AssertQuery( async, @@ -590,8 +526,7 @@ from c2 in ss.Set() AssertEqual(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_same_struct_nested_complex_type_twice_with_pushdown(bool async) => AssertQuery( async, @@ -607,8 +542,7 @@ from c2 in ss.Set() AssertEqual(e.BA2, a.BA2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_same_entity_with_struct_nested_complex_type_twice_with_pushdown(bool async) => AssertQuery( async, @@ -624,8 +558,7 @@ from c2 in ss.Set() AssertEqual(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_same_struct_nested_complex_type_twice_with_double_pushdown(bool async) => AssertQuery( async, @@ -643,8 +576,7 @@ from c2 in ss.Set() AssertEqual(e.BA2, a.BA2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_same_entity_with_struct_nested_complex_type_twice_with_double_pushdown(bool async) => AssertQuery( async, @@ -662,8 +594,7 @@ from c2 in ss.Set() AssertEqual(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_of_same_entity_with_nested_complex_type_projected_twice_with_pushdown(bool async) => AssertQuery( async, @@ -686,8 +617,7 @@ from c2 in ss.Set() AssertEqual(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_of_same_entity_with_nested_complex_type_projected_twice_with_double_pushdown(bool async) => AssertQuery( async, @@ -714,8 +644,7 @@ from c2 in ss.Set() AssertEqual(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_of_same_nested_complex_type_projected_twice_with_pushdown(bool async) => AssertQuery( async, @@ -738,8 +667,7 @@ from c2 in ss.Set() AssertEqual(e.BA2, a.BA2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_of_same_nested_complex_type_projected_twice_with_double_pushdown(bool async) => AssertQuery( async, @@ -766,20 +694,18 @@ from c2 in ss.Set() AssertEqual(e.BA2, a.BA2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Same_entity_with_complex_type_projected_twice_with_pushdown_as_part_of_another_projection(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Complex = (from c1 in ss.Set() - from c2 in ss.Set() - orderby c1.Id, c2.Id descending - select new { One = c1, Two = c2 }).FirstOrDefault() - }), + ss => ss.Set().Select(x => new + { + x.Id, + Complex = (from c1 in ss.Set() + from c2 in ss.Set() + orderby c1.Id, c2.Id descending + select new { One = c1, Two = c2 }).FirstOrDefault() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -788,20 +714,18 @@ from c2 in ss.Set() AssertEqual(e.Complex?.Two, a.Complex?.Two); }); - [ConditionalTheory(Skip = "issue #31376")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #31376"), MemberData(nameof(IsAsyncData))] public virtual Task Same_complex_type_projected_twice_with_pushdown_as_part_of_another_projection(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Complex = (from c1 in ss.Set() - from c2 in ss.Set() - orderby c1.Id, c2.Id descending - select new { One = c1.BillingAddress, Two = c2.BillingAddress }).FirstOrDefault() - }), + ss => ss.Set().Select(x => new + { + x.Id, + Complex = (from c1 in ss.Set() + from c2 in ss.Set() + orderby c1.Id, c2.Id descending + select new { One = c1.BillingAddress, Two = c2.BillingAddress }).FirstOrDefault() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -812,16 +736,14 @@ from c2 in ss.Set() #region GroupBy - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_over_property_in_nested_complex_type(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(x => x.ShippingAddress.Country.Code).Select(g => new { Code = g.Key, Count = g.Count() }), elementSorter: g => g.Code); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_over_complex_type(bool async) => AssertQuery( async, @@ -833,16 +755,14 @@ public virtual Task GroupBy_over_complex_type(bool async) Assert.Equal(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_over_nested_complex_type(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(x => x.ShippingAddress.Country).Select(g => new { Country = g.Key, Count = g.Count() }), elementSorter: g => g.Country.Code); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_with_complex_type_with_group_by_and_first(bool async) => AssertQuery( async, @@ -850,8 +770,7 @@ public virtual Task Entity_with_complex_type_with_group_by_and_first(bool async) #endregion GroupBy - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_property_of_complex_type_using_left_join_with_pushdown(bool async) => AssertQuery( async, @@ -859,8 +778,7 @@ public virtual Task Projecting_property_of_complex_type_using_left_join_with_pus .LeftJoin(ss.Set().Where(x => x.Id > 5), cg => cg.Id, c => c.Id, (cg, c) => c) .Select(c => c == null ? null : (int?)c.BillingAddress.ZipCode)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_complex_from_optional_navigation_using_conditional(bool async) => AssertQuery( async, @@ -869,8 +787,7 @@ public virtual Task Projecting_complex_from_optional_navigation_using_conditiona ss => ss.Set().Select(x => x.OptionalCustomer == null ? null : x.OptionalCustomer.ShippingAddress) .OrderBy(x => x.MaybeScalar(xx => xx!.ZipCode)).Take(20).Distinct().Select(x => x.MaybeScalar(xx => xx!.ZipCode))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_entity_with_complex_type_pushdown_and_then_left_join(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/CompositeKeysQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/CompositeKeysQueryFixtureBase.cs index f3e1a7e528f..72f7945a077 100644 --- a/test/EFCore.Specification.Tests/Query/CompositeKeysQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/CompositeKeysQueryFixtureBase.cs @@ -367,10 +367,9 @@ protected override Task SeedAsync(CompositeKeysContext context) => CompositeKeysData.SeedAsync(context); public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - c => c - .Log(CoreEventId.PossibleUnintendedCollectionNavigationNullComparisonWarning) - .Log(CoreEventId.RowLimitingOperationWithoutOrderByWarning)); + => base.AddOptions(builder).ConfigureWarnings(c => c + .Log(CoreEventId.PossibleUnintendedCollectionNavigationNullComparisonWarning) + .Log(CoreEventId.RowLimitingOperationWithoutOrderByWarning)); public override CompositeKeysContext CreateContext() { diff --git a/test/EFCore.Specification.Tests/Query/CompositeKeysQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/CompositeKeysQueryTestBase.cs index 03355ce7c9c..8947da56816 100644 --- a/test/EFCore.Specification.Tests/Query/CompositeKeysQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/CompositeKeysQueryTestBase.cs @@ -14,8 +14,7 @@ protected CompositeKeysContext CreateContext() protected override Expression RewriteExpectedQueryExpression(Expression expectedQueryExpression) => new ExpectedQueryRewritingVisitor(Fixture.GetShadowPropertyMappings()).Visit(expectedQueryExpression); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_multiple_collections_same_level_top_level_ordering(bool async) => AssertQuery( async, @@ -35,8 +34,7 @@ orderby e1.Id2 AssertCollection(e.Required, a.Required); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_multiple_collections_same_level_top_level_ordering_using_entire_composite_key(bool async) => AssertQuery( async, @@ -56,8 +54,7 @@ public virtual Task Projecting_multiple_collections_same_level_top_level_orderin AssertCollection(e.Required, a.Required); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_multiple_collections_with_ordering_same_level(bool async) => AssertQuery( async, @@ -76,8 +73,7 @@ public virtual Task Projecting_multiple_collections_with_ordering_same_level(boo AssertCollection(e.Required, a.Required); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_multiple_collections_with_ordering_same_level_top_level_ordering(bool async) => AssertQuery( async, @@ -97,8 +93,7 @@ orderby e1.Id2 AssertCollection(e.Required, a.Required); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_collections_multi_level(bool async) => AssertQuery( async, @@ -126,8 +121,7 @@ orderby e1.Id2 }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_multiple_collections_on_multiple_levels_no_explicit_ordering(bool async) => AssertQuery( async, @@ -136,49 +130,43 @@ public virtual Task Projecting_multiple_collections_on_multiple_levels_no_explic { e1.Name, Outer1 = e1.OneToMany_Optional1 - .Select( - e2 => new - { - e2.Name, - Middle1 = e2.OneToMany_Required2 - .Select( - e3 => new - { - e3.Name, - Inner1 = e3.OneToMany_Optional3.ToList(), - Inner2 = e3.OneToMany_Required3.ToList() - }).ToList(), - Middle2 = e2.OneToMany_Optional2 - .Select( - e3 => new - { - e3.Name, - Inner1 = e3.OneToMany_Required3.ToList(), - Inner2 = e3.OneToMany_Optional3.ToList() - }).ToList(), - }).ToList(), + .Select(e2 => new + { + e2.Name, + Middle1 = e2.OneToMany_Required2 + .Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Optional3.ToList(), + Inner2 = e3.OneToMany_Required3.ToList() + }).ToList(), + Middle2 = e2.OneToMany_Optional2 + .Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Required3.ToList(), + Inner2 = e3.OneToMany_Optional3.ToList() + }).ToList(), + }).ToList(), Outer2 = e1.OneToMany_Required1 - .Select( - e2 => new - { - e2.Name, - Middle1 = e2.OneToMany_Optional2 - .Select( - e3 => new - { - e3.Name, - Inner1 = e3.OneToMany_Required3.ToList(), - Inner2 = e3.OneToMany_Optional3.ToList() - }).ToList(), - Middle2 = e2.OneToMany_Optional2 - .Select( - e3 => new - { - e3.Name, - Inner1 = e3.OneToMany_Optional3.ToList(), - Inner2 = e3.OneToMany_Required3.ToList() - }).ToList(), - }).ToList(), + .Select(e2 => new + { + e2.Name, + Middle1 = e2.OneToMany_Optional2 + .Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Required3.ToList(), + Inner2 = e3.OneToMany_Optional3.ToList() + }).ToList(), + Middle2 = e2.OneToMany_Optional2 + .Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Optional3.ToList(), + Inner2 = e3.OneToMany_Required3.ToList() + }).ToList(), + }).ToList(), }, elementSorter: e => e.Name, elementAsserter: (e, a) => @@ -242,8 +230,7 @@ public virtual Task Projecting_multiple_collections_on_multiple_levels_no_explic }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_multiple_collections_on_multiple_levels_some_explicit_ordering(bool async) => AssertQuery( async, @@ -252,47 +239,41 @@ orderby e1.Name select new { Outer1 = e1.OneToMany_Optional1 - .Select( - e2 => new - { - e2.Name, - Middle1 = e2.OneToMany_Required2 - .OrderByDescending(e3 => e3.Id2).ThenByDescending(e3 => e3.Id1) - .Select( - e3 => new { Inner1 = e3.OneToMany_Optional3.ToList(), Inner2 = e3.OneToMany_Required3.ToList() }) - .ToList(), - Middle2 = e2.OneToMany_Optional2 - .Select( - e3 => new - { - e3.Name, - Inner1 = e3.OneToMany_Required3.ToList(), - Inner2 = e3.OneToMany_Optional3.ToList() - }).ToList(), - }).ToList(), + .Select(e2 => new + { + e2.Name, + Middle1 = e2.OneToMany_Required2 + .OrderByDescending(e3 => e3.Id2).ThenByDescending(e3 => e3.Id1) + .Select(e3 => new { Inner1 = e3.OneToMany_Optional3.ToList(), Inner2 = e3.OneToMany_Required3.ToList() }) + .ToList(), + Middle2 = e2.OneToMany_Optional2 + .Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Required3.ToList(), + Inner2 = e3.OneToMany_Optional3.ToList() + }).ToList(), + }).ToList(), Outer2 = e1.OneToMany_Required1 .OrderBy(e2 => e2.Name.Length) - .Select( - e2 => new - { - e2.Name, - Middle1 = e2.OneToMany_Optional2 - .Select( - e3 => new - { - e3.Name, - Inner1 = e3.OneToMany_Required3.ToList(), - Inner2 = e3.OneToMany_Optional3.ToList() - }).ToList(), - Middle2 = e2.OneToMany_Optional2 - .Select( - e3 => new - { - e3.Name, - Inner1 = e3.OneToMany_Optional3.ToList(), - Inner2 = e3.OneToMany_Required3.OrderByDescending(x => x.Id1 + x.Id2).ToList() - }).ToList(), - }).ToList(), + .Select(e2 => new + { + e2.Name, + Middle1 = e2.OneToMany_Optional2 + .Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Required3.ToList(), + Inner2 = e3.OneToMany_Optional3.ToList() + }).ToList(), + Middle2 = e2.OneToMany_Optional2 + .Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Optional3.ToList(), + Inner2 = e3.OneToMany_Required3.OrderByDescending(x => x.Id1 + x.Id2).ToList() + }).ToList(), + }).ToList(), }, assertOrder: true, elementAsserter: (e, a) => diff --git a/test/EFCore.Specification.Tests/Query/Ef6GroupByTestBase.cs b/test/EFCore.Specification.Tests/Query/Ef6GroupByTestBase.cs index 2c3c27e01d8..f5f06a142fb 100644 --- a/test/EFCore.Specification.Tests/Query/Ef6GroupByTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Ef6GroupByTestBase.cs @@ -8,58 +8,50 @@ namespace Microsoft.EntityFrameworkCore.Query; public abstract class Ef6GroupByTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : Ef6GroupByTestBase.Ef6GroupByFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_projecting_group_key(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => o.FirstName).Select(g => g.Key)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_projecting_group_count(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.FirstName).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_projecting_expression_containing_group_key(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.Id).Select(g => g.Key * 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_projecting_aggregate_on_the_group(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.FirstName).Select(g => g.Max(p => p.Id))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_projecting_anonymous_type_containing_group_key_and_group_aggregate(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => o.FirstName).Select(g => new { g.Key, Aggregate = g.Max(p => p.Id) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_projecting_anonymous_type_containing_group_key_and_multiple_group_aggregates( bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.FirstName).Select( - g => new - { - key1 = g.Key, - key2 = g.Key, - max = g.Max(p => p.Id), - min = g.Min(s => s.Id + 2) - })); + ss => ss.Set().GroupBy(o => o.FirstName).Select(g => new + { + key1 = g.Key, + key2 = g.Key, + max = g.Max(p => p.Id), + min = g.Min(s => s.Id + 2) + })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_projecting_conditional_expression_containing_group_key(bool async) { var a = true; @@ -68,12 +60,11 @@ public virtual Task GroupBy_is_optimized_when_projecting_conditional_expression_ return AssertQuery( async, - ss => ss.Set().GroupBy(o => o.FirstName).Select( - g => new { keyIsNull = g.Key == null ? "is null" : "not null", logicExpression = (a && b || b && c) })); + ss => ss.Set().GroupBy(o => o.FirstName).Select(g + => new { keyIsNull = g.Key == null ? "is null" : "not null", logicExpression = (a && b || b && c) })); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_filtering_and_projecting_anonymous_type_with_group_key_and_function_aggregate( bool async) => AssertQuery( @@ -81,30 +72,26 @@ public virtual Task GroupBy_is_optimized_when_filtering_and_projecting_anonymous ss => ss.Set().Where(o => o.Id > 5).GroupBy(o => o.FirstName) .Select(g => new { FirstName = g.Key, AverageId = g.Average(p => p.Id) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_projecting_function_aggregate_with_expression(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(p => p.FirstName).Select(g => g.Max(p => p.Id * 2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_projecting_expression_with_multiple_function_aggregates(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => o.FirstName) .Select(g => new { maxMinusMin = g.Max(p => p.Id) - g.Min(s => s.Id) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_is_optimized_when_grouping_by_row_and_projecting_column_of_the_key_row(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.Id < 4).GroupBy(g => new { g.FirstName }).Select(g => g.Key.FirstName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_doesnt_produce_a_groupby_statement(bool async) => AssertQuery( async, @@ -118,8 +105,7 @@ public virtual Task Grouping_by_all_columns_doesnt_produce_a_groupby_statement(b Assert.Equal(e.LastName, a.LastName); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_with_aggregate_function_works_1(bool async) => AssertQueryScalar( async, @@ -132,36 +118,31 @@ public virtual Task Grouping_by_all_columns_with_aggregate_function_works_1(bool o.Alias }, c => new { c.LastName, c.FirstName }, (k, g) => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_with_aggregate_function_works_2(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o, c => new { c.LastName, c.FirstName }, (k, g) => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_with_aggregate_function_works_3(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o, c => c, (k, g) => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_with_aggregate_function_works_4(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => o, c => c, (k, g) => new { Count = g.Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_with_aggregate_function_works_5(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => o, c => c, (k, g) => new { k.Id, Count = g.Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_with_aggregate_function_works_6(bool async) => AssertQuery( async, @@ -173,8 +154,7 @@ public virtual Task Grouping_by_all_columns_with_aggregate_function_works_6(bool Count = g.Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_with_aggregate_function_works_7(bool async) => AssertQueryScalar( async, @@ -183,8 +163,7 @@ group o by o into g select g.Count()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_with_aggregate_function_works_8(bool async) => AssertQuery( async, @@ -193,8 +172,7 @@ group o by o into g select new { g.Key.Id, Count = g.Count() }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_with_aggregate_function_works_9(bool async) => AssertQuery( async, @@ -208,8 +186,7 @@ into g Count = g.Count() }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Grouping_by_all_columns_with_aggregate_function_works_10(bool async) => AssertQuery( async, @@ -223,95 +200,82 @@ into g Count = g.Count() }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Simple_1_from_LINQ_101(bool async) // GroupBy final operator. Issue #19929. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from n in ss.Set() - group n by n.Value % 5 - into g - select new { Remainder = g.Key, Numbers = g })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from n in ss.Set() + group n by n.Value % 5 + into g + select new { Remainder = g.Key, Numbers = g })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Simple_2_from_LINQ_101(bool async) // GroupBy final operator. Issue #19929. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from w in ss.Set() - group w by w.Name.Length - into g - select new { FirstLetter = g.Key, Words = g })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from w in ss.Set() + group w by w.Name.Length + into g + select new { FirstLetter = g.Key, Words = g })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Simple_3_from_LINQ_101(bool async) // GroupBy final operator. Issue #19929. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from p in ss.Set() - group p by p.Category - into g - select new { Category = g.Key, Products = g })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from p in ss.Set() + group p by p.Category + into g + select new { Category = g.Key, Products = g })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Nested_from_LINQ_101(bool async) // GroupBy final operator. Issue #19929. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from c in ss.Set() - select new - { - c.CompanyName, - YearGroups = from o in c.Orders - group o by o.OrderDate.Year - into yg - select new - { - Year = yg.Key, - MonthGroups = from o in yg - group o by o.OrderDate.Month - into mg - select - new { Month = mg.Key, Orders = mg } - } - })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from c in ss.Set() + select new + { + c.CompanyName, + YearGroups = from o in c.Orders + group o by o.OrderDate.Year + into yg + select new + { + Year = yg.Key, + MonthGroups = from o in yg + group o by o.OrderDate.Month + into mg + select + new { Month = mg.Key, Orders = mg } + } + })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_Grouped_from_LINQ_101(bool async) // GroupBy final operator. Issue #19929. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from p in ss.Set() - group p by p.Category - into g - where g.Any(p => p.UnitsInStock == 0) - select new { Category = g.Key, Products = g })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from p in ss.Set() + group p by p.Category + into g + where g.Any(p => p.UnitsInStock == 0) + select new { Category = g.Key, Products = g })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_Grouped_from_LINQ_101(bool async) // GroupBy final operator. Issue #19929. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from p in ss.Set() - group p by p.Category - into g - where g.All(p => p.UnitsInStock > 0) - select new { Category = g.Key, Products = g })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from p in ss.Set() + group p by p.Category + into g + where g.All(p => p.UnitsInStock > 0) + select new { Category = g.Key, Products = g })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_Grouped_from_LINQ_101(bool async) => AssertQuery( async, @@ -320,8 +284,7 @@ group p by p.Category into g select new { Category = g.Key, ProductCount = g.Count() }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LongCount_Grouped_from_LINQ_101(bool async) => AssertQuery( async, @@ -330,8 +293,7 @@ group p by p.Category into g select new { Category = g.Key, ProductLongCount = g.LongCount() }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_Grouped_from_LINQ_101(bool async) => AssertQuery( async, @@ -340,8 +302,7 @@ group p by p.Category into g select new { Category = g.Key, TotalUnitsInStock = g.Sum(p => p.UnitsInStock) }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_Grouped_from_LINQ_101(bool async) => AssertQuery( async, @@ -350,21 +311,18 @@ group p by p.Category into g select new { Category = g.Key, CheapestPrice = g.Min(p => p.UnitPrice) }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_Elements_from_LINQ_101(bool async) // Navigation expansion phase 2. Issue #23206. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from p in ss.Set() - group p by p.Category - into g - let minPrice = g.Min(decimal (ProductForLinq p) => p.UnitPrice) - select new { Category = g.Key, CheapestProducts = g.Where(p => p.UnitPrice == minPrice) })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from p in ss.Set() + group p by p.Category + into g + let minPrice = g.Min(decimal (p) => p.UnitPrice) + select new { Category = g.Key, CheapestProducts = g.Where(p => p.UnitPrice == minPrice) })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_Grouped_from_LINQ_101(bool async) => AssertQuery( async, @@ -373,21 +331,18 @@ group p by p.Category into g select new { Category = g.Key, MostExpensivePrice = g.Max(p => p.UnitPrice) }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_Elements_from_LINQ_101(bool async) // Navigation expansion phase 2. Issue #23206. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from p in ss.Set() - group p by p.Category - into g - let minPrice = g.Max(decimal (ProductForLinq p) => p.UnitPrice) - select new { Category = g.Key, MostExpensiveProducts = g.Where(p => p.UnitPrice == minPrice) })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from p in ss.Set() + group p by p.Category + into g + let minPrice = g.Max(decimal (p) => p.UnitPrice) + select new { Category = g.Key, MostExpensiveProducts = g.Where(p => p.UnitPrice == minPrice) })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_Grouped_from_LINQ_101(bool async) => AssertQuery( async, @@ -402,8 +357,7 @@ into g Assert.Equal(e.AveragePrice, a.AveragePrice, 5); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_Join_from_LINQ_101(bool async) => AssertQuery( async, @@ -417,8 +371,7 @@ join o in ss.Set() on c equals o.Customer into ps AssertCollection(e.Products, a.Products); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cross_Join_with_Group_Join_from_LINQ_101(bool async) => AssertQuery( async, @@ -439,8 +392,7 @@ from o in ps Assert.Equal(l.Customer.CompanyName, r.Customer.CompanyName); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_Outer_Join_with_Group_Join_from_LINQ_101(bool async) => AssertQuery( async, @@ -459,33 +411,28 @@ from o in ps.DefaultIfEmpty() AssertEqual(l.Customer, r.Customer); }); - [ConditionalTheory] // From #12088 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #12088 public virtual Task Whats_new_2021_sample_1(bool async) => AssertQuery( async, ss => ss.Set() .Include(e => e.Shoes) .GroupBy(e => e.FirstName) - .Select( - g => g.OrderBy(e => e.FirstName) - .ThenBy(e => e.LastName) - .FirstOrDefault())); + .Select(g => g.OrderBy(e => e.FirstName) + .ThenBy(e => e.LastName) + .FirstOrDefault())); - [ConditionalTheory] // From #16648 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #16648 public virtual Task Whats_new_2021_sample_2(bool async) => AssertFirst( async, ss => ss.Set() - .Select( - p => new { p.FirstName, FullName = p.FirstName + " " + p.MiddleInitial + " " + p.LastName }) + .Select(p => new { p.FirstName, FullName = p.FirstName + " " + p.MiddleInitial + " " + p.LastName }) .GroupBy(p => p.FirstName) .OrderBy(e => e.Key) .Select(g => g.First())); - [ConditionalTheory] // From #12640 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #12640 public virtual Task Whats_new_2021_sample_3(bool async) => AssertQuery( async, @@ -496,8 +443,7 @@ public virtual Task Whats_new_2021_sample_3(bool async) .OrderBy(e => e.Length), assertOrder: true); - [ConditionalTheory] // From #18037 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #18037 public virtual Task Whats_new_2021_sample_4(bool async) => AssertQuery( async, @@ -512,8 +458,7 @@ into people Count = people.Count() }); - [ConditionalTheory] // From #12601 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #12601 public virtual Task Whats_new_2021_sample_5(bool async) => AssertQuery( async, @@ -523,8 +468,7 @@ public virtual Task Whats_new_2021_sample_5(bool async) .OrderBy(e => e), assertOrder: true); - [ConditionalTheory] // From #12600 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #12600 public virtual Task Whats_new_2021_sample_6(bool async) => AssertQuery( async, @@ -535,8 +479,7 @@ public virtual Task Whats_new_2021_sample_6(bool async) .OrderBy(e => e), assertOrder: true); - [ConditionalTheory] // From #25460 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #25460 public virtual Task Whats_new_2021_sample_7(bool async) { var size = 11; @@ -544,43 +487,36 @@ public virtual Task Whats_new_2021_sample_7(bool async) return AssertQuery( async, ss => ss.Set() - .Where( - p => p.Feet.Size == size - && p.MiddleInitial != null - && p.Feet.Id != 1) - .GroupBy( - p => new { p.Feet.Size, p.Feet.Person.LastName }) - .Select( - g => new - { - g.Key.LastName, - g.Key.Size, - Min = g.Min(p => p.Feet.Size), - })); + .Where(p => p.Feet.Size == size + && p.MiddleInitial != null + && p.Feet.Id != 1) + .GroupBy(p => new { p.Feet.Size, p.Feet.Person.LastName }) + .Select(g => new + { + g.Key.LastName, + g.Key.Size, + Min = g.Min(p => p.Feet.Size), + })); } - [ConditionalTheory] // From #24869 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #24869 public virtual Task Whats_new_2021_sample_8(bool async) => AssertCount( async, ss => ss.Set() .Include(x => x.Shoes) .Include(x => x.Feet) - .GroupBy( - x => new { x.Feet.Id, x.Feet.Size }) - .Select( - x => new - { - Key = x.Key.Id + x.Key.Size, - Count = x.Count(), - Sum = x.Sum(el => el.Id), - SumOver60 = x.Sum(el => el.Id) / (decimal)60, - TotalCallOutCharges = x.Sum(el => el.Feet.Size == 11 ? 1 : 0) - })); - - [ConditionalTheory] // From #24591 - [MemberData(nameof(IsAsyncData))] + .GroupBy(x => new { x.Feet.Id, x.Feet.Size }) + .Select(x => new + { + Key = x.Key.Id + x.Key.Size, + Count = x.Count(), + Sum = x.Sum(el => el.Id), + SumOver60 = x.Sum(el => el.Id) / (decimal)60, + TotalCallOutCharges = x.Sum(el => el.Feet.Size == 11 ? 1 : 0) + })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #24591 public virtual Task Whats_new_2021_sample_9(bool async) => AssertQuery( async, @@ -588,8 +524,7 @@ public virtual Task Whats_new_2021_sample_9(bool async) .GroupBy(n => n.FirstName) .Select(g => new { Feet = g.Key, Total = g.Sum(n => n.Feet.Size) })); - [ConditionalTheory] // From #24695 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #24695 public virtual Task Whats_new_2021_sample_10(bool async) => AssertQuery( async, @@ -634,21 +569,19 @@ in temp AssertCollection(l.Values, r.Values, elementSorter: e => (e.Id, e.Style, e.Age)); }); - [ConditionalTheory] // From #19506 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #19506 public virtual Task Whats_new_2021_sample_11(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(i => i.LastName) - .Select( - g => new - { - LastName = g.Key, - Count = g.Count(), - First = g.OrderBy(e => e.Id).FirstOrDefault(), - Take = g.OrderBy(e => e.Id).Take(2) - }) + .Select(g => new + { + LastName = g.Key, + Count = g.Count(), + First = g.OrderBy(e => e.Id).FirstOrDefault(), + Take = g.OrderBy(e => e.Id).Take(2) + }) .OrderByDescending(e => e.LastName) .Select(e => e), r => (r.First.FirstName, r.First.MiddleInitial, r.First.LastName), @@ -669,8 +602,7 @@ public virtual Task Whats_new_2021_sample_11(bool async) }, assertOrder: false); - [ConditionalTheory] // From #13805 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #13805 public virtual Task Whats_new_2021_sample_12(bool async) => AssertQuery( async, @@ -691,15 +623,13 @@ public virtual Task Whats_new_2021_sample_12(bool async) } }); - [ConditionalTheory] // From #12088 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #12088 public virtual Task Whats_new_2021_sample_13(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(m => new { m.FirstName, m.MiddleInitial }) - .Select( - am => new { am.Key, Items = am.OrderBy(e => e.Id).ToList() }), + .Select(am => new { am.Key, Items = am.OrderBy(e => e.Id).ToList() }), r => (r.Key.FirstName, r.Key.MiddleInitial), (l, r) => { @@ -711,18 +641,15 @@ public virtual Task Whats_new_2021_sample_13(bool async) } }); - [ConditionalTheory] // From #12088 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #12088 public virtual Task Whats_new_2021_sample_14(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set() - .GroupBy(bp => bp.Feet) - .SelectMany(g => g.OrderByDescending(bp => bp.Id).Take(1).DefaultIfEmpty()))); - - [ConditionalTheory] // From #12088 - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set() + .GroupBy(bp => bp.Feet) + .SelectMany(g => g.OrderByDescending(bp => bp.Id).Take(1).DefaultIfEmpty()))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #12088 public virtual Task Whats_new_2021_sample_15(bool async) => AssertQuery( async, @@ -730,18 +657,16 @@ public virtual Task Whats_new_2021_sample_15(bool async) .GroupBy(bp => bp.Feet) .Select(g => g.OrderByDescending(bp => bp.Id).FirstOrDefault())); - [ConditionalTheory] // From #12573 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // From #12573 public virtual Task Whats_new_2021_sample_16(bool async) // GroupBy final operator. Issue #19929. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set() - .GroupBy(c => c.LastName) - .Select(g => g.OrderBy(c => c.FirstName).First()) - .GroupBy(c => c.MiddleInitial) - .Select(g => g))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set() + .GroupBy(c => c.LastName) + .Select(g => g.OrderBy(c => c.FirstName).First()) + .GroupBy(c => c.MiddleInitial) + .Select(g => g))); protected ArubaContext CreateContext() => Fixture.CreateContext(); @@ -762,34 +687,31 @@ public Func GetContextCreator() protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - b => - { - b.Property(p => p.Id).ValueGeneratedNever(); - b.Property(o => o.FirstName).HasMaxLength(30); - }); + modelBuilder.Entity(b => + { + b.Property(p => p.Id).ValueGeneratedNever(); + b.Property(o => o.FirstName).HasMaxLength(30); + }); modelBuilder.Entity(); modelBuilder.Entity().Property(e => e.UnitPrice).HasPrecision(18, 6); modelBuilder.Entity(); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.Total).HasPrecision(18, 6); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.Total).HasPrecision(18, 6); + }); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.HasOne(e => e.Person).WithOne(e => e.Feet).HasForeignKey(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.HasOne(e => e.Person).WithOne(e => e.Feet).HasForeignKey(); + }); } protected override Task SeedAsync(ArubaContext context) diff --git a/test/EFCore.Specification.Tests/Query/FilteredQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/FilteredQueryTestBase.cs index 0feb2abf23e..a5bb0817dee 100644 --- a/test/EFCore.Specification.Tests/Query/FilteredQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/FilteredQueryTestBase.cs @@ -32,7 +32,8 @@ public Task AssertFilteredQuery( [CallerMemberName] string testMethodName = null) where TResult : class => QueryAsserter.AssertQuery( - actualQuery, expectedQuery, elementSorter, elementAsserter, assertOrder, assertEmpty, async, queryTrackingBehavior: null, testMethodName, + actualQuery, expectedQuery, elementSorter, elementAsserter, assertOrder, assertEmpty, async, queryTrackingBehavior: null, + testMethodName, filteredQuery: true); public Task AssertFilteredQueryScalar( diff --git a/test/EFCore.Specification.Tests/Query/FiltersInheritanceQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/FiltersInheritanceQueryTestBase.cs index f770fa1d4e8..05829193d21 100644 --- a/test/EFCore.Specification.Tests/Query/FiltersInheritanceQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/FiltersInheritanceQueryTestBase.cs @@ -12,8 +12,7 @@ namespace Microsoft.EntityFrameworkCore.Query; public abstract class FiltersInheritanceQueryTestBase(TFixture fixture) : FilteredQueryTestBase(fixture) where TFixture : InheritanceQueryFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_animal(bool async) { return AssertFilteredQuery( @@ -22,8 +21,7 @@ public virtual Task Can_use_of_type_animal(bool async) assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_is_kiwi(bool async) { return AssertFilteredQuery( @@ -31,8 +29,7 @@ public virtual Task Can_use_is_kiwi(bool async) ss => ss.Set().Where(a => a is Kiwi)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_is_kiwi_with_other_predicate(bool async) { return AssertFilteredQuery( @@ -40,8 +37,7 @@ public virtual Task Can_use_is_kiwi_with_other_predicate(bool async) ss => ss.Set().Where(a => a is Kiwi && a.CountryId == 1)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_is_kiwi_in_projection(bool async) { return AssertFilteredQueryScalar( @@ -49,8 +45,7 @@ public virtual Task Can_use_is_kiwi_in_projection(bool async) ss => ss.Set().Select(a => a is Kiwi)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_bird(bool async) { return AssertFilteredQuery( @@ -59,8 +54,7 @@ public virtual Task Can_use_of_type_bird(bool async) assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_bird_predicate(bool async) { return AssertFilteredQuery( @@ -72,8 +66,7 @@ public virtual Task Can_use_of_type_bird_predicate(bool async) assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_bird_with_projection(bool async) { return AssertFilteredQuery( @@ -84,8 +77,7 @@ public virtual Task Can_use_of_type_bird_with_projection(bool async) elementSorter: e => e.Name); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_bird_first(bool async) { return AssertFirst( @@ -93,8 +85,7 @@ public virtual Task Can_use_of_type_bird_first(bool async) ss => ss.Set().OfType().OrderBy(a => a.Species)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_kiwi(bool async) { return AssertFilteredQuery( @@ -102,8 +93,7 @@ public virtual Task Can_use_of_type_kiwi(bool async) ss => ss.Set().OfType()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_derived_set(bool async) { return AssertFilteredQuery( @@ -112,8 +102,7 @@ public virtual Task Can_use_derived_set(bool async) assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Can_use_IgnoreQueryFilters_and_GetDatabaseValues(bool async) { using var context = Fixture.CreateContext(); diff --git a/test/EFCore.Specification.Tests/Query/FunkyDataQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/FunkyDataQueryTestBase.cs index bb78977da6e..521b4e5eafc 100644 --- a/test/EFCore.Specification.Tests/Query/FunkyDataQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/FunkyDataQueryTestBase.cs @@ -14,8 +14,7 @@ namespace Microsoft.EntityFrameworkCore.Query; public abstract class FunkyDataQueryTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : FunkyDataQueryTestBase.FunkyDataQueryFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task String_contains_on_argument_with_wildcard_constant(bool async) { await AssertQuery( @@ -61,8 +60,7 @@ await AssertQuery( ss => ss.Set().Where(c => true).Select(c => c.FirstName)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task String_contains_on_argument_with_wildcard_parameter(bool async) { var prm1 = "%B"; @@ -116,8 +114,7 @@ await AssertQuery( ss => ss.Set().Where(c => true).Select(c => c.FirstName)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_contains_on_argument_with_wildcard_column(bool async) => AssertQuery( async, @@ -134,8 +131,7 @@ public virtual Task String_contains_on_argument_with_wildcard_column(bool async) Assert.Equal(e.ln, a.ln); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_contains_on_argument_with_wildcard_column_negated(bool async) => AssertQuery( async, @@ -147,8 +143,7 @@ public virtual Task String_contains_on_argument_with_wildcard_column_negated(boo .Where(r => r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.Contains(xx))) != true)); // .Where(r => r.ln != "" && !r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.Contains(xx))) == true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task String_starts_with_on_argument_with_wildcard_constant(bool async) { await AssertQuery( @@ -195,8 +190,7 @@ await AssertQuery( ss => ss.Set().Where(c => true).Select(c => c.FirstName)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task String_starts_with_on_argument_with_wildcard_parameter(bool async) { var prm1 = "%B"; @@ -250,8 +244,7 @@ await AssertQuery( ss => ss.Set().Where(c => true).Select(c => c.FirstName)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task String_starts_with_on_argument_with_bracket(bool async) { await AssertQuery( @@ -293,8 +286,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.FirstName.MaybeScalar(x => c.LastName.MaybeScalar(xx => x.StartsWith(xx))) == true)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_starts_with_on_argument_with_wildcard_column(bool async) => AssertQuery( async, @@ -311,8 +303,7 @@ public virtual Task String_starts_with_on_argument_with_wildcard_column(bool asy Assert.Equal(e.ln, a.ln); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_starts_with_on_argument_with_wildcard_column_negated(bool async) => AssertQuery( async, @@ -323,8 +314,7 @@ public virtual Task String_starts_with_on_argument_with_wildcard_column_negated( .SelectMany(c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln }) .Where(r => !(r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.StartsWith(xx))) == true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task String_ends_with_on_argument_with_wildcard_constant(bool async) { await AssertQuery( @@ -369,8 +359,7 @@ await AssertQuery( ss => ss.Set().Where(c => true).Select(c => c.FirstName)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task String_ends_with_on_argument_with_wildcard_parameter(bool async) { var prm1 = "%r"; @@ -423,8 +412,7 @@ await AssertQuery( ss => ss.Set().Where(c => true).Select(c => c.FirstName)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_ends_with_on_argument_with_wildcard_column(bool async) => AssertQuery( async, @@ -441,8 +429,7 @@ public virtual Task String_ends_with_on_argument_with_wildcard_column(bool async Assert.Equal(e.ln, a.ln); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_ends_with_on_argument_with_wildcard_column_negated(bool async) => AssertQuery( async, @@ -453,8 +440,7 @@ public virtual Task String_ends_with_on_argument_with_wildcard_column_negated(bo .SelectMany(c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln }) .Where(r => !(r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_ends_with_inside_conditional(bool async) => AssertQuery( async, @@ -471,8 +457,7 @@ public virtual Task String_ends_with_inside_conditional(bool async) Assert.Equal(e.ln, a.ln); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_ends_with_inside_conditional_negated(bool async) => AssertQuery( async, @@ -481,21 +466,19 @@ public virtual Task String_ends_with_inside_conditional_negated(bool async) .Where(r => !r.fn.EndsWith(r.ln) ? true : false), ss => ss.Set().Select(c => c.FirstName) .SelectMany(c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln }) - .Where( - r => !(r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true) - ? true - : false)); + .Where(r => !(r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true) + ? true + : false)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_ends_with_equals_nullable_column(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(c => ss.Set(), (c1, c2) => new { c1, c2 }) .Where(r => r.c1.FirstName.EndsWith(r.c2.LastName) == r.c1.NullableBool.Value), ss => ss.Set().SelectMany(c => ss.Set(), (c1, c2) => new { c1, c2 }) - .Where( - r => (r.c1.FirstName != null && r.c2.LastName != null && r.c1.FirstName.EndsWith(r.c2.LastName)) == r.c1.NullableBool), + .Where(r => (r.c1.FirstName != null && r.c2.LastName != null && r.c1.FirstName.EndsWith(r.c2.LastName)) + == r.c1.NullableBool), elementSorter: e => (e.c1.Id, e.c2.Id), elementAsserter: (e, a) => { @@ -503,16 +486,15 @@ public virtual Task String_ends_with_equals_nullable_column(bool async) AssertEqual(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_ends_with_not_equals_nullable_column(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(c => ss.Set(), (c1, c2) => new { c1, c2 }) .Where(r => r.c1.FirstName.EndsWith(r.c2.LastName) != r.c1.NullableBool.Value), ss => ss.Set().SelectMany(c => ss.Set(), (c1, c2) => new { c1, c2 }) - .Where( - r => (r.c1.FirstName != null && r.c2.LastName != null && r.c1.FirstName.EndsWith(r.c2.LastName)) != r.c1.NullableBool), + .Where(r => (r.c1.FirstName != null && r.c2.LastName != null && r.c1.FirstName.EndsWith(r.c2.LastName)) + != r.c1.NullableBool), elementSorter: e => (e.c1.Id, e.c2.Id), elementAsserter: (e, a) => { @@ -520,18 +502,16 @@ public virtual Task String_ends_with_not_equals_nullable_column(bool async) AssertEqual(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_FirstOrDefault_and_LastOrDefault(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(e => e.Id).Select( - e => new { first = (char?)e.FirstName.FirstOrDefault(), last = (char?)e.FirstName.LastOrDefault() }), - ss => ss.Set().OrderBy(e => e.Id).Select( - e => new - { - first = e.FirstName.MaybeScalar(x => x.FirstOrDefault()), last = e.FirstName.MaybeScalar(x => x.LastOrDefault()) - }), + ss => ss.Set().OrderBy(e => e.Id).Select(e + => new { first = (char?)e.FirstName.FirstOrDefault(), last = (char?)e.FirstName.LastOrDefault() }), + ss => ss.Set().OrderBy(e => e.Id).Select(e => new + { + first = e.FirstName.MaybeScalar(x => x.FirstOrDefault()), last = e.FirstName.MaybeScalar(x => x.LastOrDefault()) + }), assertOrder: true, elementAsserter: (e, a) => { @@ -539,18 +519,16 @@ public virtual Task String_FirstOrDefault_and_LastOrDefault(bool async) AssertEqual(e.last, a.last); }); - [ConditionalTheory] // #32432 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #32432 public virtual Task String_Contains_and_StartsWith_with_same_parameter(bool async) { var s = "B"; return AssertQuery( async, - ss => ss.Set().Where( - c => c.FirstName.Contains(s) || c.LastName.StartsWith(s)), - ss => ss.Set().Where( - c => c.FirstName.MaybeScalar(f => f.Contains(s)) == true || c.LastName.MaybeScalar(l => l.StartsWith(s)) == true)); + ss => ss.Set().Where(c => c.FirstName.Contains(s) || c.LastName.StartsWith(s)), + ss => ss.Set().Where(c + => c.FirstName.MaybeScalar(f => f.Contains(s)) == true || c.LastName.MaybeScalar(l => l.StartsWith(s)) == true)); } protected FunkyDataContext CreateContext() diff --git a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryFixtureBase.cs index 23688b807e7..82878f33daa 100644 --- a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryFixtureBase.cs @@ -301,59 +301,49 @@ public virtual ISetSource GetExpectedData() protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - b => - { - b.HasKey(c => c.Name); - }); + modelBuilder.Entity(b => + { + b.HasKey(c => c.Name); + }); - modelBuilder.Entity( - b => - { - b.HasKey( - g => new { g.Nickname, g.SquadId }); + modelBuilder.Entity(b => + { + b.HasKey(g => new { g.Nickname, g.SquadId }); - b.HasOne(g => g.CityOfBirth).WithMany(c => c.BornGears).HasForeignKey(g => g.CityOfBirthName).IsRequired(); - b.HasOne(g => g.Tag).WithOne(t => t.Gear).HasForeignKey( - t => new { t.GearNickName, t.GearSquadId }); - b.HasOne(g => g.AssignedCity).WithMany(c => c.StationedGears).IsRequired(false); - }); + b.HasOne(g => g.CityOfBirth).WithMany(c => c.BornGears).HasForeignKey(g => g.CityOfBirthName).IsRequired(); + b.HasOne(g => g.Tag).WithOne(t => t.Gear).HasForeignKey(t => new { t.GearNickName, t.GearSquadId }); + b.HasOne(g => g.AssignedCity).WithMany(c => c.StationedGears).IsRequired(false); + }); - modelBuilder.Entity().HasMany(o => o.Reports).WithOne().HasForeignKey( - o => new { o.LeaderNickname, o.LeaderSquadId }); + modelBuilder.Entity().HasMany(o => o.Reports).WithOne().HasForeignKey(o => new { o.LeaderNickname, o.LeaderSquadId }); - modelBuilder.Entity( - b => - { - b.HasKey(s => s.Id); - b.Property(s => s.Id).ValueGeneratedNever(); - b.Property(s => s.Banner5).HasMaxLength(5); - b.HasMany(s => s.Members).WithOne(g => g.Squad).HasForeignKey(g => g.SquadId); - }); - - modelBuilder.Entity( - b => - { - b.Property(w => w.Id).ValueGeneratedNever(); - b.HasOne(w => w.SynergyWith).WithOne().HasForeignKey(w => w.SynergyWithId); - b.HasOne(w => w.Owner).WithMany(g => g.Weapons).HasForeignKey(w => w.OwnerFullName).HasPrincipalKey(g => g.FullName); - }); + modelBuilder.Entity(b => + { + b.HasKey(s => s.Id); + b.Property(s => s.Id).ValueGeneratedNever(); + b.Property(s => s.Banner5).HasMaxLength(5); + b.HasMany(s => s.Members).WithOne(g => g.Squad).HasForeignKey(g => g.SquadId); + }); - modelBuilder.Entity( - b => - { - b.Property(m => m.Id).ValueGeneratedNever(); - b.Property(m => m.Difficulty).HasConversion(); - }); + modelBuilder.Entity(b => + { + b.Property(w => w.Id).ValueGeneratedNever(); + b.HasOne(w => w.SynergyWith).WithOne().HasForeignKey(w => w.SynergyWithId); + b.HasOne(w => w.Owner).WithMany(g => g.Weapons).HasForeignKey(w => w.OwnerFullName).HasPrincipalKey(g => g.FullName); + }); - modelBuilder.Entity( - b => - { - b.HasKey( - sm => new { sm.SquadId, sm.MissionId }); - b.HasOne(sm => sm.Mission).WithMany(m => m.ParticipatingSquads).HasForeignKey(sm => sm.MissionId); - b.HasOne(sm => sm.Squad).WithMany(s => s.Missions).HasForeignKey(sm => sm.SquadId); - }); + modelBuilder.Entity(b => + { + b.Property(m => m.Id).ValueGeneratedNever(); + b.Property(m => m.Difficulty).HasConversion(); + }); + + modelBuilder.Entity(b => + { + b.HasKey(sm => new { sm.SquadId, sm.MissionId }); + b.HasOne(sm => sm.Mission).WithMany(m => m.ParticipatingSquads).HasForeignKey(sm => sm.MissionId); + b.HasOne(sm => sm.Squad).WithMany(s => s.Missions).HasForeignKey(sm => sm.SquadId); + }); modelBuilder.Entity().HasKey(f => f.Id); modelBuilder.Entity().Property(f => f.Id).ValueGeneratedNever(); @@ -365,8 +355,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().HasKey(l => l.Name); modelBuilder.Entity().HasBaseType(); - modelBuilder.Entity().HasOne(c => c.DefeatedBy).WithOne().HasForeignKey( - c => new { c.DefeatedByNickname, c.DefeatedBySquadId }); + modelBuilder.Entity().HasOne(c => c.DefeatedBy).WithOne() + .HasForeignKey(c => new { c.DefeatedByNickname, c.DefeatedBySquadId }); modelBuilder.Entity().HasKey(l => l.Id); modelBuilder.Entity().Property(l => l.Id).ValueGeneratedNever(); @@ -376,9 +366,8 @@ protected override Task SeedAsync(GearsOfWarContext context) => GearsOfWarContext.SeedAsync(context); public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - w => - w.Log(CoreEventId.RowLimitingOperationWithoutOrderByWarning)); + => base.AddOptions(builder).ConfigureWarnings(w => + w.Log(CoreEventId.RowLimitingOperationWithoutOrderByWarning)); public override GearsOfWarContext CreateContext() { diff --git a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs index 7d6475a88ad..1d1fbc4ef1c 100644 --- a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs @@ -31,16 +31,14 @@ protected override Expression RewriteExpectedQueryExpression(Expression expected => new ExpectedQueryRewritingVisitor(Fixture.GetShadowPropertyMappings()) .Visit(expectedQueryExpression); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_empty(bool async) => AssertQuery( async, ss => ss.Set().Where(g => g == new Gear()), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_one_to_one_and_one_to_many(bool async) => AssertQuery( async, @@ -53,70 +51,59 @@ public virtual Task Include_multiple_one_to_one_and_one_to_many(bool async) // TODO: Move these out - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToString_string_property_projection(bool async) => AssertQuery( async, ss => ss.Set().Select(w => w.Name.ToString())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToString_boolean_property_non_nullable(bool async) => AssertQuery( async, ss => ss.Set().Select(w => w.IsAutomatic.ToString())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToString_boolean_property_nullable(bool async) => AssertQuery( async, ss => ss.Set().Select(lh => lh.Eradicated.ToString())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToString_boolean_computed_nullable(bool async) => AssertQuery( async, ss => ss.Set().Select(lh => (lh.Eradicated | lh.CommanderName == "Unknown").ToString())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToString_enum_property_projection(bool async) => AssertQuery( async, ss => ss.Set().Select(g => g.Rank.ToString())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToString_nullable_enum_property_projection(bool async) => AssertQuery( async, ss => ss.Set().Select(w => w.AmmunitionType.ToString())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToString_enum_contains(bool async) => AssertQuery( async, ss => ss.Set().Where(g => g.Difficulty.ToString().Contains("Med")).Select(g => g.CodeName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToString_nullable_enum_contains(bool async) => AssertQuery( async, ss => ss.Set().Where(w => w.AmmunitionType.ToString().Contains("Cart")).Select(g => g.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_one_to_one_and_one_to_many_self_reference(bool async) - => Assert.ThrowsAsync( - () => AssertQuery(async, ss => ss.Set().Include(w => w.Owner.Weapons))); + => Assert.ThrowsAsync(() => AssertQuery(async, ss => ss.Set().Include(w => w.Owner.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_one_to_one_optional_and_one_to_one_required(bool async) => AssertQuery( async, @@ -127,14 +114,12 @@ public virtual Task Include_multiple_one_to_one_optional_and_one_to_one_required new ExpectedInclude(g => g.Squad, "Gear"), new ExpectedInclude(o => o.Squad, "Gear"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_one_to_one_and_one_to_one_and_one_to_many(bool async) - => Assert.ThrowsAsync( - () => AssertQuery(async, ss => ss.Set().Include(t => t.Gear.Squad.Members))); + => Assert.ThrowsAsync(() => AssertQuery( + async, ss => ss.Set().Include(t => t.Gear.Squad.Members))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_circular(bool async) => AssertQuery( async, @@ -145,8 +130,7 @@ public virtual Task Include_multiple_circular(bool async) new ExpectedInclude(o => o.CityOfBirth), new ExpectedInclude(c => c.StationedGears, "CityOfBirth"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_circular_with_filter(bool async) => AssertQuery( async, @@ -157,8 +141,7 @@ public virtual Task Include_multiple_circular_with_filter(bool async) new ExpectedInclude(o => o.CityOfBirth), new ExpectedInclude(c => c.StationedGears, "CityOfBirth"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_using_alternate_key(bool async) => AssertQuery( async, @@ -168,45 +151,39 @@ public virtual Task Include_using_alternate_key(bool async) new ExpectedInclude(g => g.Weapons), new ExpectedInclude(o => o.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_include_then_include(bool async) - => Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Include(g => g.AssignedCity.BornGears).ThenInclude(g => g.Tag) - .Include(g => g.AssignedCity.StationedGears).ThenInclude(g => g.Tag) - .Include(g => g.CityOfBirth.BornGears).ThenInclude(g => g.Tag) - .Include(g => g.CityOfBirth.StationedGears).ThenInclude(g => g.Tag) - .OrderBy(g => g.Nickname))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Include(g => g.AssignedCity.BornGears).ThenInclude(g => g.Tag) + .Include(g => g.AssignedCity.StationedGears).ThenInclude(g => g.Tag) + .Include(g => g.CityOfBirth.BornGears).ThenInclude(g => g.Tag) + .Include(g => g.CityOfBirth.StationedGears).ThenInclude(g => g.Tag) + .OrderBy(g => g.Nickname))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_navigation_on_derived_type(bool async) => AssertQuery( async, ss => ss.Set().OfType().Include(o => o.Reports), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_based_Include_navigation_on_derived_type(bool async) => AssertQuery( async, ss => ss.Set().OfType().Include("Reports"), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EF_Property_based_Include_navigation_on_derived_type(bool async) => AssertQuery( async, ss => ss.Set().OfType().Include(o => EF.Property(o, "Reports")), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Included(bool async) => AssertQuery( async, @@ -215,8 +192,7 @@ public virtual Task Select_Where_Navigation_Included(bool async) select t, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(t => t.Gear))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_join_reference1(bool async) => AssertQuery( async, @@ -230,8 +206,7 @@ public virtual Task Include_with_join_reference1(bool async) new ExpectedInclude(g => g.CityOfBirth), new ExpectedInclude(o => o.CityOfBirth))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_join_reference2(bool async) => AssertQuery( async, @@ -245,8 +220,7 @@ public virtual Task Include_with_join_reference2(bool async) new ExpectedInclude(g => g.CityOfBirth), new ExpectedInclude(o => o.CityOfBirth))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_join_collection1(bool async) => AssertQuery( async, @@ -260,8 +234,7 @@ public virtual Task Include_with_join_collection1(bool async) new ExpectedInclude(g => g.Weapons), new ExpectedInclude(o => o.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_join_collection2(bool async) => AssertQuery( async, @@ -275,8 +248,7 @@ public virtual Task Include_with_join_collection2(bool async) new ExpectedInclude(g => g.Weapons), new ExpectedInclude(o => o.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_where_list_contains_navigation(bool async) { using var context = CreateContext(); @@ -297,8 +269,7 @@ public virtual async Task Include_where_list_contains_navigation(bool async) context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_where_list_contains_navigation2(bool async) { using var context = CreateContext(); @@ -319,8 +290,7 @@ public virtual async Task Include_where_list_contains_navigation2(bool async) context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Navigation_accessed_twice_outside_and_inside_subquery(bool async) { using var context = CreateContext(); @@ -340,8 +310,7 @@ public virtual async Task Navigation_accessed_twice_outside_and_inside_subquery( context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_join_multi_level(bool async) => AssertQuery( async, @@ -356,8 +325,7 @@ public virtual Task Include_with_join_multi_level(bool async) new ExpectedInclude(o => o.CityOfBirth), new ExpectedInclude(c => c.StationedGears, "CityOfBirth"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_join_and_inheritance1(bool async) => AssertQuery( async, @@ -368,8 +336,7 @@ public virtual Task Include_with_join_and_inheritance1(bool async) (t, o) => o).Include(o => o.CityOfBirth), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.CityOfBirth))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_join_and_inheritance_with_orderby_before_and_after_include(bool async) => AssertQuery( async, @@ -382,8 +349,7 @@ public virtual Task Include_with_join_and_inheritance_with_orderby_before_and_af elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_join_and_inheritance2(bool async) => AssertQuery( async, @@ -394,8 +360,7 @@ public virtual Task Include_with_join_and_inheritance2(bool async) (o, t) => o).Include(g => g.Weapons), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_join_and_inheritance3(bool async) => AssertQuery( async, @@ -406,8 +371,7 @@ public virtual Task Include_with_join_and_inheritance3(bool async) (t, o) => o).Include(o => o.Reports), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_nested_navigation_in_order_by(bool async) => AssertQuery( async, @@ -418,41 +382,35 @@ public virtual Task Include_with_nested_navigation_in_order_by(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(w => w.Owner)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_count_subquery_without_collision(bool async) => AssertQuery( async, ss => ss.Set().Where(w => w.Weapons.Count == 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_any_subquery_without_collision(bool async) => AssertQuery( async, ss => ss.Set().Where(w => w.Weapons.Any())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_inverted_boolean(bool async) => AssertQuery( async, ss => ss.Set() .Where(w => w.IsAutomatic) - .Select( - w => new { w.Id, Manual = !w.IsAutomatic }), + .Select(w => new { w.Id, Manual = !w.IsAutomatic }), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_inverted_nullable_boolean(bool async) => AssertQuery( async, ss => ss.Set().Select(w => new { w.Id, Alive = !w.Eradicated }), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Select_comparison_with_null(bool async) { AmmunitionType? ammunitionType = AmmunitionType.Cartridge; @@ -461,8 +419,7 @@ await AssertQuery( async, ss => ss.Set() .Where(w => w.AmmunitionType == ammunitionType) - .Select( - w => new { w.Id, Cartridge = w.AmmunitionType == ammunitionType }), + .Select(w => new { w.Id, Cartridge = w.AmmunitionType == ammunitionType }), elementSorter: e => e.Id); ammunitionType = null; @@ -471,13 +428,11 @@ await AssertQuery( async, ss => ss.Set() .Where(w => w.AmmunitionType == ammunitionType) - .Select( - w => new { w.Id, Cartridge = w.AmmunitionType == ammunitionType }), + .Select(w => new { w.Id, Cartridge = w.AmmunitionType == ammunitionType }), elementSorter: e => e.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Select_null_parameter(bool async) { AmmunitionType? ammunitionType = AmmunitionType.Cartridge; @@ -485,8 +440,7 @@ public virtual async Task Select_null_parameter(bool async) await AssertQuery( async, ss => ss.Set() - .Select( - w => new { w.Id, AmmoType = ammunitionType }), + .Select(w => new { w.Id, AmmoType = ammunitionType }), elementSorter: e => e.Id); ammunitionType = null; @@ -494,8 +448,7 @@ await AssertQuery( await AssertQuery( async, ss => ss.Set() - .Select( - w => new { w.Id, AmmoType = ammunitionType }), + .Select(w => new { w.Id, AmmoType = ammunitionType }), elementSorter: e => e.Id); ammunitionType = AmmunitionType.Shell; @@ -503,8 +456,7 @@ await AssertQuery( await AssertQuery( async, ss => ss.Set() - .Select( - w => new { w.Id, AmmoType = ammunitionType }), + .Select(w => new { w.Id, AmmoType = ammunitionType }), elementSorter: e => e.Id); ammunitionType = null; @@ -512,167 +464,137 @@ await AssertQuery( await AssertQuery( async, ss => ss.Set() - .Select( - w => new { w.Id, AmmoType = ammunitionType }), + .Select(w => new { w.Id, AmmoType = ammunitionType }), elementSorter: e => e.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_ternary_operation_with_boolean(bool async) => AssertQuery( async, - ss => ss.Set().Select( - w => new { w.Id, Num = w.IsAutomatic ? 1 : 0 }), + ss => ss.Set().Select(w => new { w.Id, Num = w.IsAutomatic ? 1 : 0 }), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_ternary_operation_with_inverted_boolean(bool async) => AssertQuery( async, - ss => ss.Set().Select( - w => new { w.Id, Num = !w.IsAutomatic ? 1 : 0 }), + ss => ss.Set().Select(w => new { w.Id, Num = !w.IsAutomatic ? 1 : 0 }), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_ternary_operation_with_has_value_not_null(bool async) => AssertQuery( async, ss => ss.Set() .Where(w => w.AmmunitionType.HasValue && w.AmmunitionType == AmmunitionType.Cartridge) - .Select( - w => new - { - w.Id, - IsCartridge = w.AmmunitionType.HasValue && w.AmmunitionType.Value == AmmunitionType.Cartridge ? "Yes" : "No" - }), + .Select(w => new + { + w.Id, IsCartridge = w.AmmunitionType.HasValue && w.AmmunitionType.Value == AmmunitionType.Cartridge ? "Yes" : "No" + }), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_ternary_operation_multiple_conditions(bool async) => AssertQuery( async, - ss => ss.Set().Select( - w => new { w.Id, IsCartridge = w.AmmunitionType == AmmunitionType.Shell && w.SynergyWithId == 1 ? "Yes" : "No" }), + ss => ss.Set().Select(w + => new { w.Id, IsCartridge = w.AmmunitionType == AmmunitionType.Shell && w.SynergyWithId == 1 ? "Yes" : "No" }), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_ternary_operation_multiple_conditions_2(bool async) => AssertQuery( async, - ss => ss.Set().Select( - w => new { w.Id, IsCartridge = !w.IsAutomatic && w.SynergyWithId == 1 ? "Yes" : "No" }), + ss => ss.Set().Select(w => new { w.Id, IsCartridge = !w.IsAutomatic && w.SynergyWithId == 1 ? "Yes" : "No" }), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_multiple_conditions(bool async) => AssertQuery( async, - ss => ss.Set().Select( - w => new { w.Id, IsCartridge = !w.IsAutomatic && w.SynergyWithId == 1 }), + ss => ss.Set().Select(w => new { w.Id, IsCartridge = !w.IsAutomatic && w.SynergyWithId == 1 }), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_ternary_operations(bool async) => AssertQuery( async, - ss => ss.Set().Select( - w => new - { - w.Id, - IsManualCartridge = !w.IsAutomatic - ? w.AmmunitionType == AmmunitionType.Cartridge ? "ManualCartridge" : "Manual" - : "Auto" - }), + ss => ss.Set().Select(w => new + { + w.Id, + IsManualCartridge = !w.IsAutomatic + ? w.AmmunitionType == AmmunitionType.Cartridge ? "ManualCartridge" : "Manual" + : "Auto" + }), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_propagation_optimization1(bool async) => AssertQuery( async, ss => ss.Set().Where(g => (g == null ? null : g.LeaderNickname) == "Marcus" == (bool?)true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_propagation_optimization2(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => (g.LeaderNickname == null ? null : g.LeaderNickname.EndsWith("us")) == true)); + ss => ss.Set().Where(g => (g.LeaderNickname == null ? null : g.LeaderNickname.EndsWith("us")) == true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_propagation_optimization3(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => (g.LeaderNickname != null ? g.LeaderNickname.EndsWith("us") : null) == true)); + ss => ss.Set().Where(g => (g.LeaderNickname != null ? g.LeaderNickname.EndsWith("us") : null) == true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_propagation_optimization4(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => (null == EF.Property(g, "LeaderNickname") ? null : g.LeaderNickname.Length) == 5 == (bool?)true)); + ss => ss.Set().Where(g + => (null == EF.Property(g, "LeaderNickname") ? null : g.LeaderNickname.Length) == 5 == (bool?)true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_propagation_optimization5(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => (null != g.LeaderNickname ? EF.Property(g, "LeaderNickname").Length : null) - == 5 - == (bool?)true)); + ss => ss.Set().Where(g => (null != g.LeaderNickname ? EF.Property(g, "LeaderNickname").Length : null) + == 5 + == (bool?)true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_propagation_optimization6(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => (null != g.LeaderNickname ? EF.Property(g, "LeaderNickname").Length : null) - == 5 - == (bool?)true)); + ss => ss.Set().Where(g => (null != g.LeaderNickname ? EF.Property(g, "LeaderNickname").Length : null) + == 5 + == (bool?)true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_optimization7(bool async) => AssertQuery( async, ss => ss.Set().Select(g => null != g.LeaderNickname ? g.LeaderNickname + g.LeaderNickname : null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_optimization8(bool async) => AssertQuery( async, ss => ss.Set().Select(g => g != null ? g.LeaderNickname + g.LeaderNickname : null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_optimization9(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(g => g != null ? g.FullName.Length : (int?)null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_negative1(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(g => g.LeaderNickname != null ? g.Nickname.Length == 5 : (bool?)null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_negative2(bool async) => AssertQuery( async, @@ -680,8 +602,7 @@ public virtual Task Select_null_propagation_negative2(bool async) from g2 in ss.Set() select g1.LeaderNickname != null ? g2.LeaderNickname : null); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_negative3(bool async) => AssertQuery( async, @@ -692,8 +613,7 @@ orderby g2.Nickname select new { g2.Nickname, Condition = g2 != null ? g2.LeaderNickname != null : (bool?)null }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_negative4(bool async) => AssertQuery( async, @@ -704,8 +624,7 @@ orderby g2.Nickname select g2 != null ? new Tuple(g2.Nickname, 5) : null, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_negative5(bool async) => AssertQuery( async, @@ -718,42 +637,35 @@ orderby g2.Nickname : null, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_negative6(bool async) => AssertQueryScalar( async, - ss => ss.Set().Select( - g => null != g.LeaderNickname - ? EF.Property(g, "LeaderNickname").Length != EF.Property(g, "LeaderNickname").Length - : (bool?)null)); + ss => ss.Set().Select(g => null != g.LeaderNickname + ? EF.Property(g, "LeaderNickname").Length != EF.Property(g, "LeaderNickname").Length + : (bool?)null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_negative7(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(g => null != g.LeaderNickname ? g.LeaderNickname == g.LeaderNickname : (bool?)null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_negative8(bool async) => AssertQuery( async, ss => ss.Set().Select(t => t.Gear.Squad != null ? t.Gear.AssignedCity.Name : null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_negative9(bool async) => AssertQueryScalar( async, - ss => ss.Set().Select( - g => g.LeaderNickname != null - ? (bool?)(g.Nickname.Length == 5) ?? default - : (bool?)null)); + ss => ss.Set().Select(g => g.LeaderNickname != null + ? (bool?)(g.Nickname.Length == 5) ?? default + : (bool?)null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_works_for_navigations_with_composite_keys(bool async) { return AssertQuery( @@ -764,8 +676,7 @@ public virtual Task Select_null_propagation_works_for_navigations_with_composite #pragma warning restore IDE0031 // Use null propagation } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_propagation_works_for_multiple_navigations_with_composite_keys(bool async) => AssertQuery( async, @@ -774,8 +685,7 @@ select EF.Property(EF.Property(t.Gear, "Tag").Gear, "AssignedCity" ? EF.Property(EF.Property(t.Gear.Tag, "Gear").AssignedCity, "Name") : null); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_conditional_with_anonymous_type_and_null_constant(bool async) => AssertQuery( async, @@ -786,8 +696,7 @@ orderby g.Nickname : null, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_conditional_with_anonymous_types(bool async) => AssertQuery( async, @@ -798,8 +707,7 @@ orderby g.Nickname : new { Name = g.FullName }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_conditional_equality_1(bool async) => AssertQuery( async, @@ -812,8 +720,7 @@ orderby g.Nickname select g.Nickname, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_conditional_equality_2(bool async) => AssertQuery( async, @@ -826,8 +733,7 @@ orderby g.Nickname select g.Nickname, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_conditional_equality_3(bool async) => AssertQuery( async, @@ -840,8 +746,7 @@ orderby g.Nickname select g.Nickname, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_coalesce_with_anonymous_types(bool async) => AssertQuery( async, @@ -850,8 +755,7 @@ orderby g.Nickname select new { Name = g.LeaderNickname } ?? new { Name = g.FullName }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_coalesce_with_anonymous_types(bool async) => AssertQuery( async, @@ -859,8 +763,7 @@ public virtual Task Where_coalesce_with_anonymous_types(bool async) where (new { Name = g.LeaderNickname } ?? new { Name = g.FullName }) != null select g.Nickname); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_anonymous_types(bool async) => AssertQuery( async, @@ -884,8 +787,7 @@ from o in ss.Set().OfType() where g.LeaderNickname == o.Nickname && g.LeaderSquadId == o.SquadId select g.Nickname); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_member_access_on_anonymous_type(bool async) => AssertQuery( async, @@ -893,8 +795,7 @@ public virtual Task Where_member_access_on_anonymous_type(bool async) where new { Name = g.LeaderNickname, Squad = g.LeaderSquadId }.Name == "Marcus" select g.Nickname); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_anonymous_types_with_uncorrelated_members(bool async) => AssertQuery( async, @@ -904,8 +805,7 @@ public virtual Task Where_compare_anonymous_types_with_uncorrelated_members(bool select g.Nickname, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation(bool async) => AssertQuery( async, @@ -913,8 +813,7 @@ public virtual Task Select_Where_Navigation(bool async) where t.Gear.Nickname == "Marcus" select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar(bool async) => AssertQuery( async, @@ -929,8 +828,7 @@ from t2 in ss.Set() AssertEqual(e.Tag2, a.Tag2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(bool async) => AssertQuery( async, @@ -940,45 +838,38 @@ from t2 in ss.Set() select new { Id1 = t1.Id, Id2 = t2.Id }, elementSorter: e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool async) => AssertFirst( async, - ss => ss.Set().OrderBy(w => w.Id).Select( - w => new Weapon { IsAutomatic = (bool?)w.SynergyWith.IsAutomatic ?? false })); + ss => ss.Set().OrderBy(w => w.Id).Select(w => new Weapon { IsAutomatic = (bool?)w.SynergyWith.IsAutomatic ?? false })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_boolean(bool async) => AssertQuery( async, ss => ss.Set().Where(g => g.Weapons.OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_boolean_with_pushdown(bool async) => AssertQuery( async, ss => ss.Set().Where(g => g.Weapons.OrderBy(w => w.Id).FirstOrDefault().IsAutomatic)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_distinct_firstordefault_boolean(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => g.HasSoulPatch && g.Weapons.Distinct().OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault())); + ss => ss.Set().Where(g + => g.HasSoulPatch && g.Weapons.Distinct().OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_distinct_firstordefault_boolean_with_pushdown(bool async) => AssertQuery( async, ss => ss.Set().Where(g => g.HasSoulPatch && g.Weapons.Distinct().OrderBy(w => w.Id).FirstOrDefault().IsAutomatic)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_distinct_first_boolean(bool async) => AssertQuery( async, @@ -986,39 +877,33 @@ public virtual Task Where_subquery_distinct_first_boolean(bool async) .Where(g => g.HasSoulPatch && g.Weapons.Distinct().OrderBy(w => w.Id).First().IsAutomatic), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_distinct_singleordefault_boolean1(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(g => g.Nickname).Where( - g => g.HasSoulPatch - && g.Weapons.Where(w => w.Name.Contains("Lancer")).Distinct().Select(w => w.IsAutomatic) - .SingleOrDefault()), + ss => ss.Set().OrderBy(g => g.Nickname).Where(g => g.HasSoulPatch + && g.Weapons.Where(w => w.Name.Contains("Lancer")).Distinct().Select(w => w.IsAutomatic) + .SingleOrDefault()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_distinct_singleordefault_boolean2(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(g => g.Nickname).Where( - g => g.HasSoulPatch - && g.Weapons.Where(w => w.Name.Contains("Lancer")).Select(w => w.IsAutomatic).Distinct() - .SingleOrDefault()), + ss => ss.Set().OrderBy(g => g.Nickname).Where(g => g.HasSoulPatch + && g.Weapons.Where(w => w.Name.Contains("Lancer")).Select(w => w.IsAutomatic).Distinct() + .SingleOrDefault()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_distinct_singleordefault_boolean_with_pushdown(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(g => g.Nickname).Where( - g => g.HasSoulPatch && g.Weapons.Where(w => w.Name.Contains("Lancer")).Distinct().SingleOrDefault().IsAutomatic), + ss => ss.Set().OrderBy(g => g.Nickname).Where(g + => g.HasSoulPatch && g.Weapons.Where(w => w.Name.Contains("Lancer")).Distinct().SingleOrDefault().IsAutomatic), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_distinct_lastordefault_boolean(bool async) => AssertQuery( async, @@ -1027,8 +912,7 @@ public virtual Task Where_subquery_distinct_lastordefault_boolean(bool async) .Where(g => !g.Weapons.Distinct().OrderBy(w => w.Id).LastOrDefault().IsAutomatic), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_distinct_last_boolean(bool async) => AssertQuery( async, @@ -1037,122 +921,101 @@ public virtual Task Where_subquery_distinct_last_boolean(bool async) .Where(g => !g.HasSoulPatch && g.Weapons.Distinct().OrderBy(w => w.Id).Last().IsAutomatic), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_distinct_orderby_firstordefault_boolean(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => g.HasSoulPatch && g.Weapons.Distinct().OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault())); + ss => ss.Set().Where(g + => g.HasSoulPatch && g.Weapons.Distinct().OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_distinct_orderby_firstordefault_boolean_with_pushdown(bool async) => AssertQuery( async, ss => ss.Set().Where(g => g.HasSoulPatch && g.Weapons.Distinct().OrderBy(w => w.Id).FirstOrDefault().IsAutomatic)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_union_firstordefault_boolean(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => g.HasSoulPatch && g.Weapons.Union(g.Weapons).OrderBy(w => w.Id).FirstOrDefault().IsAutomatic)); + ss => ss.Set().Where(g => g.HasSoulPatch && g.Weapons.Union(g.Weapons).OrderBy(w => w.Id).FirstOrDefault().IsAutomatic)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_join_firstordefault_boolean(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => g.HasSoulPatch - && g.Weapons.Join(g.Weapons, e => e.Id, e => e.Id, (e1, e2) => e1).OrderBy(w => w.Id).FirstOrDefault() - .IsAutomatic)); + ss => ss.Set().Where(g => g.HasSoulPatch + && g.Weapons.Join(g.Weapons, e => e.Id, e => e.Id, (e1, e2) => e1).OrderBy(w => w.Id).FirstOrDefault() + .IsAutomatic)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_left_join_firstordefault_boolean(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => g.HasSoulPatch - && (from o in g.Weapons - join i in g.Weapons on o.Id equals i.Id into grouping - from i in grouping.DefaultIfEmpty() - select o).OrderBy(w => w.Id).FirstOrDefault().IsAutomatic)); + ss => ss.Set().Where(g => g.HasSoulPatch + && (from o in g.Weapons + join i in g.Weapons on o.Id equals i.Id into grouping + from i in grouping.DefaultIfEmpty() + select o).OrderBy(w => w.Id).FirstOrDefault().IsAutomatic)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_concat_firstordefault_boolean(bool async) => AssertQuery( async, - ss => ss.Set().Where( - g => g.HasSoulPatch && g.Weapons.Concat(g.Weapons).OrderBy(w => w.Id).FirstOrDefault().IsAutomatic)); + ss => ss.Set().Where(g => g.HasSoulPatch && g.Weapons.Concat(g.Weapons).OrderBy(w => w.Id).FirstOrDefault().IsAutomatic)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_with_count(bool async) => AssertCount( async, ss => ss.Set().Concat(ss.Set())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_scalars_with_count(bool async) => AssertCount( async, ss => ss.Set().Select(g => g.Nickname).Concat(ss.Set().Select(g2 => g2.FullName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_anonymous_with_count(bool async) => AssertCount( async, ss => ss.Set() - .Select( - g => new { Gear = g, Name = g.Nickname }) + .Select(g => new { Gear = g, Name = g.Nickname }) .Concat( - ss.Set().Select( - g2 => new { Gear = g2, Name = g2.FullName }))); + ss.Set().Select(g2 => new { Gear = g2, Name = g2.FullName }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_with_scalar_projection(bool async) => AssertQuery( async, ss => ss.Set().Concat(ss.Set()).Select(g => g.Nickname)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_navigation_with_concat_and_count(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(g => !g.HasSoulPatch).Select(g => g.Weapons.Concat(g.Weapons).Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_with_collection_navigations(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(g => g.HasSoulPatch).Select(g => g.Weapons.Union(g.Weapons).Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_with_collection_navigations(bool async) => AssertQueryScalar( async, ss => ss.Set().OfType().Select(o => o.Reports.Union(o.Reports).Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_distinct_firstordefault(bool async) => AssertQuery( async, ss => ss.Set().Where(g => g.HasSoulPatch).Select(g => g.Weapons.Distinct().OrderBy(w => w.Id).FirstOrDefault().Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Client(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -1162,8 +1025,7 @@ public virtual Task Select_Where_Navigation_Client(bool async) select t), CoreStrings.QueryUnableToTranslateMember(nameof(Gear.IsMarcus), nameof(Gear))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Null(bool async) => AssertQuery( async, @@ -1171,8 +1033,7 @@ public virtual Task Select_Where_Navigation_Null(bool async) where t.Gear == null select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Null_Reverse(bool async) => AssertQuery( async, @@ -1180,8 +1041,7 @@ public virtual Task Select_Where_Navigation_Null_Reverse(bool async) where null == t.Gear select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Equals_Navigation(bool async) => AssertQuery( async, @@ -1196,38 +1056,34 @@ from t2 in ss.Set() AssertEqual(e.t2, e.t2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Conditional_Navigation_With_Trivial_Member_Access(bool async) => AssertQuery( async, ss => ss.Set() - .Where(g => (g.AssignedCity != null ? g.AssignedCity : g.CityOfBirth).Name != "Ephyra") - .Select(g => new { g.Nickname }), + .Where(g => (g.AssignedCity != null ? g.AssignedCity : g.CityOfBirth).Name != "Ephyra") + .Select(g => new { g.Nickname }), elementSorter: e => e.Nickname); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Conditional_Navigation_With_Member_Access_On_Same_Type(bool async) => AssertQuery( async, ss => ss.Set() - .Where(g => (g.AssignedCity != null ? g.AssignedCity : g.CityOfBirth).Nation == "Tyrus") - .Select(g => new { g.Nickname, g.FullName }), + .Where(g => (g.AssignedCity != null ? g.AssignedCity : g.CityOfBirth).Nation == "Tyrus") + .Select(g => new { g.Nickname, g.FullName }), elementSorter: e => e.Nickname); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Conditional_Navigation_With_Member_Access_On_Related_Types(bool async) => AssertQuery( async, ss => ss.Set() - .Where(g => (g.DeputyCommander != null ? g.DeputyCommander : g.Commander).ThreatLevel == 4) - .Select(g => new { g.Name }), + .Where(g => (g.DeputyCommander != null ? g.DeputyCommander : g.Commander).ThreatLevel == 4) + .Select(g => new { g.Name }), elementSorter: e => e.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Singleton_Navigation_With_Member_Access(bool async) => AssertQuery( async, @@ -1237,8 +1093,7 @@ public virtual Task Singleton_Navigation_With_Member_Access(bool async) select new { B = ct.Gear.CityOfBirthName }, elementSorter: e => e.B); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Singleton_Navigation_With_Member_Access(bool async) => AssertQuery( async, @@ -1253,8 +1108,7 @@ public virtual Task Select_Singleton_Navigation_With_Member_Access(bool async) Assert.Equal(e.B, e.B); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_Composite_Key(bool async) => AssertQuery( async, @@ -1266,8 +1120,7 @@ join g in ss.Set() from g in grouping select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_navigation_translated_to_subquery_composite_key(bool async) => AssertQuery( async, @@ -1276,8 +1129,7 @@ join t in ss.Set() on g.FullName equals t.Gear.FullName select new { g.FullName, t.Note }, elementSorter: e => e.FullName); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_order_by_on_inner_sequence_navigation_translated_to_subquery_composite_key(bool async) => AssertQuery( async, @@ -1286,8 +1138,7 @@ join t in ss.Set().OrderBy(tt => tt.Id) on g.FullName equals t.Gear.Full select new { g.FullName, t.Note }, elementSorter: e => e.FullName); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_order_by_without_skip_or_take(bool async) => AssertQuery( async, @@ -1296,8 +1147,7 @@ join w in ss.Set().OrderBy(ww => ww.Name) on g.FullName equals w.OwnerFu select new { w.Name, g.FullName }, elementSorter: w => w.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_order_by_without_skip_or_take_nested(bool async) => AssertQuery( async, @@ -1307,8 +1157,7 @@ join w in ss.Set().OrderBy(ww => ww.Name) on g.FullName equals w.OwnerFu select new { w.Name, g.FullName }, elementSorter: w => w.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_with_inheritance_and_join_include_joined(bool async) => AssertQuery( async, @@ -1318,8 +1167,7 @@ public virtual Task Collection_with_inheritance_and_join_include_joined(bool asy select g).Include(g => g.Tag), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Tag))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_with_inheritance_and_join_include_source(bool async) => AssertQuery( async, @@ -1329,8 +1177,7 @@ public virtual Task Collection_with_inheritance_and_join_include_source(bool asy select g).Include(g => g.Tag), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Tag))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Non_unicode_string_literal_is_used_for_non_unicode_column(bool async) => AssertQuery( async, @@ -1338,8 +1185,7 @@ public virtual Task Non_unicode_string_literal_is_used_for_non_unicode_column(bo where c.Location == "Unknown" select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Non_unicode_string_literal_is_used_for_non_unicode_column_right(bool async) => AssertQuery( async, @@ -1347,8 +1193,7 @@ public virtual Task Non_unicode_string_literal_is_used_for_non_unicode_column_ri where "Unknown" == c.Location select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Non_unicode_parameter_is_used_for_non_unicode_column(bool async) { var value = "Unknown"; @@ -1360,8 +1205,7 @@ public virtual Task Non_unicode_parameter_is_used_for_non_unicode_column(bool as select c); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Non_unicode_string_literals_in_contains_is_used_for_non_unicode_column(bool async) { var cities = new List @@ -1378,8 +1222,7 @@ where cities.Contains(c.Location) select c); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Non_unicode_string_literals_is_used_for_non_unicode_column_with_subquery(bool async) => AssertQuery( async, @@ -1387,8 +1230,7 @@ public virtual Task Non_unicode_string_literals_is_used_for_non_unicode_column_w where c.Location == "Unknown" && c.BornGears.Count(g => g.Nickname == "Paduk") == 1 select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Non_unicode_string_literals_is_used_for_non_unicode_column_in_subquery(bool async) => AssertQuery( async, @@ -1396,8 +1238,7 @@ public virtual Task Non_unicode_string_literals_is_used_for_non_unicode_column_i where g.Nickname == "Marcus" && g.CityOfBirth.Location == "Jacinto's location" select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Non_unicode_string_literals_is_used_for_non_unicode_column_with_contains(bool async) => AssertQuery( async, @@ -1405,8 +1246,7 @@ public virtual Task Non_unicode_string_literals_is_used_for_non_unicode_column_w where c.Location.Contains("Jacinto") select c); - [ConditionalTheory] // Issue #32325 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // Issue #32325 public virtual Task Unicode_string_literals_is_used_for_non_unicode_column_with_concat(bool async) => AssertQuery( async, @@ -1427,8 +1267,8 @@ orderby g1.Nickname var result = query.ToList(); - Assert.Equal(new[] { "Marcus", "Marcus", "Marcus", "Marcus", "Baird" }, result.Select(g => g.Nickname)); - Assert.Equal(new[] { 0, 0, 0, 2, 0 }, result.Select(g => g.Weapons.Count)); + Assert.Equal(["Marcus", "Marcus", "Marcus", "Marcus", "Baird"], result.Select(g => g.Nickname)); + Assert.Equal([0, 0, 0, 2, 0], result.Select(g => g.Weapons.Count)); } [ConditionalFact] @@ -1444,12 +1284,11 @@ orderby g1.Nickname var result = query.ToList(); - Assert.Equal(new[] { "Marcus", "Marcus", "Marcus", "Marcus", "Baird" }, result.Select(g => g.Nickname)); - Assert.Equal(new[] { 2, 2, 2, 0, 2 }, result.Select(g => g.Weapons.Count)); + Assert.Equal(["Marcus", "Marcus", "Marcus", "Marcus", "Baird"], result.Select(g => g.Nickname)); + Assert.Equal([2, 2, 2, 0, 2], result.Select(g => g.Weapons.Count)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result3(bool async) => AssertQuery( async, @@ -1463,8 +1302,7 @@ from g2 in grouping.DefaultIfEmpty() new ExpectedInclude(g => g.Weapons), new ExpectedInclude(g => g.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result4(bool async) { var expectedIncludes = new IExpectedInclude[] @@ -1493,8 +1331,7 @@ from g2 in grouping.DefaultIfEmpty() elementSorter: e => e.g1.Nickname); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_inheritance_and_coalesce_result(bool async) => AssertQuery( async, @@ -1508,8 +1345,7 @@ from g2 in grouping.DefaultIfEmpty() new ExpectedInclude(g => g.Weapons), new ExpectedInclude(g => g.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_conditional_result(bool async) => AssertQuery( async, @@ -1525,8 +1361,7 @@ from g2 in grouping.DefaultIfEmpty() new ExpectedInclude(g => g.Weapons), new ExpectedInclude(g => g.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_complex_projection_result(bool async) { var expectedIncludes = new IExpectedInclude[] @@ -1559,127 +1394,108 @@ from g2 in grouping.DefaultIfEmpty() elementSorter: e => e.g1.Nickname + " " + e.g2?.Nickname); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Coalesce_operator_in_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(x => (bool?)x.Gear.HasSoulPatch ?? false)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Coalesce_operator_in_predicate_with_other_conditions(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Note != "K.I.A." && ((bool?)x.Gear.HasSoulPatch ?? false))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Coalesce_operator_in_projection_with_other_conditions(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(x => x.Note != "K.I.A." && ((bool?)x.Gear.HasSoulPatch ?? false))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(t => t.Note != "K.I.A." && t.Gear.HasSoulPatch)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_predicate2(bool async) => AssertQuery( async, ss => ss.Set().Where(t => t.Gear.HasSoulPatch), ss => ss.Set().Where(t => t.Gear.MaybeScalar(x => x.HasSoulPatch) == true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_predicate_negated(bool async) => AssertQuery( async, ss => ss.Set().Where(t => !t.Gear.HasSoulPatch), ss => ss.Set().Where(t => !t.Gear.MaybeScalar(x => x.HasSoulPatch) == true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_predicate_negated_complex1(bool async) => AssertQuery( async, ss => ss.Set().Where(t => !(t.Gear.HasSoulPatch ? true : t.Gear.HasSoulPatch)), - ss => ss.Set().Where( - t => !(t.Gear.MaybeScalar(x => x.HasSoulPatch) == true - ? true - : t.Gear.MaybeScalar(x => x.HasSoulPatch)) - == true)); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + ss => ss.Set().Where(t => !(t.Gear.MaybeScalar(x => x.HasSoulPatch) == true + ? true + : t.Gear.MaybeScalar(x => x.HasSoulPatch)) + == true)); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_predicate_negated_complex2(bool async) => AssertQuery( async, ss => ss.Set().Where(t => !(!t.Gear.HasSoulPatch ? false : t.Gear.HasSoulPatch)), - ss => ss.Set().Where( - t => !(t.Gear.MaybeScalar(x => x.HasSoulPatch) == false - ? false - : t.Gear.MaybeScalar(x => x.HasSoulPatch)) - == true)); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + ss => ss.Set().Where(t => !(t.Gear.MaybeScalar(x => x.HasSoulPatch) == false + ? false + : t.Gear.MaybeScalar(x => x.HasSoulPatch)) + == true)); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_conditional_expression(bool async) => AssertQuery( async, // ReSharper disable once RedundantTernaryExpression ss => ss.Set().Where(t => t.Gear.HasSoulPatch ? true : false)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_binary_expression(bool async) => AssertQuery( async, ss => ss.Set().Where(t => t.Gear.HasSoulPatch || t.Note.Contains("Cole"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_binary_and_expression(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(t => t.Gear.HasSoulPatch && t.Note.Contains("Cole"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_projection(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(t => t.Note != "K.I.A.").Select(t => t.Gear.SquadId)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_projection_into_anonymous_type(bool async) => AssertQuery( async, - ss => ss.Set().Where(t => t.Note != "K.I.A.").Select( - t => new { t.Gear.SquadId }), + ss => ss.Set().Where(t => t.Note != "K.I.A.").Select(t => new { t.Gear.SquadId }), elementSorter: e => e.SquadId); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_DTOs(bool async) => AssertQuery( async, - ss => ss.Set().Where(t => t.Note != "K.I.A.").Select( - t => new Squad { Id = t.Gear.SquadId })); + ss => ss.Set().Where(t => t.Note != "K.I.A.").Select(t => new Squad { Id = t.Gear.SquadId })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_list_initializers(bool async) => AssertQuery( async, - ss => ss.Set().Where(t => t.Note != "K.I.A.").OrderBy(t => t.Note).Select( - t => new List + ss => ss.Set().Where(t => t.Note != "K.I.A.").OrderBy(t => t.Note) + .Select(t => new List { t.Gear.SquadId, t.Gear.SquadId + 1, @@ -1687,45 +1503,39 @@ public virtual Task Optional_navigation_type_compensation_works_with_list_initia }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_array_initializers(bool async) => AssertQuery( async, ss => ss.Set().Where(t => t.Note != "K.I.A.").Select(t => new[] { t.Gear.SquadId }), elementSorter: e => e[0]); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_orderby(bool async) => AssertQuery( async, ss => ss.Set().Where(t => t.Note != "K.I.A.").OrderBy(t => t.Gear.SquadId).Select(t => t)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_all(bool async) => AssertAll( async, ss => ss.Set().Where(t => t.Note != "K.I.A."), predicate: t => t.Gear.HasSoulPatch); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_negated_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(t => t.Note != "K.I.A.").Where(t => !t.Gear.HasSoulPatch)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_contains(bool async) => AssertQuery( async, ss => ss.Set().Where(t => t.Note != "K.I.A." && ss.Set().Select(g => g.SquadId).Contains(t.Gear.SquadId))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_skip(bool async) => AssertInvalidMaterializationType( () => AssertQuery( @@ -1736,8 +1546,7 @@ public virtual Task Optional_navigation_type_compensation_works_with_skip(bool a elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)), "IEnumerable"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_type_compensation_works_with_take(bool async) => AssertInvalidMaterializationType( () => AssertQuery( @@ -1748,8 +1557,7 @@ public virtual Task Optional_navigation_type_compensation_works_with_take(bool a elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)), "IEnumerable"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_filtered_collection(bool async) => AssertQuery( async, @@ -1760,8 +1568,7 @@ public virtual Task Select_correlated_filtered_collection(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_filtered_collection_with_composite_key(bool async) => AssertQuery( async, @@ -1770,8 +1577,7 @@ public virtual Task Select_correlated_filtered_collection_with_composite_key(boo assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_filtered_collection_returning_queryable_throws(bool async) => AssertInvalidMaterializationType( () => AssertQuery( @@ -1781,8 +1587,7 @@ public virtual Task Select_correlated_filtered_collection_returning_queryable_th elementAsserter: (e, a) => AssertCollection(e, a)), typeof(IQueryable).ShortDisplayName()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_filtered_collection_works_with_caching(bool async) => AssertQuery( async, @@ -1790,8 +1595,7 @@ public virtual Task Select_correlated_filtered_collection_works_with_caching(boo assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_predicate_value_equals_condition(bool async) => AssertQuery( async, @@ -1801,8 +1605,7 @@ join w in ss.Set() on true equals w.SynergyWithId != null select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_predicate_value(bool async) => AssertQuery( async, @@ -1812,8 +1615,7 @@ join w in ss.Set() on g.HasSoulPatch equals true select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_predicate_condition_equals_condition(bool async) => AssertQuery( async, @@ -1823,8 +1625,7 @@ join w in ss.Set() on g.FullName != null equals w.SynergyWithId != null select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_predicate_value_equals_condition(bool async) => AssertQuery( async, @@ -1836,8 +1637,7 @@ into group1 from w in group1.DefaultIfEmpty() select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_predicate_value(bool async) => AssertQuery( async, @@ -1849,8 +1649,7 @@ into group1 from w in group1.DefaultIfEmpty() select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_predicate_condition_equals_condition(bool async) => AssertQuery( async, @@ -1862,28 +1661,25 @@ into group1 from w in group1.DefaultIfEmpty() select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Orderby_added_for_client_side_GroupJoin_composite_dependent_to_principal_LOJ_when_incomplete_key_is_used(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => - from t in ss.Set() - join g in ss.Set() on t.GearNickName equals g.Nickname into grouping - from g in ClientDefaultIfEmpty(grouping) + => AssertTranslationFailed(() => AssertQuery( + async, + ss => + from t in ss.Set() + join g in ss.Set() on t.GearNickName equals g.Nickname into grouping + from g in ClientDefaultIfEmpty(grouping) #pragma warning disable IDE0031 // Use null propagation - select new { t.Note, Nickname = g != null ? g.Nickname : null }, + select new { t.Note, Nickname = g != null ? g.Nickname : null }, #pragma warning restore IDE0031 // Use null propagation - elementSorter: e => e.Note)); + elementSorter: e => e.Note)); private static IEnumerable ClientDefaultIfEmpty(IEnumerable source) // ReSharper disable PossibleMultipleEnumeration - => source?.Count() == 0 ? new[] { default(TElement) } : source; + => source?.Count() == 0 ? [default(TElement)] : source; // ReSharper restore PossibleMultipleEnumeration - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_predicate_with_AndAlso_and_nullable_bool_property(bool async) => AssertQuery( async, @@ -1894,8 +1690,7 @@ public virtual Task Complex_predicate_with_AndAlso_and_nullable_bool_property(bo where w.Id != 50 && w.Owner.MaybeScalar(x => x.HasSoulPatch) == false select w); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_with_optional_navigation_is_translated_to_sql(bool async) => AssertQueryScalar( async, @@ -1903,8 +1698,7 @@ public virtual Task Distinct_with_optional_navigation_is_translated_to_sql(bool where g.Tag.Note != "Foo" select g.HasSoulPatch).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_optional_navigation_is_translated_to_sql(bool async) => AssertSum( async, @@ -1912,8 +1706,7 @@ public virtual Task Sum_with_optional_navigation_is_translated_to_sql(bool async where g.Tag.Note != "Foo" select g.SquadId)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_with_optional_navigation_is_translated_to_sql(bool async) => AssertCount( async, @@ -1921,8 +1714,7 @@ public virtual Task Count_with_optional_navigation_is_translated_to_sql(bool asy where g.Tag.Note != "Foo" select g.HasSoulPatch)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_with_manually_created_groupjoin_is_translated_to_sql(bool async) => AssertFirstOrDefault( async, @@ -1932,8 +1724,7 @@ from g in grouping.DefaultIfEmpty() where s.Name == "Kilo" select s); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_with_optional_navigation_as_subquery_predicate_is_translated_to_sql(bool async) => AssertQuery( async, @@ -1941,8 +1732,7 @@ public virtual Task Any_with_optional_navigation_as_subquery_predicate_is_transl where !s.Members.Any(m => m.Tag.Note == "Dom's Tag") select s.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_with_optional_navigation_is_translated_to_sql(bool async) => AssertAll( async, @@ -1950,8 +1740,7 @@ public virtual Task All_with_optional_navigation_is_translated_to_sql(bool async select g, predicate: g => g.Tag.Note != "Foo"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_side_equality_with_parameter_works_with_optional_navigations(bool async) { var prm = "Marcus' Tag"; @@ -1964,8 +1753,7 @@ public virtual Task Client_side_equality_with_parameter_works_with_optional_navi private static bool ClientEquals(string first, string second) => first == second; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_nullable_guid_list_closure(bool async) { var ids = new List @@ -1980,8 +1768,7 @@ public virtual Task Contains_with_local_nullable_guid_list_closure(bool async) ss => ss.Set().Where(e => ids.Contains(e.Id))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Unnecessary_include_doesnt_get_added_complex_when_projecting_EF_Property(bool async) => AssertQuery( async, @@ -1992,8 +1779,7 @@ public virtual Task Unnecessary_include_doesnt_get_added_complex_when_projecting .Select(g => new { FullName = EF.Property(g, "FullName") }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_order_bys_are_properly_lifted_from_subquery_created_by_include(bool async) => AssertQuery( async, @@ -2007,8 +1793,7 @@ public virtual Task Multiple_order_bys_are_properly_lifted_from_subquery_created .Select(g => g.FullName), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_is_properly_lifted_from_subquery_with_same_order_by_in_the_outer_query(bool async) => AssertQuery( async, @@ -2019,8 +1804,7 @@ public virtual Task Order_by_is_properly_lifted_from_subquery_with_same_order_by .Select(g => g.FullName), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_is_properly_lifted_from_subquery_created_by_include(bool async) => AssertQuery( async, @@ -2033,8 +1817,7 @@ public virtual Task Where_is_properly_lifted_from_subquery_created_by_include(bo elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.Tag)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_is_lifted_from_main_from_clause_of_SelectMany(bool async) => AssertQuery( async, @@ -2044,8 +1827,7 @@ orderby g1.FullName where g1.HasSoulPatch && !g2.HasSoulPatch select new { Name1 = g1.FullName, Name2 = g2.FullName }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_containing_SelectMany_projecting_main_from_clause_gets_lifted(bool async) => AssertQuery( async, @@ -2059,8 +1841,7 @@ orderby g.FullName select g.FullName, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_containing_join_projecting_main_from_clause_gets_lifted(bool async) => AssertQuery( async, @@ -2073,8 +1854,7 @@ orderby g.Nickname select g.Nickname, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_containing_left_join_projecting_main_from_clause_gets_lifted(bool async) => AssertQuery( async, @@ -2088,8 +1868,7 @@ orderby g.Nickname select g.Nickname, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_containing_join_gets_lifted_clashing_names(bool async) => AssertQuery( async, @@ -2104,8 +1883,7 @@ join tag in ss.Set() on gear.Nickname equals tag.GearNickName select gear.Nickname, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_created_by_include_gets_lifted_nested(bool async) => AssertQuery( async, @@ -2116,8 +1894,7 @@ orderby gear.Nickname elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.CityOfBirth)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_is_lifted_from_additional_from_clause(bool async) => AssertQuery( async, @@ -2129,8 +1906,7 @@ where g1.HasSoulPatch && !g2.HasSoulPatch select new { Name1 = g1.FullName, Name2 = g2.FullName }, elementSorter: e => (e.Name1, e.Name2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_with_result_operator_is_not_lifted(bool async) => AssertQuery( async, @@ -2139,8 +1915,7 @@ orderby g.Rank select g.FullName, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_with_orderby_followed_by_orderBy_is_pushed_down(bool async) => AssertQuery( async, @@ -2149,8 +1924,7 @@ orderby g.Rank select g.FullName, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_without_orderby_followed_by_orderBy_is_pushed_down1(bool async) => AssertQuery( async, @@ -2159,8 +1933,7 @@ orderby g.Rank select g.FullName, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_without_orderby_followed_by_orderBy_is_pushed_down2(bool async) => AssertQuery( async, @@ -2170,8 +1943,7 @@ orderby g.Rank select g.FullName, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_without_orderby_followed_by_orderBy_is_pushed_down3(bool async) => AssertQuery( async, @@ -2180,8 +1952,7 @@ public virtual Task Take_without_orderby_followed_by_orderBy_is_pushed_down3(boo select g.FullName, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_length_of_string_property(bool async) => AssertQuery( async, @@ -2189,61 +1960,51 @@ public virtual Task Select_length_of_string_property(bool async) select new { w.Name, w.Name.Length }, elementSorter: e => e.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_on_collection_navigation_in_predicate(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from g in ss.Set() - where g.HasSoulPatch && FavoriteWeapon(g.Weapons).Name == "Marcus' Lancer" - select g.Nickname)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from g in ss.Set() + where g.HasSoulPatch && FavoriteWeapon(g.Weapons).Name == "Marcus' Lancer" + select g.Nickname)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_on_collection_navigation_in_predicate_accessed_by_ef_property(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from g in ss.Set() - where !g.HasSoulPatch && FavoriteWeapon(EF.Property>(g, "Weapons")).Name == "Cole's Gnasher" - select g.Nickname)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from g in ss.Set() + where !g.HasSoulPatch && FavoriteWeapon(EF.Property>(g, "Weapons")).Name == "Cole's Gnasher" + select g.Nickname)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_on_collection_navigation_in_order_by(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from g in ss.Set() - where !g.HasSoulPatch - orderby FavoriteWeapon(g.Weapons).Name descending - select g.Nickname, - assertOrder: true)); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from g in ss.Set() + where !g.HasSoulPatch + orderby FavoriteWeapon(g.Weapons).Name descending + select g.Nickname, + assertOrder: true)); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_on_collection_navigation_in_additional_from_clause(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from g in ss.Set().OfType() - from v in Veterans(g.Reports) - select new { g = g.Nickname, v = v.Nickname }, - elementSorter: e => e.g + e.v)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from g in ss.Set().OfType() + from v in Veterans(g.Reports) + select new { g = g.Nickname, v = v.Nickname }, + elementSorter: e => e.g + e.v)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Client_method_on_collection_navigation_in_outer_join_key(bool async) { - var message = (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => from o in ss.Set().OfType() - join g in ss.Set() on FavoriteWeapon(o.Weapons).Name equals FavoriteWeapon(g.Weapons).Name - where o.HasSoulPatch - select new { o = o.Nickname, g = g.Nickname }, - elementSorter: e => e.o + e.g))).Message; + var message = (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => from o in ss.Set().OfType() + join g in ss.Set() on FavoriteWeapon(o.Weapons).Name equals FavoriteWeapon(g.Weapons).Name + where o.HasSoulPatch + select new { o = o.Nickname, g = g.Nickname }, + elementSorter: e => e.o + e.g))).Message; } private static Weapon FavoriteWeapon(IEnumerable weapons) @@ -2252,8 +2013,7 @@ private static Weapon FavoriteWeapon(IEnumerable weapons) private static IEnumerable Veterans(IEnumerable gears) => gears.Where(g => g.Nickname is "Marcus" or "Dom" or "Cole Train" or "Baird"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Member_access_on_derived_entity_using_cast(bool async) => AssertQuery( async, @@ -2263,8 +2023,7 @@ where f is LocustHorde select new { ((LocustHorde)f).Name, ((LocustHorde)f).Eradicated }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Member_access_on_derived_materialized_entity_using_cast(bool async) => AssertQuery( async, @@ -2279,8 +2038,7 @@ orderby f.Name Assert.Equal(e.Eradicated, a.Eradicated); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Member_access_on_derived_entity_using_cast_and_let(bool async) => AssertQuery( async, @@ -2291,8 +2049,7 @@ orderby horde.Name select new { horde.Name, horde.Eradicated }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Property_access_on_derived_entity_using_cast(bool async) => AssertQuery( async, @@ -2303,8 +2060,7 @@ orderby f.Name select new { Name = EF.Property(horde, "Name"), Eradicated = EF.Property((LocustHorde)f, "Eradicated") }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_access_on_derived_entity_using_cast(bool async) => AssertQuery( async, @@ -2314,8 +2070,7 @@ orderby f.Name select new { f.Name, Threat = ((LocustHorde)f).Commander.ThreatLevel }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_access_on_derived_materialized_entity_using_cast(bool async) => AssertQuery( async, @@ -2336,8 +2091,7 @@ orderby f.Name Assert.Equal(e.Threat, a.Threat); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_access_via_EFProperty_on_derived_entity_using_cast(bool async) => AssertQuery( async, @@ -2347,8 +2101,7 @@ orderby f.Name select new { f.Name, Threat = EF.Property((LocustHorde)f, "Commander").ThreatLevel }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_access_fk_on_derived_entity_using_cast(bool async) => AssertQuery( async, @@ -2358,8 +2111,7 @@ orderby f.Name select new { f.Name, CommanderName = ((LocustHorde)f).Commander.Name }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_navigation_access_on_derived_entity_using_cast(bool async) => AssertQuery( async, @@ -2369,8 +2121,7 @@ orderby f.Name select new { f.Name, LeadersCount = ((LocustHorde)f).Leaders.Count }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_navigation_access_on_derived_entity_using_cast_in_SelectMany(bool async) => AssertQuery( async, @@ -2380,8 +2131,7 @@ orderby l.Name select new { f.Name, LeaderName = l.Name }, elementSorter: e => (e.Name, e.LeaderName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_derived_entity_using_OfType(bool async) => AssertQuery( async, @@ -2394,8 +2144,7 @@ orderby lh.Name new ExpectedInclude(e2 => e2.Leaders)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_derived_entity_with_cast(bool async) // TODO: should we disable this scenario? see #14671 => AssertQuery( @@ -2407,8 +2156,7 @@ orderby f.Id elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e1 => e1.Capital)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_on_subquery_doesnt_get_lifted(bool async) => AssertQueryScalar( async, @@ -2416,8 +2164,7 @@ public virtual Task Distinct_on_subquery_doesnt_get_lifted(bool async) select ig).Distinct() select g.HasSoulPatch); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_result_operator_on_subquery_is_properly_lifted_to_a_convert(bool async) => AssertQueryScalar( async, @@ -2425,8 +2172,7 @@ public virtual Task Cast_result_operator_on_subquery_is_properly_lifted_to_a_con select f).Cast() select lh.Eradicated); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_two_collection_navigations_composite_key(bool async) => AssertQuery( async, @@ -2438,8 +2184,7 @@ orderby g1.Nickname select new { Nickname1 = g1.Nickname, Nickname2 = g2.Nickname }, elementSorter: e => (e.Nickname1, e.Nickname2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_two_collection_navigations_inheritance(bool async) => AssertQuery( async, @@ -2451,8 +2196,7 @@ where f is LocustHorde && o.HasSoulPatch select new { f.Name, o.Nickname }, elementSorter: e => (e.Name, e.Nickname)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_entities_using_Equals_inheritance(bool async) => AssertQuery( async, @@ -2463,8 +2207,7 @@ where g.Equals(o) select new { Nickname1 = g.Nickname, Nickname2 = o.Nickname }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_on_nullable_array_produces_correct_sql(bool async) { var cities = new[] { "Ephyra", null }; @@ -2474,15 +2217,13 @@ public virtual Task Contains_on_nullable_array_produces_correct_sql(bool async) ss => ss.Set().Where(g => g.SquadId < 2 && cities.Contains(g.AssignedCity.Name))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Optional_navigation_with_collection_composite_key(bool async) => AssertQuery( async, ss => ss.Set().Where(t => t.Gear is Officer && ((Officer)t.Gear).Reports.Count(r => r.Nickname == "Dom") > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_conditional_with_inheritance(bool async) => AssertQuery( async, @@ -2490,8 +2231,7 @@ public virtual Task Select_null_conditional_with_inheritance(bool async) .Where(f => f is LocustHorde) .Select(f => EF.Property((LocustHorde)f, "CommanderName") != null ? ((LocustHorde)f).CommanderName : null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_conditional_with_inheritance_negative(bool async) => AssertQueryScalar( async, @@ -2499,14 +2239,12 @@ public virtual Task Select_null_conditional_with_inheritance_negative(bool async .Where(f => f is LocustHorde) .Select(f => EF.Property((LocustHorde)f, "CommanderName") != null ? ((LocustHorde)f).Eradicated : null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_with_inheritance1(bool async) => AssertQuery( async, ss => ss.Set().OfType() - .Select( - h => new { h.Id, Leaders = EF.Property>(h.Commander.CommandingFaction, "Leaders") }), + .Select(h => new { h.Id, Leaders = EF.Property>(h.Commander.CommandingFaction, "Leaders") }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2514,14 +2252,12 @@ public virtual Task Project_collection_navigation_with_inheritance1(bool async) AssertCollection(e.Leaders, a.Leaders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_with_inheritance2(bool async) => AssertQuery( async, ss => ss.Set().OfType() - .Select( - h => new { h.Id, Gears = EF.Property>((Officer)h.Commander.DefeatedBy, "Reports") }), + .Select(h => new { h.Id, Gears = EF.Property>((Officer)h.Commander.DefeatedBy, "Reports") }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2529,15 +2265,16 @@ public virtual Task Project_collection_navigation_with_inheritance2(bool async) AssertCollection(e.Gears ?? new List(), a.Gears); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_with_inheritance3(bool async) => AssertQuery( async, ss => ss.Set() .Where(f => f is LocustHorde) - .Select( - f => new { f.Id, Gears = EF.Property>((Officer)((LocustHorde)f).Commander.DefeatedBy, "Reports") }), + .Select(f => new + { + f.Id, Gears = EF.Property>((Officer)((LocustHorde)f).Commander.DefeatedBy, "Reports") + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2545,24 +2282,21 @@ public virtual Task Project_collection_navigation_with_inheritance3(bool async) AssertCollection(e.Gears ?? new List(), a.Gears); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_on_derived_type_using_string(bool async) => AssertQuery( async, ss => ss.Set().Include("DefeatedBy"), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(lc => lc.DefeatedBy))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_on_derived_type_using_EF_Property(bool async) => AssertQuery( async, ss => ss.Set().Include(lc => EF.Property((LocustCommander)lc, "DefeatedBy")), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(lc => lc.DefeatedBy))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_on_derived_type_using_string_nested1(bool async) => AssertQuery( async, @@ -2572,8 +2306,7 @@ public virtual Task Include_reference_on_derived_type_using_string_nested1(bool new ExpectedInclude(lc => lc.DefeatedBy), new ExpectedInclude(g => g.Squad, "DefeatedBy"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_on_derived_type_using_string_nested2(bool async) => AssertQuery( async, @@ -2584,64 +2317,56 @@ public virtual Task Include_reference_on_derived_type_using_string_nested2(bool new ExpectedInclude(o => o.Reports, "DefeatedBy"), new ExpectedInclude(g => g.CityOfBirth, "DefeatedBy.Reports"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_on_derived_type_using_lambda(bool async) => AssertQuery( async, ss => ss.Set().Include(ll => ((LocustCommander)ll).DefeatedBy), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(lc => lc.DefeatedBy))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_on_derived_type_using_lambda_with_soft_cast(bool async) => AssertQuery( async, ss => ss.Set().Include(ll => (ll as LocustCommander).DefeatedBy), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(lc => lc.DefeatedBy))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_on_derived_type_using_lambda_with_tracking(bool async) => AssertQuery( async, ss => ss.Set().AsTracking().Include(ll => ((LocustCommander)ll).DefeatedBy), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(lc => lc.DefeatedBy))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_on_derived_type_using_string(bool async) => AssertQuery( async, ss => ss.Set().Include("Reports"), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_on_derived_type_using_EF_Property(bool async) => AssertQuery( async, ss => ss.Set().Include(o => EF.Property>((Officer)o, "Reports")), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_on_derived_type_using_lambda(bool async) => AssertQuery( async, ss => ss.Set().Include(g => ((Officer)g).Reports), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_on_derived_type_using_lambda_with_soft_cast(bool async) => AssertQuery( async, ss => ss.Set().Include(g => (g as Officer).Reports), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_base_navigation_on_derived_entity(bool async) => AssertQuery( async, @@ -2651,8 +2376,7 @@ public virtual Task Include_base_navigation_on_derived_entity(bool async) new ExpectedInclude(e1 => e1.Tag), new ExpectedInclude(e2 => e2.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ThenInclude_collection_on_derived_after_base_reference(bool async) => AssertQuery( async, @@ -2662,8 +2386,7 @@ public virtual Task ThenInclude_collection_on_derived_after_base_reference(bool new ExpectedInclude(e1 => e1.Gear), new ExpectedInclude(e2 => e2.Weapons, "Gear"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ThenInclude_collection_on_derived_after_derived_reference(bool async) => AssertQuery( async, @@ -2674,8 +2397,7 @@ public virtual Task ThenInclude_collection_on_derived_after_derived_reference(bo new ExpectedInclude(e2 => e2.DefeatedBy, "Commander"), new ExpectedInclude(e3 => e3.Reports, "Commander.DefeatedBy"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ThenInclude_collection_on_derived_after_derived_collection(bool async) => AssertQuery( async, @@ -2685,8 +2407,7 @@ public virtual Task ThenInclude_collection_on_derived_after_derived_collection(b new ExpectedInclude(e1 => e1.Reports), new ExpectedInclude(e2 => e2.Reports, "Reports"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ThenInclude_reference_on_derived_after_derived_collection(bool async) => AssertQuery( async, @@ -2696,8 +2417,7 @@ public virtual Task ThenInclude_reference_on_derived_after_derived_collection(bo new ExpectedInclude(e1 => e1.Leaders), new ExpectedInclude(e2 => e2.DefeatedBy, "Leaders"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_derived_included_on_one_method(bool async) => AssertQuery( async, @@ -2708,8 +2428,7 @@ public virtual Task Multiple_derived_included_on_one_method(bool async) new ExpectedInclude(e2 => e2.DefeatedBy, "Commander"), new ExpectedInclude(e3 => e3.Reports, "Commander.DefeatedBy"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_derived_multi_level(bool async) => AssertQuery( async, @@ -2720,33 +2439,28 @@ public virtual Task Include_on_derived_multi_level(bool async) new ExpectedInclude(e2 => e2.Squad, "Reports"), new ExpectedInclude(e3 => e3.Missions, "Reports.Squad"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_collection_and_invalid_navigation_using_string_throws(bool async) { - var message = (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include("Reports.Foo")))).Message; + var message = (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include("Reports.Foo")))).Message; Assert.Contains( CoreResources.LogInvalidIncludePath(new TestLogger()) .GenerateMessage("Foo", "Reports.Foo"), message); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_nullable_bool_in_conditional_works(bool async) => AssertQuery( async, ss => - ss.Set().Select( - cg => - new { Prop = cg.Gear != null ? cg.Gear.HasSoulPatch : false }), + ss.Set().Select(cg => + new { Prop = cg.Gear != null ? cg.Gear.HasSoulPatch : false }), e => e.Prop); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_naked_navigation_with_ToList(bool async) => AssertQuery( async, @@ -2757,8 +2471,7 @@ select g.Weapons.ToList(), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_naked_navigation_with_ToList_followed_by_projecting_count(bool async) => AssertQueryScalar( async, @@ -2768,8 +2481,7 @@ orderby g.Nickname select g.Weapons.ToList()).Select(e => e.Count), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_naked_navigation_with_ToArray(bool async) => AssertQuery( async, @@ -2780,8 +2492,7 @@ select g.Weapons.ToArray(), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_basic_projection(bool async) => AssertQuery( async, @@ -2794,8 +2505,7 @@ orderby g.Nickname assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_basic_projection_explicit_to_list(bool async) => AssertQuery( async, @@ -2808,8 +2518,7 @@ orderby g.Nickname assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_basic_projection_explicit_to_array(bool async) => AssertQuery( async, @@ -2822,8 +2531,7 @@ orderby g.Nickname assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_basic_projection_ordered(bool async) => AssertQuery( async, @@ -2837,8 +2545,7 @@ orderby w.Name descending assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_basic_projection_composite_key(bool async) => AssertQuery( async, @@ -2867,8 +2574,7 @@ from o in ss.Set().OfType() }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_basic_projecting_single_property(bool async) => AssertQuery( async, @@ -2881,8 +2587,7 @@ orderby g.Nickname assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_basic_projecting_constant(bool async) => AssertQuery( async, @@ -2895,8 +2600,7 @@ orderby g.Nickname assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_basic_projecting_constant_bool(bool async) => AssertQuery( async, @@ -2909,8 +2613,7 @@ orderby g.Nickname assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_projection_of_collection_thru_navigation(bool async) => AssertQuery( async, @@ -2921,8 +2624,7 @@ select g.Squad.Missions.Where(m => m.MissionId != 17).ToList(), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_project_anonymous_collection_result(bool async) => AssertQuery( async, @@ -2941,8 +2643,7 @@ where s.Id < 20 AssertCollection(e.Collection, a.Collection, elementSorter: ee => ee.FullName); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_nested(bool async) => AssertQuery( async, @@ -2959,8 +2660,7 @@ where ps.SquadId < 7 elementSorter: ee => ee.Count(), elementAsserter: (ee, aa) => AssertCollection(ee, aa))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_nested_mixed_streaming_with_buffer1(bool async) => AssertQuery( async, @@ -2977,8 +2677,7 @@ where ps.SquadId < 2 elementSorter: ee => ee.Count(), elementAsserter: (ee, aa) => AssertCollection(ee, aa))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_nested_mixed_streaming_with_buffer2(bool async) => AssertQuery( async, @@ -2995,30 +2694,27 @@ where ps.SquadId < 7 elementSorter: ee => ee.Count(), elementAsserter: (ee, aa) => AssertCollection(ee, aa))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_nested_with_custom_ordering(bool async) => AssertQuery( async, ss => ss.Set() .OfType() .OrderByDescending(o => o.HasSoulPatch) - .Select( - o => new - { - o.FullName, - OuterCollection = o.Reports - .Where(r => r.FullName != "Foo") - .OrderBy(r => r.Rank) - .Select( - g => new - { - g.FullName, - InnerCollection = g.Weapons - .Where(w => w.Name != "Bar") - .OrderBy(w => w.IsAutomatic).ToList() - }).ToList() - }), + .Select(o => new + { + o.FullName, + OuterCollection = o.Reports + .Where(r => r.FullName != "Foo") + .OrderBy(r => r.Rank) + .Select(g => new + { + g.FullName, + InnerCollection = g.Weapons + .Where(w => w.Name != "Bar") + .OrderBy(w => w.IsAutomatic).ToList() + }).ToList() + }), elementSorter: e => e.FullName, elementAsserter: (e, a) => { @@ -3034,8 +2730,7 @@ public virtual Task Correlated_collections_nested_with_custom_ordering(bool asyn }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_same_collection_projected_multiple_times(bool async) => AssertQuery( async, @@ -3055,8 +2750,7 @@ from g in ss.Set() AssertCollection(e.Second, a.Second); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_similar_collection_projected_multiple_times(bool async) => AssertQuery( async, @@ -3077,8 +2771,7 @@ orderby g.Rank AssertCollection(e.Second, a.Second); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_different_collections_projected(bool async) => AssertQuery( async, @@ -3088,10 +2781,8 @@ orderby o.FullName select new { o.Nickname, - First = o.Weapons.Where(w => w.IsAutomatic).Select( - w => new { w.Name, w.IsAutomatic }).ToArray(), - Second = o.Reports.OrderBy(r => r.FullName).Select( - r => new { r.Nickname, r.Rank }).ToList() + First = o.Weapons.Where(w => w.IsAutomatic).Select(w => new { w.Name, w.IsAutomatic }).ToArray(), + Second = o.Reports.OrderBy(r => r.FullName).Select(r => new { r.Nickname, r.Rank }).ToList() }, assertOrder: true, elementAsserter: (e, a) => @@ -3101,8 +2792,7 @@ orderby o.FullName AssertCollection(e.Second, a.Second, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys(bool async) => AssertQuery( async, @@ -3113,8 +2803,7 @@ where o.Reports.Any() select o.FullName, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery(bool async) => AssertQuery( async, @@ -3136,8 +2825,7 @@ where o.Reports.Any() AssertCollection(e.OuterCollection2, a.OuterCollection2, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery_duplicated_orderings( bool async) => AssertQuery( @@ -3161,8 +2849,7 @@ where o.Reports.Any() AssertCollection(e.OuterCollection2, a.OuterCollection2, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery_complex_orderings( bool async) => AssertQuery( @@ -3185,8 +2872,7 @@ where o.Reports.Any() AssertCollection(e.OuterCollection2, a.OuterCollection2, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_multiple_nested_complex_collections(bool async) => AssertQuery( async, @@ -3209,10 +2895,12 @@ orderby w.IsAutomatic select new { w.Id, - InnerFirst = w.Owner.Weapons.Select( - ww => new { ww.Name, ww.IsAutomatic }).ToList(), - InnerSecond = w.Owner.Squad.Members.OrderBy(mm => mm.Nickname).Select( - mm => new { mm.Nickname, mm.HasSoulPatch }).ToList() + InnerFirst = + w.Owner.Weapons.Select(ww => new { ww.Name, ww.IsAutomatic }) + .ToList(), + InnerSecond = + w.Owner.Squad.Members.OrderBy(mm => mm.Nickname) + .Select(mm => new { mm.Nickname, mm.HasSoulPatch }).ToList() }).ToList() }).ToList(), OuterCollection2 = (from www in o.Tag.Gear.Weapons @@ -3250,8 +2938,7 @@ orderby w.IsAutomatic AssertCollection(e.OuterCollection2, a.OuterCollection2, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_inner_subquery_selector_references_outer_qsre(bool async) => AssertQuery( async, @@ -3270,8 +2957,7 @@ from o in ss.Set().OfType() AssertCollection(e.Collection, a.Collection, elementSorter: ee => (ee.ReportName, ee.OfficerName)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_inner_subquery_predicate_references_outer_qsre(bool async) => AssertQuery( async, @@ -3291,8 +2977,7 @@ from o in ss.Set().OfType() AssertCollection(e.Collection, a.Collection, elementSorter: ee => ee.ReportName); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_nested_inner_subquery_references_outer_qsre_one_level_up(bool async) => AssertQuery( async, @@ -3326,8 +3011,7 @@ from o in ss.Set().OfType() }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_nested_inner_subquery_references_outer_qsre_two_levels_up(bool async) => AssertQuery( async, @@ -3361,8 +3045,7 @@ from o in ss.Set().OfType() }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_on_select_many(bool async) => AssertQuery( async, @@ -3392,8 +3075,7 @@ select m AssertCollection(e.Collection2, a.Collection2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_with_Skip(bool async) => AssertQuery( async, @@ -3401,8 +3083,7 @@ public virtual Task Correlated_collections_with_Skip(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_with_Take(bool async) => AssertQuery( async, @@ -3410,8 +3091,7 @@ public virtual Task Correlated_collections_with_Take(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_with_Distinct(bool async) => AssertQuery( async, @@ -3419,8 +3099,7 @@ public virtual Task Correlated_collections_with_Distinct(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_with_FirstOrDefault(bool async) => AssertQuery( async, @@ -3428,8 +3107,7 @@ public virtual Task Correlated_collections_with_FirstOrDefault(bool async) .Select(s => s.Members.OrderBy(m => m.Nickname).Select(m => m.FullName).FirstOrDefault()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_on_left_join_with_predicate(bool async) => AssertQuery( async, @@ -3450,8 +3128,7 @@ from g in grouping.DefaultIfEmpty() AssertCollection(e.WeaponNames, a.WeaponNames); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_on_RightJoin_with_predicate(bool async) => AssertQuery( async, @@ -3478,8 +3155,7 @@ public virtual Task Correlated_collections_on_RightJoin_with_predicate(bool asyn AssertCollection(e.WeaponNames, a.WeaponNames); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_on_left_join_with_null_value(bool async) => AssertQuery( async, @@ -3497,8 +3173,7 @@ orderby t.Note assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_left_join_with_self_reference(bool async) => AssertQuery( async, @@ -3519,8 +3194,7 @@ from o in grouping.DefaultIfEmpty() AssertCollection(e.ReportNames, a.ReportNames); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_deeply_nested_left_join(bool async) => AssertQuery( async, @@ -3529,8 +3203,8 @@ from t in ss.Set() join g in ss.Set() on t.GearNickName equals g.Nickname into grouping from g in grouping.DefaultIfEmpty() orderby t.Note, g.Nickname descending - select g.Squad.Members.Where(m => m.HasSoulPatch).Select( - m => new { m.Nickname, AutomaticWeapons = m.Weapons.Where(w => w.IsAutomatic).ToList() }).ToList(), + select g.Squad.Members.Where(m => m.HasSoulPatch) + .Select(m => new { m.Nickname, AutomaticWeapons = m.Weapons.Where(w => w.IsAutomatic).ToList() }).ToList(), ss => from t in ss.Set() join g in ss.Set() on t.GearNickName equals g.Nickname into grouping @@ -3553,19 +3227,17 @@ from g in grouping.DefaultIfEmpty() AssertCollection(ee.AutomaticWeapons, aa.AutomaticWeapons); })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_from_left_join_with_additional_elements_projected_of_that_join(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(w => w.Name).Select( - w => w.Owner.Squad.Members.OrderByDescending(m => m.FullName).Select( - m => new { Weapons = m.Weapons.Where(ww => !ww.IsAutomatic).OrderBy(ww => ww.Id).ToList(), m.Rank }).ToList()), - ss => ss.Set().OrderBy(w => w.Name).Select( - w => w.Owner != null - ? w.Owner.Squad.Members.OrderByDescending(m => m.FullName).Select( - m => new { Weapons = m.Weapons.Where(ww => !ww.IsAutomatic).OrderBy(ww => ww.Id).ToList(), m.Rank }).ToList() - : Enumerable.Empty().Select(x => new { Weapons = new List(), Rank = default(MilitaryRank) })), + ss => ss.Set().OrderBy(w => w.Name).Select(w + => w.Owner.Squad.Members.OrderByDescending(m => m.FullName).Select(m + => new { Weapons = m.Weapons.Where(ww => !ww.IsAutomatic).OrderBy(ww => ww.Id).ToList(), m.Rank }).ToList()), + ss => ss.Set().OrderBy(w => w.Name).Select(w => w.Owner != null + ? w.Owner.Squad.Members.OrderByDescending(m => m.FullName).Select(m + => new { Weapons = m.Weapons.Where(ww => !ww.IsAutomatic).OrderBy(ww => ww.Id).ToList(), m.Rank }).ToList() + : Enumerable.Empty().Select(x => new { Weapons = new List(), Rank = default(MilitaryRank) })), assertOrder: true, elementAsserter: (e, a) => AssertCollection( e, a, ordered: true, elementAsserter: (ee, aa) => @@ -3574,8 +3246,7 @@ public virtual Task Correlated_collections_from_left_join_with_additional_elemen AssertCollection(ee.Weapons, aa.Weapons, ordered: true); })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_complex_scenario1(bool async) => AssertQuery( async, @@ -3588,8 +3259,9 @@ from r in ss.Set() select new { w.Id, - InnerCollection = w.Owner.Squad.Members.OrderBy(mm => mm.Nickname).Select( - mm => new { mm.Nickname, mm.HasSoulPatch }).ToList() + InnerCollection = + w.Owner.Squad.Members.OrderBy(mm => mm.Nickname) + .Select(mm => new { mm.Nickname, mm.HasSoulPatch }).ToList() }).ToList() }, elementSorter: e => e.FullName, @@ -3607,8 +3279,7 @@ from r in ss.Set() }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_complex_scenario2(bool async) => AssertQuery( async, @@ -3625,8 +3296,8 @@ from o in ss.Set().OfType() select new { w.Id, - InnerSecond = w.Owner.Squad.Members.OrderBy(mm => mm.Nickname).Select( - mm => new { mm.Nickname, mm.HasSoulPatch }).ToList() + InnerSecond = w.Owner.Squad.Members.OrderBy(mm => mm.Nickname) + .Select(mm => new { mm.Nickname, mm.HasSoulPatch }).ToList() }).ToList() }).ToList() }, @@ -3653,8 +3324,7 @@ from o in ss.Set().OfType() }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_with_funky_orderby_complex_scenario1(bool async) => AssertQuery( async, @@ -3668,8 +3338,9 @@ from r in ss.Set() select new { w.Id, - InnerCollection = w.Owner.Squad.Members.OrderBy(mm => mm.Nickname).Select( - mm => new { mm.Nickname, mm.HasSoulPatch }).ToList() + InnerCollection = + w.Owner.Squad.Members.OrderBy(mm => mm.Nickname) + .Select(mm => new { mm.Nickname, mm.HasSoulPatch }).ToList() }).ToList() }, assertOrder: true, @@ -3687,8 +3358,7 @@ from r in ss.Set() }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collections_with_funky_orderby_complex_scenario2(bool async) => AssertQuery( async, @@ -3709,8 +3379,8 @@ from o in ss.Set().OfType() select new { w.Id, - InnerSecond = w.Owner.Squad.Members.OrderBy(mm => mm.Nickname).Select( - mm => new { mm.Nickname, mm.HasSoulPatch }).ToList() + InnerSecond = w.Owner.Squad.Members.OrderBy(mm => mm.Nickname) + .Select(mm => new { mm.Nickname, mm.HasSoulPatch }).ToList() }).ToList() }).ToList() }, @@ -3737,39 +3407,34 @@ from o in ss.Set().OfType() }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_top_level_FirstOrDefault(bool async) => AssertFirstOrDefault( async, ss => ss.Set().OrderBy(g => g.Nickname).Select(g => g.Weapons), asserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_top_level_Count(bool async) => AssertCount( async, ss => ss.Set().Select(g => g.Weapons)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_top_level_Last_with_orderby_on_outer(bool async) => AssertLast( async, ss => ss.Set().OrderByDescending(g => g.FullName).Select(g => g.Weapons), asserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_top_level_Last_with_order_by_on_inner(bool async) => AssertLast( async, ss => ss.Set().OrderBy(g => g.FullName).Select(g => g.Weapons.OrderBy(w => w.Name).ToList()), asserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_semantics_on_nullable_bool_from_inner_join_subquery_is_fully_applied(bool async) => AssertQuery( async, @@ -3779,8 +3444,7 @@ join h in ss.Set().OfType().Where(f => f.Name == "Swarm") where h.Eradicated != true select h); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_semantics_on_nullable_bool_from_left_join_subquery_is_fully_applied(bool async) => AssertQuery( async, @@ -3792,8 +3456,7 @@ from h in grouping.DefaultIfEmpty() where h.Eradicated != true select h); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_derived_type_with_order_by_and_paging(bool async) => AssertQuery( async, @@ -3805,32 +3468,28 @@ public virtual Task Include_on_derived_type_with_order_by_and_paging(bool async) new ExpectedInclude(e1 => e1.DefeatedBy), new ExpectedInclude(e2 => e2.Weapons, "DefeatedBy"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_required_navigation_on_derived_type(bool async) => AssertQuery( async, ss => ss.Set().Select(ll => ((LocustCommander)ll).HighCommand.Name), ss => ss.Set().Select(ll => ll is LocustCommander ? ((LocustCommander)ll).HighCommand.Name : null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_required_navigation_on_the_same_type_with_cast(bool async) => AssertQuery( async, ss => ss.Set().Select(g => g.CityOfBirth.Name), ss => ss.Set().Select(g => g.CityOfBirth.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_required_navigation_on_derived_type(bool async) => AssertQuery( async, ss => ss.Set().Where(ll => ((LocustCommander)ll).HighCommand.IsOperational), ss => ss.Set().Where(ll => ll is LocustCommander ? ((LocustCommander)ll).HighCommand.IsOperational : false)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Outer_parameter_in_join_key(bool async) => AssertQuery( async, @@ -3846,8 +3505,7 @@ join g in ss.Set() on o.FullName equals g.FullName assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.Collection, a.Collection)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Outer_parameter_in_join_key_inner_and_outer(bool async) => AssertQuery( async, @@ -3863,8 +3521,7 @@ join g in ss.Set() on o.FullName equals o.Nickname assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.Collection, a.Collection)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Outer_parameter_in_group_join_with_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -3881,38 +3538,32 @@ from g in grouping.DefaultIfEmpty() assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.Collection, a.Collection)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_with_concat(bool async) => Assert.Equal( CoreStrings.SetOperationWithDifferentIncludesInOperands, - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(g => g.Squad).Concat(ss.Set()), - elementAsserter: (e, a) => AssertInclude( - e, a, - new ExpectedInclude(g => g.Squad), - new ExpectedInclude(o => o.Squad))))).Message); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(g => g.Squad).Concat(ss.Set()), + elementAsserter: (e, a) => AssertInclude( + e, a, + new ExpectedInclude(g => g.Squad), + new ExpectedInclude(o => o.Squad))))).Message); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Negated_bool_ternary_inside_anonymous_type_in_projection(bool async) => AssertQuery( async, - ss => ss.Set().Select( - t => new { c = !(t.Gear.HasSoulPatch ? true : ((bool?)t.Gear.HasSoulPatch ?? true)) }), - ss => ss.Set().Select( - t => new - { - c = !(t.Gear.MaybeScalar(x => x.HasSoulPatch) ?? false - ? true - : (t.Gear.MaybeScalar(x => x.HasSoulPatch) ?? true)) - }), + ss => ss.Set().Select(t => new { c = !(t.Gear.HasSoulPatch ? true : ((bool?)t.Gear.HasSoulPatch ?? true)) }), + ss => ss.Set().Select(t => new + { + c = !(t.Gear.MaybeScalar(x => x.HasSoulPatch) ?? false + ? true + : (t.Gear.MaybeScalar(x => x.HasSoulPatch) ?? true)) + }), elementSorter: e => e.c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_entity_qsre(bool async) => AssertQuery( async, @@ -3920,8 +3571,7 @@ public virtual Task Order_by_entity_qsre(bool async) ss => ss.Set().OrderBy(g => g.AssignedCity.Name).ThenByDescending(g => g.Nickname).Select(f => f.FullName), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_entity_qsre_with_inheritance(bool async) => AssertQuery( async, @@ -3929,8 +3579,7 @@ public virtual Task Order_by_entity_qsre_with_inheritance(bool async) .Select(lc => lc.Name), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_entity_qsre_composite_key(bool async) => AssertQuery( async, @@ -3940,8 +3589,7 @@ public virtual Task Order_by_entity_qsre_composite_key(bool async) .ThenBy(w => w.Id).Select(w => w.Name), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_entity_qsre_with_other_orderbys(bool async) => AssertQuery( async, @@ -3955,8 +3603,7 @@ public virtual Task Order_by_entity_qsre_with_other_orderbys(bool async) .ThenBy(w => w.Name), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_on_entity_qsre_keys(bool async) => AssertQuery( async, @@ -3965,8 +3612,7 @@ join w2 in ss.Set() on w1 equals w2 select new { Name1 = w1.Name, Name2 = w2.Name }, elementSorter: e => e.Name1 + " " + e.Name2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_on_entity_qsre_keys_composite_key(bool async) => AssertQuery( async, @@ -3975,8 +3621,7 @@ join g2 in ss.Set() on g1 equals g2 select new { GearName1 = g1.FullName, GearName2 = g2.FullName }, elementSorter: e => (e.GearName1, e.GearName2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_on_entity_qsre_keys_inheritance(bool async) => AssertQuery( async, @@ -3985,8 +3630,7 @@ join o in ss.Set().OfType() on g equals o select new { GearName = g.FullName, OfficerName = o.FullName }, elementSorter: e => (e.GearName, e.OfficerName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_on_entity_qsre_keys_outer_key_is_navigation(bool async) => AssertQuery( async, @@ -3995,8 +3639,7 @@ join w2 in ss.Set() on w1.SynergyWith equals w2 select new { Name1 = w1.Name, Name2 = w2.Name }, elementSorter: e => (e.Name1, e.Name2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_on_entity_qsre_keys_inner_key_is_navigation(bool async) => AssertQuery( async, @@ -4006,8 +3649,7 @@ join g in ss.Set() on c equals g.AssignedCity select new { CityName = c.Name, GearNickname = g.Nickname }, elementSorter: e => (e.CityName, e.GearNickname)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_on_entity_qsre_keys_inner_key_is_navigation_composite_key(bool async) => AssertQuery( async, @@ -4017,8 +3659,7 @@ join t in ss.Set().Where(tt => tt.Note == "Cole's Tag" || tt.Note == "Do select new { g.Nickname, t.Note }, elementSorter: e => (e.Nickname, e.Note)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_on_entity_qsre_keys_inner_key_is_nested_navigation(bool async) => AssertQuery( async, @@ -4028,8 +3669,7 @@ join w in ss.Set().Where(ww => ww.IsAutomatic) on s equals w.Owner.Squad select new { SquadName = s.Name, WeaponName = w.Name }, elementSorter: e => (e.SquadName, e.WeaponName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_on_entity_qsre_keys_inner_key_is_nested_navigation(bool async) => AssertQuery( async, @@ -4039,8 +3679,7 @@ from w in grouping.DefaultIfEmpty() select new { SquadName = s.Name, WeaponName = w.Name }, elementSorter: e => (e.SquadName, e.WeaponName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_complex_key_selector(bool async) => AssertQuery( async, @@ -4059,8 +3698,7 @@ public virtual Task Join_with_complex_key_selector(bool async) .Select(r => new { r.o.Id, TagId = r.i.Id }), elementSorter: e => (e.Id, e.TagId)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Streaming_correlated_collection_issue_11403_returning_ordered_enumerable_throws(bool async) => AssertInvalidMaterializationType( () => AssertFirstOrDefault( @@ -4071,8 +3709,7 @@ public virtual Task Streaming_correlated_collection_issue_11403_returning_ordere asserter: (e, a) => AssertCollection(e, a, ordered: true)), typeof(IOrderedEnumerable).ShortDisplayName()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Streaming_correlated_collection_issue_11403(bool async) => AssertFirstOrDefault( async, @@ -4081,41 +3718,36 @@ public virtual Task Streaming_correlated_collection_issue_11403(bool async) .Select(g => g.Weapons.Where(w => !w.IsAutomatic).OrderBy(w => w.Id).ToList()), asserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_one_value_type_from_empty_collection(bool async) => AssertQuery( async, - ss => ss.Set().Where(s => s.Name == "Kilo").Select( - s => new { s.Name, SquadId = s.Members.Where(m => m.HasSoulPatch).Select(m => m.SquadId).FirstOrDefault() })); + ss => ss.Set().Where(s => s.Name == "Kilo").Select(s + => new { s.Name, SquadId = s.Members.Where(m => m.HasSoulPatch).Select(m => m.SquadId).FirstOrDefault() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_one_value_type_converted_to_nullable_from_empty_collection(bool async) => AssertQuery( async, - ss => ss.Set().Where(s => s.Name == "Kilo").Select( - s => new { s.Name, SquadId = s.Members.Where(m => m.HasSoulPatch).Select(m => (int?)m.SquadId).FirstOrDefault() })); + ss => ss.Set().Where(s => s.Name == "Kilo").Select(s + => new { s.Name, SquadId = s.Members.Where(m => m.HasSoulPatch).Select(m => (int?)m.SquadId).FirstOrDefault() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_one_value_type_with_client_projection_from_empty_collection(bool async) => AssertQuery( async, - ss => ss.Set().Where(s => s.Name == "Kilo").Select( - s => new - { - s.Name, - SquadId = s.Members.Where(m => m.HasSoulPatch).Select(m => ClientFunction(m.SquadId, m.LeaderSquadId)) - .FirstOrDefault() - }), + ss => ss.Set().Where(s => s.Name == "Kilo").Select(s => new + { + s.Name, + SquadId = s.Members.Where(m => m.HasSoulPatch).Select(m => ClientFunction(m.SquadId, m.LeaderSquadId)) + .FirstOrDefault() + }), elementSorter: s => s.Name); private static int ClientFunction(int a, int b) => a + b + 1; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_subquery_projecting_one_value_type_from_empty_collection(bool async) => AssertQuery( async, @@ -4123,53 +3755,44 @@ public virtual Task Filter_on_subquery_projecting_one_value_type_from_empty_coll .Where(s => s.Members.Where(m => m.HasSoulPatch).Select(m => m.SquadId).FirstOrDefault() != 0).Select(s => s.Name), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_projecting_single_constant_int(bool async) => AssertQuery( async, - ss => ss.Set().Select( - s => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => 42).FirstOrDefault() })); + ss => ss.Set() + .Select(s => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => 42).FirstOrDefault() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_projecting_single_constant_string(bool async) => AssertQuery( async, - ss => ss.Set().Select( - s => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => "Foo").FirstOrDefault() })); + ss => ss.Set().Select(s + => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => "Foo").FirstOrDefault() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_projecting_single_constant_bool(bool async) => AssertQuery( async, - ss => ss.Set().Select( - s => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => true).FirstOrDefault() })); + ss => ss.Set() + .Select(s => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => true).FirstOrDefault() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_projecting_single_constant_inside_anonymous(bool async) => AssertQuery( async, - ss => ss.Set().Select( - s => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => new { One = 1 }).FirstOrDefault() })); + ss => ss.Set().Select(s + => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => new { One = 1 }).FirstOrDefault() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_projecting_multiple_constants_inside_anonymous(bool async) => AssertQuery( async, - ss => ss.Set().Select( - s => new - { - s.Name, - Gear = s.Members.Where(g => g.HasSoulPatch).Select( - g => new { True1 = true, False1 = false }).FirstOrDefault() - })); + ss => ss.Set().Select(s => new + { + s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => new { True1 = true, False1 = false }).FirstOrDefault() + })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_order_by_constant(bool async) => AssertQuery( async, @@ -4177,13 +3800,12 @@ public virtual Task Include_with_order_by_constant(bool async) expectedQuery: ss => ss.Set(), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(s => s.Members))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_order_by_constant(bool async) => AssertQuery( async, - ss => ss.Set().OrderByDescending(s => 1).Select( - g => new { g.Nickname, Weapons = g.Weapons.Select(w => w.Name).ToList() }), + ss => ss.Set().OrderByDescending(s => 1) + .Select(g => new { g.Nickname, Weapons = g.Weapons.Select(w => w.Name).ToList() }), elementSorter: e => e.Nickname, elementAsserter: (e, a) => { @@ -4193,21 +3815,19 @@ public virtual Task Correlated_collection_order_by_constant(bool async) public class MyDTO; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_projecting_single_constant_null_of_non_mapped_type(bool async) => AssertQuery( async, - ss => ss.Set().Select( - s => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => (MyDTO)null).FirstOrDefault() })); + ss => ss.Set().Select(s + => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => (MyDTO)null).FirstOrDefault() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_projecting_single_constant_of_non_mapped_type(bool async) => AssertQuery( async, - ss => ss.Set().Select( - s => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => new MyDTO()).FirstOrDefault() }), + ss => ss.Set().Select(s + => new { s.Name, Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => new MyDTO()).FirstOrDefault() }), elementSorter: e => e.Name, elementAsserter: (e, a) => { @@ -4218,13 +3838,12 @@ public virtual Task Select_subquery_projecting_single_constant_of_non_mapped_typ } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_order_by_constant_null_of_non_mapped_type(bool async) => AssertQuery( async, - ss => ss.Set().OrderByDescending(s => (MyDTO)null).Select( - g => new { g.Nickname, Weapons = g.Weapons.Select(w => w.Name).ToList() }), + ss => ss.Set().OrderByDescending(s => (MyDTO)null) + .Select(g => new { g.Nickname, Weapons = g.Weapons.Select(w => w.Name).ToList() }), elementSorter: e => e.Nickname, elementAsserter: (e, a) => { @@ -4232,8 +3851,7 @@ public virtual Task Correlated_collection_order_by_constant_null_of_non_mapped_t AssertCollection(e.Weapons, a.Weapons); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_OrderBy_aggregate(bool async) => AssertQuery( async, @@ -4243,8 +3861,7 @@ public virtual Task Include_collection_OrderBy_aggregate(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_complex_OrderBy2(bool async) => AssertQuery( async, @@ -4254,8 +3871,7 @@ public virtual Task Include_collection_with_complex_OrderBy2(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_complex_OrderBy3(bool async) => AssertQuery( async, @@ -4265,8 +3881,7 @@ public virtual Task Include_collection_with_complex_OrderBy3(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Reports)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_complex_OrderBy(bool async) => AssertQuery( async, @@ -4276,96 +3891,81 @@ public virtual Task Correlated_collection_with_complex_OrderBy(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_very_complex_order_by(bool async) => AssertQuery( async, ss => ss.Set().OfType() - .OrderBy( - o => o.Weapons.Where( - w => w.IsAutomatic - == ss.Set().Where(g => g.Nickname == "Marcus").Select(g => g.HasSoulPatch) - .FirstOrDefault()) - .Count()).ThenBy(g => g.Nickname) + .OrderBy(o => o.Weapons.Where(w => w.IsAutomatic + == ss.Set().Where(g => g.Nickname == "Marcus").Select(g => g.HasSoulPatch) + .FirstOrDefault()) + .Count()).ThenBy(g => g.Nickname) .Select(o => o.Reports.Where(g => !g.HasSoulPatch).ToList()), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_to_derived_type_causes_client_eval(bool async) => Assert.ThrowsAsync(() => AssertQuery(async, ss => ss.Set().Cast())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_to_derived_type_after_OfType_works(bool async) => AssertQuery( async, ss => ss.Set().OfType().Cast()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_boolean(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(g => g.Weapons.OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_boolean_with_pushdown(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(g => g.Weapons.OrderBy(w => w.Id).FirstOrDefault().IsAutomatic)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_int_with_inside_cast_and_coalesce(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(g => g.Weapons.OrderBy(w => w.Id).Select(w => (int?)w.Id).FirstOrDefault() ?? 42)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_int_with_outside_cast_and_coalesce(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(g => (int?)g.Weapons.OrderBy(w => w.Id).Select(w => w.Id).FirstOrDefault() ?? 42)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_int_with_pushdown_and_coalesce(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(g => (int?)g.Weapons.OrderBy(w => w.Id).FirstOrDefault().Id ?? 42)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_int_with_pushdown_and_coalesce2(bool async) => AssertQueryScalar( async, - ss => ss.Set().Select( - g => (int?)g.Weapons.OrderBy(w => w.Id).FirstOrDefault().Id ?? g.Weapons.OrderBy(w => w.Id).FirstOrDefault().Id)); + ss => ss.Set().Select(g + => (int?)g.Weapons.OrderBy(w => w.Id).FirstOrDefault().Id ?? g.Weapons.OrderBy(w => w.Id).FirstOrDefault().Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_boolean_empty(bool async) => AssertQueryScalar( async, - ss => ss.Set().Select( - g => g.Weapons.Where(w => w.Name == "BFG").OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault())); + ss => ss.Set().Select(g + => g.Weapons.Where(w => w.Name == "BFG").OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_boolean_empty_with_pushdown(bool async) => AssertQueryScalar( async, - ss => ss.Set().Select( - g => (bool?)g.Weapons.Where(w => w.Name == "BFG").OrderBy(w => w.Id).FirstOrDefault().IsAutomatic), + ss => ss.Set().Select(g => (bool?)g.Weapons.Where(w => w.Name == "BFG").OrderBy(w => w.Id).FirstOrDefault().IsAutomatic), ss => ss.Set().Select(g => (bool?)null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_distinct_singleordefault_boolean1(bool async) => AssertQueryScalar( async, @@ -4373,8 +3973,7 @@ public virtual Task Select_subquery_distinct_singleordefault_boolean1(bool async .Select(g => g.Weapons.Where(w => w.Name.Contains("Lancer")).Distinct().Select(w => w.IsAutomatic).SingleOrDefault()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_distinct_singleordefault_boolean2(bool async) => AssertQueryScalar( async, @@ -4382,8 +3981,7 @@ public virtual Task Select_subquery_distinct_singleordefault_boolean2(bool async .Select(g => g.Weapons.Where(w => w.Name.Contains("Lancer")).Select(w => w.IsAutomatic).Distinct().SingleOrDefault()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_distinct_singleordefault_boolean_with_pushdown(bool async) => AssertQueryScalar( async, @@ -4391,24 +3989,21 @@ public virtual Task Select_subquery_distinct_singleordefault_boolean_with_pushdo .Select(g => g.Weapons.Where(w => w.Name.Contains("Lancer")).Distinct().SingleOrDefault().IsAutomatic), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_distinct_singleordefault_boolean_empty1(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(g => g.HasSoulPatch) .Select(g => g.Weapons.Where(w => w.Name == "BFG").Distinct().Select(w => w.IsAutomatic).SingleOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_distinct_singleordefault_boolean_empty2(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(g => g.HasSoulPatch) .Select(g => g.Weapons.Where(w => w.Name == "BFG").Select(w => w.IsAutomatic).Distinct().SingleOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_distinct_singleordefault_boolean_empty_with_pushdown(bool async) => AssertQueryScalar( async, @@ -4417,50 +4012,45 @@ public virtual Task Select_subquery_distinct_singleordefault_boolean_empty_with_ ss => ss.Set().Where(g => g.HasSoulPatch).Select(g => (bool?)null), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_subquery_to_base_type_using_typed_ToList(bool async) => AssertQuery( async, - ss => ss.Set().Where(c => c.Name == "Ephyra").Select( - c => c.StationedGears.Select( - g => new Officer - { - CityOfBirthName = g.CityOfBirthName, - FullName = g.FullName, - HasSoulPatch = g.HasSoulPatch, - LeaderNickname = g.LeaderNickname, - LeaderSquadId = g.LeaderSquadId, - Nickname = g.Nickname, - Rank = g.Rank, - SquadId = g.SquadId - }).ToList()), + ss => ss.Set().Where(c => c.Name == "Ephyra").Select(c => c.StationedGears.Select(g + => new Officer + { + CityOfBirthName = g.CityOfBirthName, + FullName = g.FullName, + HasSoulPatch = g.HasSoulPatch, + LeaderNickname = g.LeaderNickname, + LeaderSquadId = g.LeaderSquadId, + Nickname = g.Nickname, + Rank = g.Rank, + SquadId = g.SquadId + }).ToList()), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_ordered_subquery_to_base_type_using_typed_ToArray(bool async) => AssertQuery( async, - ss => ss.Set().Where(c => c.Name == "Ephyra").Select( - c => c.StationedGears.OrderByDescending(g => g.Nickname).Select( - g => new Officer - { - CityOfBirthName = g.CityOfBirthName, - FullName = g.FullName, - HasSoulPatch = g.HasSoulPatch, - LeaderNickname = g.LeaderNickname, - LeaderSquadId = g.LeaderSquadId, - Nickname = g.Nickname, - Rank = g.Rank, - SquadId = g.SquadId - }).ToArray()), + ss => ss.Set().Where(c => c.Name == "Ephyra").Select(c => c.StationedGears.OrderByDescending(g => g.Nickname).Select(g + => new Officer + { + CityOfBirthName = g.CityOfBirthName, + FullName = g.FullName, + HasSoulPatch = g.HasSoulPatch, + LeaderNickname = g.LeaderNickname, + LeaderSquadId = g.LeaderSquadId, + Nickname = g.Nickname, + Rank = g.Rank, + SquadId = g.SquadId + }).ToArray()), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_complex_order_by_funcletized_to_constant_bool(bool async) { var nicknames = new List(); @@ -4477,8 +4067,7 @@ orderby nicknames.Contains(g.Nickname) descending }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Double_order_by_on_nullable_bool_coming_from_optional_navigation(bool async) => AssertQuery( async, @@ -4487,8 +4076,7 @@ public virtual Task Double_order_by_on_nullable_bool_coming_from_optional_naviga .ThenBy(w => w != null ? (int?)w.Id : null), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Double_order_by_on_Like(bool async) => AssertQuery( async, @@ -4497,16 +4085,14 @@ public virtual Task Double_order_by_on_Like(bool async) ss => ss.Set().Select(w => w.SynergyWith).OrderBy(w => w != null ? w.Name.EndsWith("Lancer") : false) .Select(w => w)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Double_order_by_on_is_null(bool async) => AssertQuery( async, ss => ss.Set().Select(w => w.SynergyWith).OrderBy(w => w.Name == null).OrderBy(w => w.Name == null).Select(w => w), ss => ss.Set().Select(w => w.SynergyWith).OrderBy(w => w != null ? w.Name == null : false).Select(w => w)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Double_order_by_on_string_compare(bool async) => AssertQuery( async, @@ -4515,15 +4101,13 @@ public virtual Task Double_order_by_on_string_compare(bool async) ss => ss.Set().OrderBy(w => w != null ? w.Name.CompareTo("Marcus' Lancer") == 0 : false).ThenBy(w => w.Id), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Double_order_by_binary_expression(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(w => w.Id + 2).OrderBy(w => w.Id + 2).Select(w => new { Binary = w.Id + 2 })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_compare_with_null_conditional_argument(bool async) => AssertQuery( async, @@ -4531,8 +4115,7 @@ public virtual Task String_compare_with_null_conditional_argument(bool async) ss => ss.Set().Select(w => w.SynergyWith).OrderBy(w => w != null ? w.Name.CompareTo("Marcus' Lancer") == 0 : false) .Select(c => c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_compare_with_null_conditional_argument2(bool async) => AssertQuery( async, @@ -4540,8 +4123,7 @@ public virtual Task String_compare_with_null_conditional_argument2(bool async) ss => ss.Set().Select(w => w.SynergyWith).OrderBy(w => w != null ? "Marcus' Lancer".CompareTo(w.Name) == 0 : false) .Select(w => w)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_concat_with_null_conditional_argument(bool async) => AssertQuery( async, @@ -4549,8 +4131,7 @@ public virtual Task String_concat_with_null_conditional_argument(bool async) ss => ss.Set().Select(w => w.SynergyWith).OrderBy(w => w != null ? w.Name + 5 : null), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_concat_with_null_conditional_argument2(bool async) => AssertQuery( async, @@ -4558,8 +4139,7 @@ public virtual Task String_concat_with_null_conditional_argument2(bool async) ss => ss.Set().Select(w => w.SynergyWith).OrderBy(w => w != null ? string.Concat(w.Name, "Marcus' Lancer") : null), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_concat_nullable_expressions_are_coalesced(bool async) { object nullableParam = null; @@ -4567,12 +4147,10 @@ public virtual Task String_concat_nullable_expressions_are_coalesced(bool async) return AssertQuery( async, ss => ss.Set().Select(w => w.FullName + null + w.LeaderNickname + nullableParam), - ss => ss.Set().Select( - w => w.FullName + string.Empty + w.LeaderNickname ?? string.Empty + nullableParam ?? string.Empty)); + ss => ss.Set().Select(w => w.FullName + string.Empty + w.LeaderNickname ?? string.Empty + nullableParam ?? string.Empty)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_concat_on_various_types(bool async) => AssertQuery( async, @@ -4589,73 +4167,63 @@ from m in ss.Set() }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Include_Select_Average(bool async) => AssertQueryScalar( async, ss => ss.Set().Include(g => g.CityOfBirth).GroupBy(g => g.Rank).Select(g => g.Average(gg => gg.SquadId))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Include_Select_Sum(bool async) => AssertQueryScalar( async, ss => ss.Set().Include(g => g.CityOfBirth).GroupBy(g => g.Rank).Select(g => g.Sum(gg => gg.SquadId))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Include_Select_Count(bool async) => AssertQueryScalar( async, ss => ss.Set().Include(g => g.CityOfBirth).GroupBy(g => g.Rank).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Include_Select_LongCount(bool async) => AssertQueryScalar( async, ss => ss.Set().Include(g => g.CityOfBirth).GroupBy(g => g.Rank).Select(g => g.LongCount())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Include_Select_Max(bool async) => AssertQueryScalar( async, ss => ss.Set().Include(g => g.CityOfBirth).GroupBy(g => g.Rank).Select(g => g.Max(gg => gg.SquadId))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Include_Select_Min(bool async) => AssertQueryScalar( async, ss => ss.Set().Include(g => g.CityOfBirth).GroupBy(g => g.Rank).Select(g => g.Min(gg => gg.SquadId))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Include_Aggregate_with_anonymous_selector(bool async) => AssertQuery( async, ss => ss.Set().Include(g => g.CityOfBirth).GroupBy(g => g.Nickname).OrderBy(g => g.Key) - .Select( - g => new { g.Key, c = g.Count() }), + .Select(g => new { g.Key, c = g.Count() }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_with_include_with_entity_in_result_selector(bool async) => AssertQuery( async, ss => ss.Set().Include(g => g.CityOfBirth).GroupBy(g => g.Rank).OrderBy(g => g.Key) - .Select( - g => new - { - g.Key, - c = g.Count(), - element = g.OrderBy(gg => gg.Nickname).FirstOrDefault() - }), + .Select(g => new + { + g.Key, + c = g.Count(), + element = g.OrderBy(gg => gg.Nickname).FirstOrDefault() + }), assertOrder: true, elementAsserter: (e, a) => { @@ -4669,8 +4237,7 @@ public virtual Task Group_by_with_include_with_entity_in_result_selector(bool as } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_group_by_and_FirstOrDefault_gets_properly_applied(bool async) => AssertQuery( async, @@ -4680,16 +4247,14 @@ public virtual Task Include_with_group_by_and_FirstOrDefault_gets_properly_appli new ExpectedInclude(e1 => e1.CityOfBirth), new ExpectedInclude(e2 => e2.CityOfBirth))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_Cast_to_base(bool async) => AssertQuery( async, ss => ss.Set().OfType().Include(o => o.Weapons).Cast(), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_client_method_and_member_access_still_applies_includes(bool async) => AssertQuery( async, @@ -4697,8 +4262,7 @@ public virtual Task Include_with_client_method_and_member_access_still_applies_i .Include(g => g.Tag) .Select(g => new { g.Nickname, Client(g).FullName })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_projection_of_unmapped_property_still_gets_applied(bool async) => AssertQueryScalar( async, @@ -4729,8 +4293,7 @@ public virtual Task Multiple_includes_with_client_method_around_entity_and_also_ public static TEntity Client(TEntity entity) => entity; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_same_expression_containing_IsNull_correctly_deduplicates_the_ordering(bool async) => AssertQueryScalar( async, @@ -4738,30 +4301,26 @@ public virtual Task OrderBy_same_expression_containing_IsNull_correctly_deduplic .OrderBy(e => e.HasValue) .ThenBy(e => e.HasValue).Select(e => e)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetValueOrDefault_in_projection(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(w => w.SynergyWithId.GetValueOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetValueOrDefault_in_filter(bool async) => AssertQuery( async, ss => ss.Set().Where(w => w.SynergyWithId.GetValueOrDefault() == 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetValueOrDefault_in_filter_non_nullable_column(bool async) => AssertQuery( async, ss => ss.Set().Where(w => ((int?)w.Id).GetValueOrDefault() == 0), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetValueOrDefault_on_DateTimeOffset(bool async) { var defaultValue = default(DateTimeOffset); @@ -4772,31 +4331,27 @@ public virtual Task GetValueOrDefault_on_DateTimeOffset(bool async) assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetValueOrDefault_in_order_by(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(w => w.SynergyWithId.GetValueOrDefault()).ThenBy(w => w.Id), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetValueOrDefault_with_argument(bool async) => AssertQuery( async, ss => ss.Set().Where(w => w.SynergyWithId.GetValueOrDefault(w.Id) == 1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetValueOrDefault_with_argument_complex(bool async) => AssertQuery( async, ss => ss.Set().Where(w => w.SynergyWithId.GetValueOrDefault(w.Name.Length + 42) > 10), ss => ss.Set().Where(w => (w.SynergyWithId == null ? w.Name.Length + 42 : w.SynergyWithId) > 10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_with_complex_predicate_containing_subquery(bool async) => AssertQuery( async, @@ -4804,8 +4359,7 @@ public virtual Task Filter_with_complex_predicate_containing_subquery(bool async where g.FullName != "Dom" && g.Weapons.OrderBy(w => w.Id).FirstOrDefault(w => w.IsAutomatic) != null select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_with_complex_let_containing_ordering_and_filter_projecting_firstOrDefault_element_of_let(bool async) => AssertQuery( async, @@ -4815,7 +4369,7 @@ let automaticWeapons = g.Weapons .OrderByDescending(w => w.AmmunitionType) .Where(w => w.IsAutomatic) - select new { g.Nickname, WeaponName = Enumerable.FirstOrDefault(automaticWeapons).Name }, + select new { g.Nickname, WeaponName = automaticWeapons.FirstOrDefault().Name }, elementSorter: e => e.Nickname, elementAsserter: (e, a) => { @@ -4823,8 +4377,7 @@ let automaticWeapons Assert.Equal(e.WeaponName, a.WeaponName); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation( bool async) => AssertQuery( @@ -4832,8 +4385,7 @@ public virtual Task Null_semantics_is_correctly_applied_for_function_comparisons ss => ss.Set().Where(t => t.Note.Substring(0, t.Gear.SquadId) == t.GearNickName), ss => ss.Set().Where(t => t.Gear.Maybe(x => t.Note.Substring(0, x.SquadId)) == t.GearNickName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation_complex(bool async) => AssertQuery( @@ -4841,22 +4393,19 @@ public virtual Task ss => ss.Set().Where(t => t.Note.Substring(0, t.Gear.Squad.Name.Length) == t.GearNickName), ss => ss.Set().Where(t => t.Gear.Maybe(x => t.Note.Substring(0, x.Squad.Name.Length)) == t.GearNickName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OfTypeNav1(bool async) => AssertQuery( async, ss => ss.Set().Where(g => g.Tag.Note != "Foo").OfType().Where(o => o.Tag.Note != "Bar")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OfTypeNav2(bool async) => AssertQuery( async, ss => ss.Set().Where(g => g.Tag.Note != "Foo").OfType().Where(o => o.AssignedCity.Location != "Bar")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OfTypeNav3(bool async) => AssertQuery( async, @@ -4873,38 +4422,34 @@ public virtual Task OfTypeNav3(bool async) [ConditionalFact] public virtual Task Nav_rewrite_Distinct_with_convert() // Issue #17328. - => AssertTranslationFailed( - () => - { - using var ctx = CreateContext(); - _ = ctx.Factions.Include(f => ((LocustHorde)f).Commander) - .Where(f => f.Capital.Name != "Foo").Select(f => (LocustHorde)f) - .Distinct().Where(lh => lh.Commander.Name != "Bar").ToList(); - return Task.CompletedTask; - }); + => AssertTranslationFailed(() => + { + using var ctx = CreateContext(); + _ = ctx.Factions.Include(f => ((LocustHorde)f).Commander) + .Where(f => f.Capital.Name != "Foo").Select(f => (LocustHorde)f) + .Distinct().Where(lh => lh.Commander.Name != "Bar").ToList(); + return Task.CompletedTask; + }); [ConditionalFact] public virtual Task Nav_rewrite_Distinct_with_convert_anonymous() // Issue #17328. - => AssertTranslationFailed( - () => - { - using var ctx = CreateContext(); - _ = ctx.Factions.Include(f => ((LocustHorde)f).Commander) - .Where(f => f.Capital.Name != "Foo").Select(f => new { horde = (LocustHorde)f }) - .Distinct().Where(lh => lh.horde.Commander.Name != "Bar").ToList(); - return Task.CompletedTask; - }); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => + { + using var ctx = CreateContext(); + _ = ctx.Factions.Include(f => ((LocustHorde)f).Commander) + .Where(f => f.Capital.Name != "Foo").Select(f => new { horde = (LocustHorde)f }) + .Distinct().Where(lh => lh.horde.Commander.Name != "Bar").ToList(); + return Task.CompletedTask; + }); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nav_rewrite_with_convert1(bool async) => AssertQuery( async, ss => ss.Set().Where(f => f.Capital.Name != "Foo").Select(f => ((LocustHorde)f).Commander)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nav_rewrite_with_convert2(bool async) => AssertQuery( async, @@ -4913,8 +4458,7 @@ public virtual Task Nav_rewrite_with_convert2(bool async) .Select(f => (LocustHorde)f) .Where(lh => lh.Commander.Name != "Bar")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nav_rewrite_with_convert3(bool async) => AssertQuery( async, @@ -4925,22 +4469,19 @@ public virtual Task Nav_rewrite_with_convert3(bool async) elementSorter: e => e.horde.Id, elementAsserter: (e, a) => AssertEqual(e.horde, a.horde)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_contains_on_navigation_with_composite_keys(bool async) => AssertQuery( async, ss => ss.Set().Where(g => ss.Set().Any(c => c.BornGears.Contains(g)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_derivied_entity_with_convert_to_parent(bool async) => AssertQuery( async, ss => ss.Set().OfType().Select(f => (Faction)f)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_complex_order_by(bool async) => AssertQuery( async, @@ -4951,24 +4492,20 @@ public virtual Task Include_with_complex_order_by(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(e => e.Weapons)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_projection_take_followed_by_projecting_single_element_from_collection_navigation(bool async) => AssertQuery( async, ss => ss.Set().Select(g => new { Gear = g }).Take(25) .Select(e => e.Gear.Weapons.OrderBy(w => w.Id).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Bool_projection_from_subquery_treated_appropriately_in_where(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => ss.Set().OrderBy(g => g.Nickname).ThenBy(g => g.SquadId).FirstOrDefault().HasSoulPatch)); + ss => ss.Set().Where(c => ss.Set().OrderBy(g => g.Nickname).ThenBy(g => g.SquadId).FirstOrDefault().HasSoulPatch)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DateTimeOffset_Contains_Less_than_Greater_than(bool async) { var dto = new DateTimeOffset(599898024001234567, new TimeSpan(1, 30, 0)); @@ -4978,12 +4515,10 @@ public virtual Task DateTimeOffset_Contains_Less_than_Greater_than(bool async) return AssertQuery( async, - ss => ss.Set().Where( - m => start <= m.Timeline.Date && m.Timeline < end && dates.Contains(m.Timeline))); + ss => ss.Set().Where(m => start <= m.Timeline.Date && m.Timeline < end && dates.Contains(m.Timeline))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DateTimeOffsetNow_minus_timespan(bool async) { var timeSpan = new TimeSpan(1000); @@ -4994,16 +4529,14 @@ public virtual Task DateTimeOffsetNow_minus_timespan(bool async) assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_inside_interpolated_string_expanded(bool async) => AssertQuery( async, - ss => ss.Set().Select( - w => w.SynergyWithId.HasValue ? $"SynergyWithOwner: {w.SynergyWith.OwnerFullName}" : string.Empty)); + ss => ss.Set() + .Select(w => w.SynergyWithId.HasValue ? $"SynergyWithOwner: {w.SynergyWith.OwnerFullName}" : string.Empty)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_projection_using_coalesce_tracking(bool async) => AssertQuery( async, @@ -5013,8 +4546,7 @@ on g1.LeaderNickname equals g2.Nickname into grouping from g2 in grouping.DefaultIfEmpty() select g2 ?? g1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_projection_using_conditional_tracking(bool async) => AssertQuery( async, @@ -5024,8 +4556,7 @@ on g1.LeaderNickname equals g2.Nickname into grouping from g2 in grouping.DefaultIfEmpty() select g2 == null ? g1 : g2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_nested_with_take_composite_key(bool async) => AssertQuery( async, @@ -5035,8 +4566,7 @@ where t.Gear is Officer elementSorter: e => e?.Count() ?? 0, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_collection_navigation_nested_composite_key(bool async) => AssertQuery( async, @@ -5046,8 +4576,7 @@ where t.Gear is Officer elementSorter: e => e?.Count ?? 0, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_checks_in_correlated_predicate_are_correctly_translated(bool async) => AssertQuery( async, @@ -5071,8 +4600,7 @@ public virtual Task Null_checks_in_correlated_predicate_are_correctly_translated AssertCollection(e.collection, a.collection); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_the_collection_selector(bool async) { var isAutomatic = true; @@ -5089,8 +4617,7 @@ from w in g.Weapons.Where(ww => ww.IsAutomatic == isAutomatic).DefaultIfEmpty() }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_the_collection_selector_not_equal(bool async) { var isAutomatic = true; @@ -5107,8 +4634,7 @@ from w in g.Weapons.Where(ww => ww.IsAutomatic != isAutomatic).DefaultIfEmpty() }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_the_collection_selector_order_comparison(bool async) { var prm = 1; @@ -5125,8 +4651,7 @@ from w in g.Weapons.Where(ww => ww.Id > prm).DefaultIfEmpty() }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_inner_being_a_subquery_projecting_single_property(bool async) => AssertQuery( async, @@ -5137,8 +4662,7 @@ select g2.Nickname ) on g.Nickname equals inner select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_inner_being_a_subquery_projecting_anonymous_type_with_single_property(bool async) => AssertQuery( async, @@ -5149,109 +4673,92 @@ from g2 in ss.Set() ) on g.Nickname equals inner.Nickname select g); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_based_on_complex_expression1(bool async) => AssertQuery( async, ss => ss.Set().Where(f => f is LocustHorde ? (f as LocustHorde).Commander != null : false)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_based_on_complex_expression2(bool async) => AssertQuery( async, ss => ss.Set().Where(f => f is LocustHorde).Where(f => ((LocustHorde)f).Commander != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_based_on_complex_expression3(bool async) => AssertQuery( async, ss => ss.Set().Where(f => f is LocustHorde).Select(f => ((LocustHorde)f).Commander)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Navigation_based_on_complex_expression4(bool async) // Nav expansion. Issue #17782. - => await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => from lc1 in ss.Set().Select(f => (f is LocustHorde) ? ((LocustHorde)f).Commander : null) - from lc2 in ss.Set().OfType() - select (lc1 ?? lc2).DefeatedBy)); + => await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => from lc1 in ss.Set().Select(f => (f is LocustHorde) ? ((LocustHorde)f).Commander : null) + from lc2 in ss.Set().OfType() + select (lc1 ?? lc2).DefeatedBy)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Navigation_based_on_complex_expression5(bool async) // Nav expansion. Issue #17782. - => await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => from lc1 in ss.Set().OfType().Select(lh => lh.Commander) - join lc2 in ss.Set().OfType() on true equals true - select (lc1 ?? lc2).DefeatedBy)); + => await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => from lc1 in ss.Set().OfType().Select(lh => lh.Commander) + join lc2 in ss.Set().OfType() on true equals true + select (lc1 ?? lc2).DefeatedBy)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Navigation_based_on_complex_expression6(bool async) // Nav expansion. Issue #17782. - => await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => from lc1 in ss.Set().OfType().Select(lh => lh.Commander) - join lc2 in ss.Set().OfType() on true equals true - select (lc1.Name == "Queen Myrrah" ? lc1 : lc2).DefeatedBy)); + => await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => from lc1 in ss.Set().OfType().Select(lh => lh.Commander) + join lc2 in ss.Set().OfType() on true equals true + select (lc1.Name == "Queen Myrrah" ? lc1 : lc2).DefeatedBy)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_as_operator(bool async) => AssertQuery( async, ss => ss.Set().Select(ll => ll as LocustCommander)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetimeoffset_comparison_in_projection(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(m => m.Timeline > DateTimeOffset.Now)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OfType_in_subquery_works(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(o => o.Reports.OfType().Select(o1 => o1.AssignedCity))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nullable_bool_comparison_is_translated_to_server(bool async) => AssertQuery( async, ss => ss.Set().Select(lh => new { IsEradicated = lh.Eradicated == true })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Accessing_reference_navigation_collection_composition_generates_single_query(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(g => g.Nickname).Select( - g => new + ss => ss.Set().OrderBy(g => g.Nickname).Select(g => new + { + Weapons = g.Weapons.Select(w => new { - Weapons = g.Weapons.Select( - w => new - { - w.Id, - w.IsAutomatic, - w.SynergyWith.Name - }) - }), + w.Id, + w.IsAutomatic, + w.SynergyWith.Name + }) + }), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.Weapons, a.Weapons, elementSorter: ee => ee.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reference_include_chain_loads_correctly_when_middle_is_null(bool async) => AssertQuery( async, @@ -5260,71 +4767,59 @@ public virtual Task Reference_include_chain_loads_correctly_when_middle_is_null( e, a, new ExpectedInclude(t => t.Gear), new ExpectedInclude(t => t.Squad, "Gear"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Accessing_property_of_optional_navigation_in_child_projection_works(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(e => e.Note).Select( - t => new - { - Items = t.Gear != null - ? t.Gear.Weapons.Select(w => new { w.Owner.Nickname }).ToList() - : null - }), + ss => ss.Set().OrderBy(e => e.Note).Select(t => new + { + Items = t.Gear != null + ? t.Gear.Weapons.Select(w => new { w.Owner.Nickname }).ToList() + : null + }), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.Items, a.Items, elementSorter: ee => ee.Nickname)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_navigation_ofType_filter_works(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.BornGears.OfType().Any(o => o.Nickname == "Marcus"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_after_select_with_cast_throws(bool async) => Assert.Equal( CoreStrings.IncludeOnNonEntity("h => h.Commander"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Where(f => f is LocustHorde).Select(f => (LocustHorde)f).Include(h => h.Commander)))) + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Where(f => f is LocustHorde).Select(f => (LocustHorde)f).Include(h => h.Commander)))) .Message); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_after_select_with_entity_projection_throws(bool async) => Assert.Equal( CoreStrings.IncludeOnNonEntity("c => c.BornGears"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Select(f => f.Capital).Include(c => c.BornGears)))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Select(f => f.Capital).Include(c => c.BornGears)))).Message); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_after_select_anonymous_projection_throws(bool async) => Assert.Equal( CoreStrings.IncludeOnNonEntity("x => x.f.Capital"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Select(f => new { f }).Include(x => x.f.Capital)))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Select(f => new { f }).Include(x => x.f.Capital)))).Message); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_after_Select_throws(bool async) => AssertQuery(async, ss => ss.Set().Select(f => f).Include(h => h.Capital)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_after_SelectMany_throws(bool async) => AssertQuery(async, ss => ss.Set().SelectMany(f => f.Capital.BornGears).Include(g => g.Squad)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_reusing_parameter_doesnt_declare_duplicate_parameter(bool async) { var prm = new ComplexParameter { Inner = new ComplexParameterInner { Nickname = "Marcus" } }; @@ -5339,8 +4834,7 @@ public virtual Task Query_reusing_parameter_doesnt_declare_duplicate_parameter(b assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_reusing_parameter_with_inner_query_doesnt_declare_duplicate_parameter(bool async) { var squadId = 1; @@ -5356,8 +4850,7 @@ public virtual Task Query_reusing_parameter_with_inner_query_doesnt_declare_dupl assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_reusing_parameter_with_inner_query_expression_doesnt_declare_duplicate_parameter(bool async) { var gearId = 1; @@ -5368,8 +4861,7 @@ public virtual Task Query_reusing_parameter_with_inner_query_expression_doesnt_d ss => ss.Set().Where(s => s.Members.AsQueryable().Where(predicate).Where(predicate).Any())); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_reusing_parameter_doesnt_declare_duplicate_parameter_complex(bool async) { var prm = new ComplexParameter { Inner = new ComplexParameterInner { Squad = new Squad { Id = 1 } } }; @@ -5400,8 +4892,7 @@ private class ComplexParameterInner public Squad Squad { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_entity_and_collection_element(bool async) // can't use AssertIncludeQuery here, see #18191 => AssertQuery( @@ -5419,8 +4910,7 @@ public virtual Task Project_entity_and_collection_element(bool async) AssertEqual(e.weapon, a.weapon); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_GroupBy_after_set_operator(bool async) => AssertQuery( async, @@ -5429,17 +4919,15 @@ public virtual Task Complex_GroupBy_after_set_operator(bool async) from g in ss.Set() select new { g.CityOfBirth.Name, Count = g.Weapons.Count() }) .GroupBy(x => new { x.Name, x.Count }) - .Select( - g => new - { - g.Key.Name, - g.Key.Count, - Sum = g.Sum(xx => xx.Count) - }), + .Select(g => new + { + g.Key.Name, + g.Key.Count, + Sum = g.Sum(xx => xx.Count) + }), elementSorter: e => (e.Name, e.Count, e.Sum)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_GroupBy_after_set_operator_using_result_selector(bool async) => AssertQuery( async, @@ -5457,8 +4945,7 @@ from g in ss.Set() }), elementSorter: e => (e.Name, e.Count, e.Sum)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_with_GroupBy_with_composite_group_key(bool async) => AssertQuery( async, @@ -5471,39 +4958,34 @@ into groupby select new { groupby.Key.CityOfBirthName, groupby.Key.HasSoulPatch }, elementSorter: e => (e.CityOfBirthName, e.HasSoulPatch)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_boolean_grouping_key(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - g.Nickname, - g.CityOfBirthName, - g.HasSoulPatch, - IsMarcus = g.Nickname == "Marcus" - }) - .GroupBy( - g => new - { - g.CityOfBirthName, - g.HasSoulPatch, - g.IsMarcus - }) - .Select( - x => new - { - x.Key.CityOfBirthName, - x.Key.HasSoulPatch, - x.Key.IsMarcus, - Count = x.Count() - }), + .Select(g => new + { + g.Nickname, + g.CityOfBirthName, + g.HasSoulPatch, + IsMarcus = g.Nickname == "Marcus" + }) + .GroupBy(g => new + { + g.CityOfBirthName, + g.HasSoulPatch, + g.IsMarcus + }) + .Select(x => new + { + x.Key.CityOfBirthName, + x.Key.HasSoulPatch, + x.Key.IsMarcus, + Count = x.Count() + }), elementSorter: e => (e.CityOfBirthName, e.HasSoulPatch, e.IsMarcus, e.Count)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_boolean_groupin_key_thru_navigation_access(bool async) => AssertQuery( async, @@ -5511,40 +4993,34 @@ public virtual Task GroupBy_with_boolean_groupin_key_thru_navigation_access(bool .GroupBy(t => new { HasSoulPatch = (bool?)t.Gear.HasSoulPatch, t.Gear.Squad.Name }) .Select(g => new { g.Key.HasSoulPatch, Name = g.Key.Name.ToLower() }), ss => ss.Set() - .GroupBy( - t => new { HasSoulPatch = t.Gear.MaybeScalar(x => x.HasSoulPatch), t.Gear.Squad.Name }) + .GroupBy(t => new { HasSoulPatch = t.Gear.MaybeScalar(x => x.HasSoulPatch), t.Gear.Squad.Name }) .Select(g => new { g.Key.HasSoulPatch, Name = g.Key.Name.Maybe(x => x.ToLower()) }), elementSorter: e => (e.HasSoulPatch, e.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_over_projection_with_multiple_properties_accessed_thru_navigation(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - g.Nickname, - AssignedCityName = g.AssignedCity.Name, - CityOfBirthName = g.CityOfBirth.Name, - SquadName = g.Squad.Name - }) + .Select(g => new + { + g.Nickname, + AssignedCityName = g.AssignedCity.Name, + CityOfBirthName = g.CityOfBirth.Name, + SquadName = g.Squad.Name + }) .GroupBy(x => x.CityOfBirthName) .Select(g => g.Key)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_with_aggregate_max_on_entity_type(bool async) - => Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .GroupBy(g => g.CityOfBirthName) - .Select(g => new { g.Key, Aggregate = g.Max() }))); + => Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .GroupBy(g => g.CityOfBirthName) + .Select(g => new { g.Key, Aggregate = g.Max() }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_on_StartsWith_with_null_parameter_as_argument(bool async) { var prm = (string)null; @@ -5555,8 +5031,7 @@ public virtual Task Group_by_on_StartsWith_with_null_parameter_as_argument(bool ss => ss.Set().GroupBy(g => false).Select(g => g.Key)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_with_having_StartsWith_with_null_parameter_as_argument(bool async) { var prm = (string)null; @@ -5568,8 +5043,7 @@ public virtual Task Group_by_with_having_StartsWith_with_null_parameter_as_argum assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_StartsWith_with_null_parameter_as_argument(bool async) { var prm = (string)null; @@ -5580,8 +5054,7 @@ public virtual Task Select_StartsWith_with_null_parameter_as_argument(bool async ss => ss.Set().Select(g => false)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_parameter_is_not_null(bool async) { var prm = (string)null; @@ -5592,8 +5065,7 @@ public virtual Task Select_null_parameter_is_not_null(bool async) ss => ss.Set().Select(g => false)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_null_parameter_is_not_null(bool async) { var prm = (string)null; @@ -5605,8 +5077,7 @@ public virtual Task Where_null_parameter_is_not_null(bool async) assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_StartsWith_with_null_parameter_as_argument(bool async) { var prm = (string)null; @@ -5618,8 +5089,7 @@ public virtual Task OrderBy_StartsWith_with_null_parameter_as_argument(bool asyn assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Contains_empty_list(bool async) { var ids = new List(); @@ -5630,8 +5100,7 @@ public virtual Task OrderBy_Contains_empty_list(bool async) ss => ss.Set().OrderBy(g => ids.Contains(g.SquadId)).Select(g => g)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_with_enum_flags_parameter(bool async) { MilitaryRank? rank = MilitaryRank.Private; @@ -5656,8 +5125,7 @@ await AssertQuery( assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_navigation_access_entity_equality_in_where_predicate_apply_peneding_selector(bool async) => AssertQuery( async, @@ -5669,8 +5137,7 @@ public virtual Task FirstOrDefault_navigation_access_entity_equality_in_where_pr // ss => ss.Set() // .Where(f => f.Capital == ss.Set().OrderBy(s => s.Nickname).FirstOrDefault().CityOfBirth)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Conditional_expression_with_test_being_simplified_to_constant_simple(bool isAsync) { var prm = true; @@ -5678,14 +5145,12 @@ public virtual Task Conditional_expression_with_test_being_simplified_to_constan return AssertQuery( isAsync, - ss => ss.Set().Where( - g => g.HasSoulPatch == prm - ? true - : g.CityOfBirthName == prm2)); + ss => ss.Set().Where(g => g.HasSoulPatch == prm + ? true + : g.CityOfBirthName == prm2)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Conditional_expression_with_test_being_simplified_to_constant_complex(bool isAsync) { var prm = true; @@ -5694,14 +5159,12 @@ public virtual Task Conditional_expression_with_test_being_simplified_to_constan return AssertQuery( isAsync, - ss => ss.Set().Where( - g => g.HasSoulPatch == prm - ? ss.Set().Where(w => w.Id == g.SquadId).Single().Name == prm2 - : g.CityOfBirthName == prm3)); + ss => ss.Set().Where(g => g.HasSoulPatch == prm + ? ss.Set().Where(w => w.Id == g.SquadId).Single().Name == prm2 + : g.CityOfBirthName == prm3)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Bitwise_operation_with_non_null_parameter_optimizes_null_checks(bool async) { var ranks = MilitaryRank.Corporal | MilitaryRank.Sergeant | MilitaryRank.General; @@ -5719,8 +5182,7 @@ await AssertQueryScalar( ss => ss.Set().Select(g => (g.Rank | (g.Rank | (ranks | (g.Rank | ranks)))) == ranks)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Bitwise_operation_with_null_arguments(bool async) { await AssertQuery( @@ -5751,8 +5213,7 @@ await AssertQuery( ss => ss.Set().Where(w => (w.AmmunitionType & prm) == prm)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Logical_operation_with_non_null_parameter_optimizes_null_checks(bool async) { var prm = true; @@ -5766,41 +5227,36 @@ await AssertQuery( ss => ss.Set().Where(g => (g.HasSoulPatch || prm) != prm)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_OfType_works_correctly(bool async) => AssertQuery( async, ss => ss.Set().Cast().OfType().Select(o => o.FullName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_inner_source_custom_projection_followed_by_filter(bool async) => AssertQuery( async, ss => from ll in ss.Set() join h in ss.Set().OfType() - .Select( - f => new - { - IsEradicated = f.Name == "Locust" ? (bool?)true : null, - f.CommanderName, - f.Name - }) + .Select(f => new + { + IsEradicated = f.Name == "Locust" ? (bool?)true : null, + f.CommanderName, + f.Name + }) on ll.Name equals h.CommanderName where h.IsEradicated != true select h); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Byte_array_filter_by_length_literal_does_not_cast_on_varbinary_n(bool async) => AssertQuery( async, ss => ss.Set().Where(w => w.Banner5.Length == 5), ss => ss.Set().Where(w => w.Banner5 != null && w.Banner5.Length == 5)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_bool_coming_from_optional_navigation(bool async) => AssertQuery( async, @@ -5808,8 +5264,7 @@ public virtual Task OrderBy_bool_coming_from_optional_navigation(bool async) ss => ss.Set().Select(w => w.SynergyWith).OrderBy(w => w.MaybeScalar(x => x.IsAutomatic)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DateTimeOffset_Date_returns_datetime(bool async) { var dateTimeOffset = new DateTimeOffset(2, 3, 1, 8, 0, 0, new TimeSpan(-5, 0, 0)); @@ -5819,22 +5274,19 @@ public virtual Task DateTimeOffset_Date_returns_datetime(bool async) ss => ss.Set().Where(m => m.Timeline.Date >= dateTimeOffset.Date)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Conditional_with_conditions_evaluating_to_false_gets_optimized(bool async) => AssertQuery( async, ss => ss.Set().Select(g => g.Nickname == null && g.Nickname != null ? g.CityOfBirthName : g.FullName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Conditional_with_conditions_evaluating_to_true_gets_optimized(bool async) => AssertQuery( async, ss => ss.Set().Select(g => g.Nickname == null || g.Nickname != null ? g.CityOfBirthName : g.FullName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_required_string_column_compared_to_null_parameter(bool async) { var nullParameter = default(string); @@ -5844,8 +5296,7 @@ public virtual Task Projecting_required_string_column_compared_to_null_parameter ss => ss.Set().Select(g => g.Nickname == nullParameter)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_nullable_property_HasValue_and_project_the_grouping_key(bool async) => AssertQueryScalar( async, @@ -5853,8 +5304,7 @@ public virtual Task Group_by_nullable_property_HasValue_and_project_the_grouping .GroupBy(w => w.SynergyWithId.HasValue) .Select(g => g.Key)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_nullable_property_and_project_the_grouping_key_HasValue(bool async) => AssertQueryScalar( async, @@ -5862,8 +5312,7 @@ public virtual Task Group_by_nullable_property_and_project_the_grouping_key_HasV .GroupBy(w => w.SynergyWithId) .Select(g => g.Key.HasValue)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Checked_context_with_cast_does_not_fail(bool isAsync) { checked @@ -5874,8 +5323,7 @@ public virtual Task Checked_context_with_cast_does_not_fail(bool isAsync) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Checked_context_with_addition_does_not_fail(bool isAsync) { checked @@ -5886,16 +5334,14 @@ public virtual Task Checked_context_with_addition_does_not_fail(bool isAsync) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Checked_context_throws_on_client_evaluation(bool isAsync) { checked { - return Assert.ThrowsAsync( - () => AssertQueryScalar( - isAsync, - ss => ss.Set().Select(w => w.ThreatLevel >= (byte)GetThreatLevel())) + return Assert.ThrowsAsync(() => AssertQueryScalar( + isAsync, + ss => ss.Set().Select(w => w.ThreatLevel >= (byte)GetThreatLevel())) ); } } @@ -5903,31 +5349,27 @@ public virtual Task Checked_context_throws_on_client_evaluation(bool isAsync) private int GetThreatLevel() => 256; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_on_collection_of_byte_subquery(bool async) => AssertQuery( async, ss => ss.Set() .Where(l => ss.Set().Select(ll => ll.ThreatLevelByte).Contains(l.ThreatLevelByte))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_on_collection_of_nullable_byte_subquery(bool async) => AssertQuery( async, - ss => ss.Set().Where( - l => ss.Set().Select(ll => ll.ThreatLevelNullableByte).Contains(l.ThreatLevelNullableByte))); + ss => ss.Set().Where(l + => ss.Set().Select(ll => ll.ThreatLevelNullableByte).Contains(l.ThreatLevelNullableByte))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_on_collection_of_nullable_byte_subquery_null_constant(bool async) => AssertQuery( async, ss => ss.Set().Where(l => ss.Set().Select(ll => ll.ThreatLevelNullableByte).Contains(null))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_on_collection_of_nullable_byte_subquery_null_parameter(bool async) { var prm = default(byte?); @@ -5937,53 +5379,42 @@ public virtual Task Contains_on_collection_of_nullable_byte_subquery_null_parame ss => ss.Set().Where(l => ss.Set().Select(ll => ll.ThreatLevelNullableByte).Contains(prm))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion(bool async) => AssertQuery( async, ss => ss.Set() - .SelectMany( - l => ss.Set() - .Where(g => ss.Set().Select(x => x.ThreatLevelByte).Contains(l.ThreatLevelByte)))); + .SelectMany(l => ss.Set() + .Where(g => ss.Set().Select(x => x.ThreatLevelByte).Contains(l.ThreatLevelByte)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion_negated( bool async) => AssertQuery( async, ss => ss.Set() - .SelectMany( - l => ss.Set() - .Where(g => !ss.Set().Select(x => x.ThreatLevelByte).Contains(l.ThreatLevelByte))), + .SelectMany(l => ss.Set() + .Where(g => !ss.Set().Select(x => x.ThreatLevelByte).Contains(l.ThreatLevelByte))), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion(bool async) => AssertQuery( async, ss => ss.Set() - .SelectMany( - l => ss.Set() - .Where( - g => ss.Set().Select(x => x.ThreatLevelNullableByte).Contains(l.ThreatLevelNullableByte)))); + .SelectMany(l => ss.Set() + .Where(g => ss.Set().Select(x => x.ThreatLevelNullableByte).Contains(l.ThreatLevelNullableByte)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion_negated(bool async) => AssertQuery( async, ss => ss.Set() - .SelectMany( - l => ss.Set() - .Where( - g => !ss.Set().Select(x => x.ThreatLevelNullableByte).Contains(l.ThreatLevelNullableByte))), + .SelectMany(l => ss.Set() + .Where(g => !ss.Set().Select(x => x.ThreatLevelNullableByte).Contains(l.ThreatLevelNullableByte))), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Enum_closure_typed_as_underlying_type_generates_correct_parameter_type(bool async) { var prm = (int)AmmunitionType.Cartridge; @@ -5994,8 +5425,7 @@ public virtual Task Enum_closure_typed_as_underlying_type_generates_correct_para ss => ss.Set().Where(w => w.AmmunitionType != null && prm == (int)w.AmmunitionType)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Enum_flags_closure_typed_as_underlying_type_generates_correct_parameter_type(bool async) { var prm = (int)MilitaryRank.Private + (int)MilitaryRank.Sergeant + (int)MilitaryRank.General; @@ -6006,8 +5436,7 @@ public virtual Task Enum_flags_closure_typed_as_underlying_type_generates_correc .Where(g => (prm & (int)g.Rank) == (int)g.Rank)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Enum_flags_closure_typed_as_different_type_generates_correct_parameter_type(bool async) { var prm = (byte)MilitaryRank.Private + (byte)MilitaryRank.Sergeant; @@ -6018,8 +5447,7 @@ public virtual Task Enum_flags_closure_typed_as_different_type_generates_correct .Where(g => (prm & (short)g.Rank) == (short)g.Rank)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Constant_enum_with_same_underlying_value_as_previously_parameterized_int(bool async) => AssertQueryScalar( async, @@ -6028,8 +5456,7 @@ public virtual Task Constant_enum_with_same_underlying_value_as_previously_param .Take(1) .Select(g => g.Rank & MilitaryRank.Private)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Enum_array_contains(bool async) { var types = new[] { (AmmunitionType?)null, AmmunitionType.Cartridge }; @@ -6040,8 +5467,7 @@ public virtual Task Enum_array_contains(bool async) .Where(w => w.SynergyWith != null && types.Contains(w.SynergyWith.AmmunitionType))); } - [ConditionalTheory] // #35656 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #35656 public virtual Task Coalesce_with_non_root_evaluatable_Convert(bool async) { MilitaryRank? rank = MilitaryRank.Private; @@ -6057,8 +5483,7 @@ public virtual Task Coalesce_with_non_root_evaluatable_Convert(bool async) ss => ss.Set().Where(g => (rank ?? g.Rank) == g.Rank)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Client_eval_followed_by_aggregate_operation(bool async) { await AssertSum( @@ -6078,8 +5503,7 @@ await AssertMax( ss => ss.Set().Select(m => m.Duration.Ticks)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Trying_to_access_unmapped_property_throws_informative_error(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -6087,15 +5511,13 @@ public virtual Task Trying_to_access_unmapped_property_throws_informative_error( ss => ss.Set().Where(g => g.IsMarcus)), CoreStrings.QueryUnableToTranslateMember(nameof(Gear.IsMarcus), nameof(Gear))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Trying_to_access_unmapped_property_in_projection(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(g => g.IsMarcus)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Trying_to_access_unmapped_property_inside_aggregate(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -6103,18 +5525,16 @@ public virtual Task Trying_to_access_unmapped_property_inside_aggregate(bool asy ss => ss.Set().Where(c => c.BornGears.Count(g => g.IsMarcus) > 0)), CoreStrings.QueryUnableToTranslateMember(nameof(Gear.IsMarcus), nameof(Gear))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Trying_to_access_unmapped_property_inside_subquery(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( async, - ss => ss.Set().Where( - c => ss.Set().Where(g => g.IsMarcus).Select(g => g.Nickname).FirstOrDefault() == "Marcus")), + ss => ss.Set().Where(c + => ss.Set().Where(g => g.IsMarcus).Select(g => g.Nickname).FirstOrDefault() == "Marcus")), CoreStrings.QueryUnableToTranslateMember(nameof(Gear.IsMarcus), nameof(Gear))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Trying_to_access_unmapped_property_inside_join_key_selector(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -6125,8 +5545,7 @@ from g in grouping.DefaultIfEmpty() select new { w, g }), CoreStrings.QueryUnableToTranslateMember(nameof(Gear.IsMarcus), nameof(Gear))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_projection_with_nested_unmapped_property_bubbles_up_translation_failure_info(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -6134,46 +5553,40 @@ public virtual Task Client_projection_with_nested_unmapped_property_bubbles_up_t ss => ss.Set().Select(g => new { nested = ss.Set().Where(gg => gg.IsMarcus).ToList() })), CoreStrings.QueryUnableToTranslateMember(nameof(Gear.IsMarcus), nameof(Gear))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_member_and_unsupported_string_Equals_in_the_same_query(bool async) => AssertQuery( async, ss => ss.Set().Where(g => g.FullName.Equals(g.Nickname, StringComparison.InvariantCulture) || g.IsMarcus)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task CompareTo_used_with_non_unicode_string_column_and_constant(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Location.CompareTo("Unknown") == 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Coalesce_used_with_non_unicode_string_column_and_constant(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.Location ?? "Unknown")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Groupby_anonymous_type_with_navigations_followed_up_by_anonymous_projection_and_orderby(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(w => new { w.Owner.CityOfBirth.Name, w.Owner.CityOfBirth.Location }) - .Select( - x => new - { - x.Key.Name, - x.Key.Location, - Count = x.Count() - }) + .Select(x => new + { + x.Key.Name, + x.Key.Location, + Count = x.Count() + }) .OrderBy(x => x.Location), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_predicate_with_non_equality_comparison_converted_to_inner_join(bool async) => AssertQuery( async, @@ -6188,8 +5601,7 @@ from w in ss.Set().Where(x => x.OwnerFullName != g.FullName) AssertEqual(e.w, a.w); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_predicate_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join(bool async) => AssertQuery( async, @@ -6204,8 +5616,7 @@ from w in ss.Set().Where(x => x.OwnerFullName != g.FullName).DefaultIfEm AssertEqual(e.w, a.w); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_predicate_after_navigation_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join( bool async) => AssertQuery( @@ -6225,15 +5636,13 @@ from w in ss.Set().Select(x => x.SynergyWith).Where(x => x.OwnerFullName AssertEqual(e.w, a.w); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_without_result_selector_and_non_equality_comparison_converted_to_join(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(g => ss.Set().Where(x => x.OwnerFullName != g.FullName).DefaultIfEmpty())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join(bool async) => AssertQuery( async, @@ -6241,8 +5650,7 @@ public virtual Task Filtered_collection_projection_with_order_comparison_predica assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => ee.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join2(bool async) => AssertQuery( async, @@ -6250,8 +5658,7 @@ public virtual Task Filtered_collection_projection_with_order_comparison_predica assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => ee.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join3(bool async) => AssertQuery( async, @@ -6259,8 +5666,7 @@ public virtual Task Filtered_collection_projection_with_order_comparison_predica assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => ee.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_predicate_with_non_equality_comparison_with_Take_doesnt_convert_to_join(bool async) => AssertQuery( async, @@ -6275,24 +5681,21 @@ from w in ss.Set().Where(x => x.OwnerFullName != g.FullName).OrderBy(x = AssertEqual(e.w, a.w); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_over_int_compared_to_zero(bool async) => AssertQuery( async, ss => ss.Set().Where(s => s.Name == "Delta") - .Where( - s => s.Members - .Where(m => m.HasSoulPatch) - .OrderBy(m => m.FullName) - .Select(m => m.SquadId) - .FirstOrDefault() - != 0) + .Where(s => s.Members + .Where(m => m.HasSoulPatch) + .OrderBy(m => m.FullName) + .Select(m => m.SquadId) + .FirstOrDefault() + != 0) .Select(s => s.Name), elementSorter: e => e); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_inner_collection_references_element_two_levels_up(bool async) => AssertQuery( async, @@ -6310,8 +5713,7 @@ public virtual Task Correlated_collection_with_inner_collection_references_eleme AssertCollection(e.Collection, a.Collection, elementSorter: ee => (ee.OfficerName, ee.ReportName)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Accessing_derived_property_using_hard_and_soft_cast(bool async) { await AssertQuery( @@ -6323,16 +5725,14 @@ await AssertQuery( ss => ss.Set().Where(ll => ll is LocustCommander && (ll as LocustCommander).HighCommandId != 0)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_to_derived_followed_by_include_and_FirstOrDefault(bool async) => AssertFirstOrDefault( async, ss => ss.Set().Where(ll => ll.Name.Contains("Queen")).Cast().Include(lc => lc.DefeatedBy), asserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.DefeatedBy))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_to_derived_followed_by_multiple_includes(bool async) => AssertQuery( async, @@ -6343,18 +5743,16 @@ public virtual Task Cast_to_derived_followed_by_multiple_includes(bool async) new ExpectedInclude(x => x.DefeatedBy), new ExpectedInclude(x => x.Weapons, "DefeatedBy"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_take(bool async) => AssertQuery( async, - ss => ss.Set().Select( - g => new - { - g.Nickname, - Weapons = g.Weapons.Take(10).ToList(), - g.CityOfBirth - }), + ss => ss.Set().Select(g => new + { + g.Nickname, + Weapons = g.Weapons.Take(10).ToList(), + g.CityOfBirth + }), elementSorter: e => e.Nickname, elementAsserter: (e, a) => { @@ -6363,22 +5761,19 @@ public virtual Task Correlated_collection_take(bool async) AssertEqual(e.CityOfBirth, a.CityOfBirth); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Select_sum(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(m => m.CodeName).Select(g => g.Sum(m => m.Rating))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_no_data_nullable_double(bool async) => AssertSum( async, ss => ss.Set().Where(m => m.CodeName == "Operation Foobar").Select(m => m.Rating)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_on_empty_collection_of_DateTime_in_subquery(bool async) => AssertQuery( async, @@ -6390,8 +5785,7 @@ orderby t.Id where g.Tag.IssueDate > invalidTagIssueDate select new { g.Nickname, invalidTagIssueDate }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_shadow_properties(bool async) => AssertQuery( async, @@ -6399,8 +5793,7 @@ public virtual Task Project_shadow_properties(bool async) select new { g.Nickname, AssignedCityName = EF.Property(g, "AssignedCityName") }, elementSorter: e => e.Nickname); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Composite_key_entity_equal(bool async) => AssertQuery( async, @@ -6415,8 +5808,7 @@ from g2 in ss.Set() AssertEqual(e.g2, a.g2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Composite_key_entity_not_equal(bool async) => AssertQuery( async, @@ -6431,27 +5823,69 @@ from g2 in ss.Set() AssertEqual(e.g2, a.g2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Composite_key_entity_equal_null(bool async) => AssertQuery( async, ss => ss.Set().OfType().Where(lc => lc.DefeatedBy == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Composite_key_entity_not_equal_null(bool async) => AssertQuery( async, ss => ss.Set().OfType().Where(lc => lc.DefeatedBy != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_property_converted_to_nullable_with_comparison(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new + ss => ss.Set().Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new + { + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch + } + : null + }).Where(x => x.Nullable.SquadId == 1)); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] + public virtual Task Projecting_property_converted_to_nullable_with_addition(bool async) + => AssertQuery( + async, + ss => ss.Set().Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new + { + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch + } + : null + }).Where(x => x.Nullable.SquadId + 1 == 2), + ss => ss.Set().Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new + { + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch + } + : null + }).Where(x => x.Nullable != null && x.Nullable.SquadId + 1 == 2)); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] + public virtual Task Projecting_property_converted_to_nullable_with_addition_and_final_projection(bool async) + => AssertQuery( + async, + ss => ss.Set().Select(x => new { x.Note, Nullable = x.GearNickName != null @@ -6462,15 +5896,50 @@ public virtual Task Projecting_property_converted_to_nullable_with_comparison(bo x.Gear.HasSoulPatch } : null - }).Where(x => x.Nullable.SquadId == 1)); + }) + .Where(x => x.Nullable.Nickname != null) + .Select(x => new { x.Note, Value = x.Nullable.SquadId + 1 })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Projecting_property_converted_to_nullable_with_addition(bool async) + [ConditionalTheory, MemberData(nameof(IsAsyncData))] + public virtual Task Projecting_property_converted_to_nullable_with_conditional(bool async) + => AssertQueryScalar( + async, + ss => ss.Set().Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new + { + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch + } + : null + }).Select(x => x.Note != "K.I.A." ? x.Nullable.SquadId : -1)); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] + public virtual Task Projecting_property_converted_to_nullable_with_function_call(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new + ss => ss.Set().Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new + { + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch + } + : null + }).Select(x => x.Nullable.Nickname.Substring(0, 3)), + ss => ss.Set().Select(x => x.GearNickName == null ? null : x.GearNickName.Substring(0, 3))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] + public virtual Task Projecting_property_converted_to_nullable_with_function_call2(bool async) + => AssertQuery( + async, + ss => ss.Set().Select(x => new { x.Note, Nullable = x.GearNickName != null @@ -6481,9 +5950,10 @@ public virtual Task Projecting_property_converted_to_nullable_with_addition(bool x.Gear.HasSoulPatch } : null - }).Where(x => x.Nullable.SquadId + 1 == 2), - ss => ss.Set().Select( - x => new + }) + .Where(x => x.Nullable.Nickname != null) + .Select(x => new { x.Note, Function = x.Note.Substring(0, x.Nullable.SquadId) }), + ss => ss.Set().Select(x => new { x.Note, Nullable = x.GearNickName != null @@ -6494,36 +5964,15 @@ public virtual Task Projecting_property_converted_to_nullable_with_addition(bool x.Gear.HasSoulPatch } : null - }).Where(x => x.Nullable != null && x.Nullable.SquadId + 1 == 2)); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Projecting_property_converted_to_nullable_with_addition_and_final_projection(bool async) - => AssertQuery( - async, - ss => ss.Set().Select( - x => new - { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null - }) + }) .Where(x => x.Nullable.Nickname != null) - .Select(x => new { x.Note, Value = x.Nullable.SquadId + 1 })); + .Select(x => new { x.Note, Function = x.Nullable == null ? null : x.Note.Substring(0, x.Nullable.SquadId) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Projecting_property_converted_to_nullable_with_conditional(bool async) - => AssertQueryScalar( + [ConditionalTheory, MemberData(nameof(IsAsyncData))] + public virtual Task Projecting_property_converted_to_nullable_into_element_init(bool async) + => AssertQuery( async, - ss => ss.Set().Select( - x => new + ss => ss.Set().Select(x => new { x.Note, Nullable = x.GearNickName != null @@ -6534,15 +5983,23 @@ public virtual Task Projecting_property_converted_to_nullable_with_conditional(b x.Gear.HasSoulPatch } : null - }).Select(x => x.Note != "K.I.A." ? x.Nullable.SquadId : -1)); + }) + .Where(x => x.Nullable.Nickname != null) + .OrderBy(x => x.Note) + .Select(x => new List + { + x.Nullable.Nickname.Length, + x.Nullable.SquadId, + x.Nullable.SquadId + 1, + 42 + }), + assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Projecting_property_converted_to_nullable_with_function_call(bool async) + [ConditionalTheory, MemberData(nameof(IsAsyncData))] + public virtual Task Projecting_property_converted_to_nullable_into_member_assignment(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new + ss => ss.Set().Select(x => new { x.Note, Nullable = x.GearNickName != null @@ -6553,199 +6010,103 @@ public virtual Task Projecting_property_converted_to_nullable_with_function_call x.Gear.HasSoulPatch } : null - }).Select(x => x.Nullable.Nickname.Substring(0, 3)), - ss => ss.Set().Select(x => x.GearNickName == null ? null : x.GearNickName.Substring(0, 3))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Projecting_property_converted_to_nullable_with_function_call2(bool async) - => AssertQuery( - async, - ss => ss.Set().Select( - x => new - { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null - }) - .Where(x => x.Nullable.Nickname != null) - .Select(x => new { x.Note, Function = x.Note.Substring(0, x.Nullable.SquadId) }), - ss => ss.Set().Select( - x => new - { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null - }) - .Where(x => x.Nullable.Nickname != null) - .Select(x => new { x.Note, Function = x.Nullable == null ? null : x.Note.Substring(0, x.Nullable.SquadId) })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Projecting_property_converted_to_nullable_into_element_init(bool async) - => AssertQuery( - async, - ss => ss.Set().Select( - x => new - { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null - }) - .Where(x => x.Nullable.Nickname != null) - .OrderBy(x => x.Note) - .Select( - x => new List - { - x.Nullable.Nickname.Length, - x.Nullable.SquadId, - x.Nullable.SquadId + 1, - 42 - }), - assertOrder: true); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Projecting_property_converted_to_nullable_into_member_assignment(bool async) - => AssertQuery( - async, - ss => ss.Set().Select( - x => new - { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null - }) + }) .Where(x => x.Nullable.Nickname != null) .OrderBy(x => x.Note) .Select(x => new Squad { Id = x.Nullable.SquadId }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_property_converted_to_nullable_into_new_array(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null - }) + ss => ss.Set().Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new + { + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch + } + : null + }) .Where(x => x.Nullable.Nickname != null) .OrderBy(x => x.Note) .Select(x => new[] { x.Nullable.Nickname.Length, x.Nullable.SquadId, x.Nullable.SquadId + 1, 42 }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_property_converted_to_nullable_into_unary(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null - }) + ss => ss.Set().Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new + { + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch + } + : null + }) .Where(x => x.Nullable.Nickname != null) .OrderBy(x => x.Note) .Where(x => !x.Nullable.HasSoulPatch) .Select(x => x.Note), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_property_converted_to_nullable_into_member_access(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Nickname, - x.CityOfBirthName, - Nullable = x.CityOfBirthName != null ? new { x.Tag.IssueDate } : null - }) + ss => ss.Set().Select(x => new + { + x.Nickname, + x.CityOfBirthName, + Nullable = x.CityOfBirthName != null ? new { x.Tag.IssueDate } : null + }) .Where(x => x.CityOfBirthName != null) .OrderBy(x => x.Nickname) .Where(x => x.Nullable.IssueDate.Month != 5) .Select(x => x.Nickname), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_property_converted_to_nullable_and_use_it_in_order_by(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null - }) + ss => ss.Set().Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new + { + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch + } + : null + }) .Where(x => x.Nullable.Nickname != null) .OrderBy(x => x.Nullable.SquadId).ThenBy(x => x.Note), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_distinct_projecting_identifier_column(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - Key = g.Nickname, - Subquery = g.Weapons - .Select(w => new { w.Id, w.Name }) - .Distinct().ToList() - }), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons + .Select(w => new { w.Id, w.Name }) + .Distinct().ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -6761,26 +6122,23 @@ public virtual Task Correlated_collection_with_distinct_projecting_identifier_co }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_distinct_projecting_identifier_column_and_correlation_key(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - Key = g.Nickname, - Subquery = g.Weapons - .Select( - w => new - { - w.Id, - w.Name, - w.OwnerFullName - }) - .Distinct().ToList() - }), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons + .Select(w => new + { + w.Id, + w.Name, + w.OwnerFullName + }) + .Distinct().ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -6797,26 +6155,23 @@ public virtual Task Correlated_collection_with_distinct_projecting_identifier_co }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_distinct_projecting_identifier_column_composite_key(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - s => new - { - Key = s.Id, - Subquery = s.Members - .Select( - m => new - { - m.Nickname, - m.SquadId, - m.HasSoulPatch - }) - .Distinct().ToList() - }), + .Select(s => new + { + Key = s.Id, + Subquery = s.Members + .Select(m => new + { + m.Nickname, + m.SquadId, + m.HasSoulPatch + }) + .Distinct().ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -6833,20 +6188,18 @@ public virtual Task Correlated_collection_with_distinct_projecting_identifier_co }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_distinct_not_projecting_identifier_column(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - Key = g.Nickname, - Subquery = g.Weapons - .Select(w => new { w.Name, w.IsAutomatic }) - .Distinct().ToList() - }), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons + .Select(w => new { w.Name, w.IsAutomatic }) + .Distinct().ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -6862,27 +6215,24 @@ public virtual Task Correlated_collection_with_distinct_not_projecting_identifie }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_distinct_not_projecting_identifier_column_also_projecting_complex_expressions( bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - Key = g.Nickname, - Subquery = g.Weapons - .Select( - w => new - { - w.Name, - w.IsAutomatic, - w.OwnerFullName.Length - }) - .Distinct().ToList() - }), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons + .Select(w => new + { + w.Name, + w.IsAutomatic, + w.OwnerFullName.Length + }) + .Distinct().ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -6899,22 +6249,20 @@ public virtual Task Correlated_collection_with_distinct_not_projecting_identifie }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_groupby_not_projecting_identifier_column_but_only_grouping_key_in_final_projection( bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - Key = g.Nickname, - Subquery = g.Weapons - .Select(w => new { w.Name, w.IsAutomatic }) - .GroupBy(x => x.IsAutomatic) - .Select(x => new { x.Key }).ToList() - }), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons + .Select(w => new { w.Name, w.IsAutomatic }) + .GroupBy(x => x.IsAutomatic) + .Select(x => new { x.Key }).ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -6929,22 +6277,20 @@ public virtual Task Correlated_collection_with_groupby_not_projecting_identifier }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_groupby_not_projecting_identifier_column_with_group_aggregate_in_final_projection( bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - Key = g.Nickname, - Subquery = g.Weapons - .Select(w => new { w.Name, w.IsAutomatic }) - .GroupBy(x => x.IsAutomatic) - .Select(x => new { x.Key, Count = x.Count() }).ToList() - }), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons + .Select(w => new { w.Name, w.IsAutomatic }) + .GroupBy(x => x.IsAutomatic) + .Select(x => new { x.Key, Count = x.Count() }).ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -6960,23 +6306,21 @@ public virtual Task Correlated_collection_with_groupby_not_projecting_identifier }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_groupby_not_projecting_identifier_column_with_group_aggregate_in_final_projection_multiple_grouping_keys( bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - Key = g.Nickname, - Subquery = g.Weapons - .Select(w => new { w.Name, w.IsAutomatic }) - .GroupBy(x => new { x.IsAutomatic, x.Name }) - .Select(x => new { x.Key, Count = x.Count() }).ToList() - }), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons + .Select(w => new { w.Name, w.IsAutomatic }) + .GroupBy(x => new { x.IsAutomatic, x.Name }) + .Select(x => new { x.Key, Count = x.Count() }).ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -6993,23 +6337,21 @@ public virtual Task }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_groupby_with_complex_grouping_key_not_projecting_identifier_column_with_group_aggregate_in_final_projection( bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - Key = g.Nickname, - Subquery = g.Weapons - .Select(w => new { w.Name, w.IsAutomatic }) - .GroupBy(x => x.Name.Length) - .Select(x => new { x.Key, Count = x.Count() }).ToList() - }), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons + .Select(w => new { w.Name, w.IsAutomatic }) + .GroupBy(x => x.Name.Length) + .Select(x => new { x.Key, Count = x.Count() }).ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -7025,26 +6367,22 @@ public virtual Task }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_via_SelectMany_with_Distinct_missing_indentifying_columns_in_projection(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(g => g.Nickname) - .Select( - g => g.Weapons.SelectMany(x => x.Owner.AssignedCity.BornGears) - .Select(x => (bool?)x.HasSoulPatch).Distinct().ToList()), + .Select(g => g.Weapons.SelectMany(x => x.Owner.AssignedCity.BornGears) + .Select(x => (bool?)x.HasSoulPatch).Distinct().ToList()), ss => ss.Set() .OrderBy(g => g.Nickname) - .Select( - g => g.Weapons.SelectMany(x => x.Owner.AssignedCity.Maybe(x => x.BornGears) ?? new List()) - .Select(x => (bool?)x.HasSoulPatch).Distinct().ToList()), + .Select(g => g.Weapons.SelectMany(x => x.Owner.AssignedCity.Maybe(x => x.BornGears) ?? new List()) + .Select(x => (bool?)x.HasSoulPatch).Distinct().ToList()), elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => ee), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_correlated_collection_followed_by_Distinct(bool async) => AssertQuery( async, @@ -7054,19 +6392,17 @@ public virtual Task Projecting_correlated_collection_followed_by_Distinct(bool a elementSorter: e => e.OrderBy(w => w.Id).FirstOrDefault().Id, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_some_properties_as_well_as_correlated_collection_followed_by_Distinct(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - g => new - { - g.FullName, - g.HasSoulPatch, - g.Weapons - }) + .Select(g => new + { + g.FullName, + g.HasSoulPatch, + g.Weapons + }) .Distinct(), elementSorter: e => e.FullName, elementAsserter: (e, a) => @@ -7076,8 +6412,7 @@ public virtual Task Projecting_some_properties_as_well_as_correlated_collection_ AssertCollection(e.Weapons, a.Weapons); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_entity_as_well_as_correlated_collection_followed_by_Distinct(bool async) => AssertQuery( async, @@ -7091,8 +6426,7 @@ public virtual Task Projecting_entity_as_well_as_correlated_collection_followed_ AssertCollection(e.Weapons, a.Weapons); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_entity_as_well_as_complex_correlated_collection_followed_by_Distinct(bool async) => AssertQuery( async, @@ -7106,8 +6440,7 @@ public virtual Task Projecting_entity_as_well_as_complex_correlated_collection_f AssertCollection(e.Weapons, a.Weapons); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_entity_as_well_as_correlated_collection_of_scalars_followed_by_Distinct(bool async) => AssertQuery( async, @@ -7121,62 +6454,57 @@ public virtual Task Projecting_entity_as_well_as_correlated_collection_of_scalar AssertCollection(e.Ids, a.Ids); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_distinct_3_levels(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - s => new - { - s, - Members = s.Members.Select( - m => new { m, Weapons = m.Weapons.Where(w => w.OwnerFullName == m.FullName).ToList() }).Distinct() - }).Distinct(), + .Select(s => new + { + s, + Members = s.Members.Select(m => new { m, Weapons = m.Weapons.Where(w => w.OwnerFullName == m.FullName).ToList() }) + .Distinct() + }).Distinct(), elementSorter: e => e.s.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_after_distinct_3_levels(bool async) => AssertQuery( async, ss => ss.Set() .Select(s => new { s.Id, s.Name }) .Distinct() - .Select( - x => new - { - x.Id, - x.Name, - Subquery1 = (from g in ss.Set() - where g.SquadId == x.Id - select new - { - g.Nickname, - g.FullName, - g.HasSoulPatch - }) - .Distinct() - .Select( - xx => new - { - xx.Nickname, - xx.FullName, - xx.HasSoulPatch, - Subquery2 = (from w in ss.Set() - where w.OwnerFullName == xx.FullName - select new - { - x.Id, - x.Name, - xx.Nickname, - xx.FullName, - xx.HasSoulPatch - }).ToList() - }) - .ToList() - }), + .Select(x => new + { + x.Id, + x.Name, + Subquery1 = (from g in ss.Set() + where g.SquadId == x.Id + select new + { + g.Nickname, + g.FullName, + g.HasSoulPatch + }) + .Distinct() + .Select(xx => new + { + xx.Nickname, + xx.FullName, + xx.HasSoulPatch, + Subquery2 = (from w in ss.Set() + where w.OwnerFullName == xx.FullName + select new + { + x.Id, + x.Name, + xx.Nickname, + xx.FullName, + xx.HasSoulPatch + }).ToList() + }) + .ToList() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -7206,37 +6534,34 @@ public virtual Task Correlated_collection_after_distinct_3_levels(bool async) }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_after_distinct_3_levels_without_original_identifiers(bool async) => AssertQuery( async, ss => ss.Set() .Select(s => new { s.Name.Length }) .Distinct() - .Select( - x => new - { - x.Length, - Subquery1 = (from g in ss.Set() - where g.Nickname.Length == x.Length - select new { g.HasSoulPatch, g.CityOfBirthName }) - .Distinct() - .Select( - xx => new - { - xx.HasSoulPatch, - Subquery2 = (from w in ss.Set() - where w.OwnerFullName == xx.CityOfBirthName - select new - { - w.Id, - x.Length, - xx.HasSoulPatch - }).ToList() - }) - .ToList() - }), + .Select(x => new + { + x.Length, + Subquery1 = (from g in ss.Set() + where g.Nickname.Length == x.Length + select new { g.HasSoulPatch, g.CityOfBirthName }) + .Distinct() + .Select(xx => new + { + xx.HasSoulPatch, + Subquery2 = (from w in ss.Set() + where w.OwnerFullName == xx.CityOfBirthName + select new + { + w.Id, + x.Length, + xx.HasSoulPatch + }).ToList() + }) + .ToList() + }), elementSorter: e => e.Length, elementAsserter: (e, a) => { @@ -7261,15 +6586,13 @@ public virtual Task Correlated_collection_after_distinct_3_levels_without_origin }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_query_gears(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_entity_that_is_not_present_in_final_projection_but_uses_TypeIs_instead(bool async) => AssertQuery( async, @@ -7284,80 +6607,74 @@ public virtual Task Include_on_entity_that_is_not_present_in_final_projection_bu AssertEqual(e.IsOfficer, a.IsOfficer); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparison_with_value_converted_subclass(bool async) => AssertQuery( async, ss => ss.Set().Where(f => f.ServerAddress == IPAddress.Loopback)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_equality_with_value_converted_property(bool async) => AssertQuery( async, ss => ss.Set().Select(m => m.Difficulty == MissionDifficulty.Unknown)); - private static readonly IEnumerable _weaponTypes = new AmmunitionType?[] { AmmunitionType.Cartridge }; + private static readonly IEnumerable _weaponTypes = [AmmunitionType.Cartridge]; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_on_readonly_enumerable(bool async) => AssertQuery( async, ss => ss.Set().Where(w => _weaponTypes.Contains(w.AmmunitionType))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_navigation_defined_on_base_from_entity_with_inheritance_using_soft_cast(bool async) => AssertQuery( async, - ss => ss.Set().Select( - g => new + ss => ss.Set().Select(g => new + { + Gear = g, + (g as Officer).Tag, + IsNull = (g as Officer).Tag == null, + Property = (g as Officer).Nickname, + PropertyAfterNavigation = (g as Officer).Tag.Id, + NestedOuter = new { - Gear = g, - (g as Officer).Tag, - IsNull = (g as Officer).Tag == null, + (g as Officer).CityOfBirth, + IsNull = (g as Officer).CityOfBirth == null, Property = (g as Officer).Nickname, - PropertyAfterNavigation = (g as Officer).Tag.Id, - NestedOuter = new + PropertyAfterNavigation = (g as Officer).CityOfBirth.Name, + NestedInner = new { - (g as Officer).CityOfBirth, - IsNull = (g as Officer).CityOfBirth == null, + (g as Officer).Squad, + IsNull = (g as Officer).Squad == null, Property = (g as Officer).Nickname, - PropertyAfterNavigation = (g as Officer).CityOfBirth.Name, - NestedInner = new - { - (g as Officer).Squad, - IsNull = (g as Officer).Squad == null, - Property = (g as Officer).Nickname, - PropertyAfterNavigation = (g as Officer).Squad.Id - } + PropertyAfterNavigation = (g as Officer).Squad.Id } - }), - ss => ss.Set().Select( - g => new + } + }), + ss => ss.Set().Select(g => new + { + Gear = g, + g.Tag, + IsNull = g.Tag == null, + Property = g.Nickname, + PropertyAfterNavigation = g.Tag.Id, + NestedOuter = new { - Gear = g, - g.Tag, - IsNull = g.Tag == null, + g.CityOfBirth, + IsNull = g.CityOfBirth == null, Property = g.Nickname, - PropertyAfterNavigation = g.Tag.Id, - NestedOuter = new + PropertyAfterNavigation = g.CityOfBirth.Name, + NestedInner = new { - g.CityOfBirth, - IsNull = g.CityOfBirth == null, + g.Squad, + IsNull = g.Squad == null, Property = g.Nickname, - PropertyAfterNavigation = g.CityOfBirth.Name, - NestedInner = new - { - g.Squad, - IsNull = g.Squad == null, - Property = g.Nickname, - PropertyAfterNavigation = g.Squad.Id - } + PropertyAfterNavigation = g.Squad.Id } - }), + } + }), elementSorter: e => e.Gear.Nickname, elementAsserter: (e, a) => { @@ -7378,57 +6695,54 @@ public virtual Task Project_navigation_defined_on_base_from_entity_with_inherita AssertEqual(e.NestedOuter.NestedInner.PropertyAfterNavigation, a.NestedOuter.NestedInner.PropertyAfterNavigation); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_navigation_defined_on_derived_from_entity_with_inheritance_using_soft_cast(bool async) => AssertQuery( async, - ss => ss.Set().Select( - l => new + ss => ss.Set().Select(l => new + { + Leader = l, + (l as LocustCommander).DefeatedBy, + IsNull = (l as LocustCommander).DefeatedBy == null, + Property = (l as LocustCommander).DefeatedByNickname, + PropertyAfterNavigation = (bool?)(l as LocustCommander).DefeatedBy.HasSoulPatch, + NestedOuter = new { - Leader = l, - (l as LocustCommander).DefeatedBy, - IsNull = (l as LocustCommander).DefeatedBy == null, - Property = (l as LocustCommander).DefeatedByNickname, - PropertyAfterNavigation = (bool?)(l as LocustCommander).DefeatedBy.HasSoulPatch, - NestedOuter = new + (l as LocustCommander).CommandingFaction, + IsNull = (l as LocustCommander).CommandingFaction == null, + Property = (int?)(l as LocustCommander).HighCommandId, + PropertyAfterNavigation = (l as LocustCommander).CommandingFaction.Eradicated, + NestedInner = new { - (l as LocustCommander).CommandingFaction, - IsNull = (l as LocustCommander).CommandingFaction == null, - Property = (int?)(l as LocustCommander).HighCommandId, - PropertyAfterNavigation = (l as LocustCommander).CommandingFaction.Eradicated, - NestedInner = new - { - (l as LocustCommander).HighCommand, - IsNull = (l as LocustCommander).HighCommand == null, - Property = (l as LocustCommander).DefeatedBySquadId, - PropertyAfterNavigation = (l as LocustCommander).HighCommand.Name - } + (l as LocustCommander).HighCommand, + IsNull = (l as LocustCommander).HighCommand == null, + Property = (l as LocustCommander).DefeatedBySquadId, + PropertyAfterNavigation = (l as LocustCommander).HighCommand.Name } - }), - ss => ss.Set().Select( - l => new + } + }), + ss => ss.Set().Select(l => new + { + Leader = l, + (l as LocustCommander).DefeatedBy, + IsNull = (l as LocustCommander).DefeatedBy == null, + Property = (l as LocustCommander).DefeatedByNickname, + PropertyAfterNavigation = (bool?)(l as LocustCommander).DefeatedBy.HasSoulPatch, + NestedOuter = new { - Leader = l, - (l as LocustCommander).DefeatedBy, - IsNull = (l as LocustCommander).DefeatedBy == null, - Property = (l as LocustCommander).DefeatedByNickname, - PropertyAfterNavigation = (bool?)(l as LocustCommander).DefeatedBy.HasSoulPatch, - NestedOuter = new + (l as LocustCommander).CommandingFaction, + IsNull = (l as LocustCommander).CommandingFaction == null, + Property = (int?)(l as LocustCommander).HighCommandId, + PropertyAfterNavigation = (l as LocustCommander).CommandingFaction.MaybeScalar(x => x.Eradicated), + NestedInner = new { - (l as LocustCommander).CommandingFaction, - IsNull = (l as LocustCommander).CommandingFaction == null, - Property = (int?)(l as LocustCommander).HighCommandId, - PropertyAfterNavigation = (l as LocustCommander).CommandingFaction.MaybeScalar(x => x.Eradicated), - NestedInner = new - { - (l as LocustCommander).HighCommand, - IsNull = (l as LocustCommander).HighCommand == null, - Property = (l as LocustCommander).MaybeScalar(x => x.DefeatedBySquadId), - PropertyAfterNavigation = (l as LocustCommander).HighCommand.Name - } + (l as LocustCommander).HighCommand, + IsNull = (l as LocustCommander).HighCommand == null, + Property = (l as LocustCommander).MaybeScalar(x => x.DefeatedBySquadId), + PropertyAfterNavigation = (l as LocustCommander).HighCommand.Name } - }), + } + }), elementSorter: e => e.Leader.Name, elementAsserter: (e, a) => { @@ -7447,8 +6761,7 @@ public virtual Task Project_navigation_defined_on_derived_from_entity_with_inher AssertEqual(e.NestedOuter.NestedInner.PropertyAfterNavigation, a.NestedOuter.NestedInner.PropertyAfterNavigation); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_entity_with_itself_grouped_by_key_followed_by_include_skip_take(bool async) => AssertQuery( async, @@ -7457,15 +6770,13 @@ join g2 in ss.Set().Where(x => x.Nickname != "Dom").GroupBy(x => x.HasSoul .Select(g => g.Min(x => x.Nickname.Length)) on g1.Nickname.Length equals g2 select g1).Include(x => x.Weapons).OrderBy(x => x.Nickname).Skip(0).Take(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_equals_method_on_nullable_with_object_overload(bool async) => AssertQuery( async, ss => ss.Set().Where(m => m.Rating.Equals(null))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_column_and_Contains(bool async) { var values = new[] { false, true }; @@ -7474,8 +6785,7 @@ public virtual Task Where_bool_column_and_Contains(bool async) ss => ss.Set().Where(g => g.HasSoulPatch && values.Contains(g.HasSoulPatch))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_column_or_Contains(bool async) { var values = new[] { false, true }; @@ -7484,8 +6794,7 @@ public virtual Task Where_bool_column_or_Contains(bool async) ss => ss.Set().Where(g => g.HasSoulPatch && values.Contains(g.HasSoulPatch))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Enum_matching_take_value_gets_different_type_mapping(bool async) { var value = MilitaryRank.Private; @@ -7497,60 +6806,52 @@ public virtual Task Enum_matching_take_value_gets_different_type_mapping(bool as .Select(g => g.Rank & value)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_equality_to_null_with_composite_key(bool async) => AssertQuery( async, ss => ss.Set().Where(s => s.Members.OrderBy(e => e.Nickname).FirstOrDefault() == null), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_equality_to_null_with_composite_key_should_match_nulls(bool async) => AssertQuery( async, - ss => ss.Set().Where( - s => s.Members - .Where(m => m.FullName == "Anthony Carmine") - .OrderBy(e => e.Nickname) - .FirstOrDefault() - == null)); + ss => ss.Set().Where(s => s.Members + .Where(m => m.FullName == "Anthony Carmine") + .OrderBy(e => e.Nickname) + .FirstOrDefault() + == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_equality_to_null_without_composite_key(bool async) => AssertQuery( async, ss => ss.Set().Where(s => s.Weapons.OrderBy(e => e.Name).FirstOrDefault() == null), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_equality_to_null_without_composite_key_should_match_null(bool async) => AssertQuery( async, - ss => ss.Set().Where( - s => s.Weapons.Where(w => w.Name == "Hammer of Dawn").OrderBy(e => e.Name).FirstOrDefault() == null)); + ss => ss.Set().Where(s + => s.Weapons.Where(w => w.Name == "Hammer of Dawn").OrderBy(e => e.Name).FirstOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ElementAt_basic_with_OrderBy(bool async) => AssertElementAt( async, ss => ss.Set().OrderBy(g => g.FullName), () => 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ElementAtOrDefault_basic_with_OrderBy(bool async) => AssertElementAtOrDefault( async, ss => ss.Set().OrderBy(g => g.FullName), () => 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ElementAtOrDefault_basic_with_OrderBy_parameter(bool async) { var prm = 2; @@ -7561,33 +6862,29 @@ public virtual Task ElementAtOrDefault_basic_with_OrderBy_parameter(bool async) () => prm); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_with_ElementAtOrDefault_equality_to_null_with_composite_key(bool async) => AssertQuery( async, ss => ss.Set().Where(s => s.Members.OrderBy(e => e.Nickname).ElementAtOrDefault(2) == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_with_ElementAt_using_column_as_index(bool async) => AssertQuery( async, ss => ss.Set().Where(s => s.Members.OrderBy(m => m.Nickname).ElementAt(s.Id).Nickname == "Cole Train"), ss => ss.Set().Where(s => s.Members.OrderBy(m => m.Nickname).ElementAtOrDefault(s.Id).Nickname == "Cole Train")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Using_indexer_on_byte_array_and_string_in_projection(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - ByteArray = x.Banner[0], - String = x.Name[1] - }), + ss => ss.Set().Select(x => new + { + x.Id, + ByteArray = x.Banner[0], + String = x.Name[1] + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -7596,8 +6893,7 @@ public virtual Task Using_indexer_on_byte_array_and_string_in_projection(bool as Assert.Equal(e.String, a.String); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Set_operator_with_navigation_in_projection_groupby_aggregate(bool async) => AssertQuery( async, @@ -7607,8 +6903,7 @@ public virtual Task Set_operator_with_navigation_in_projection_groupby_aggregate .GroupBy(x => new { x.Name }) .Select(x => new { x.Key.Name, SumOfLengths = x.Sum(xx => xx.Location.Length) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nav_expansion_inside_Contains_argument(bool async) { var numbers = new[] { 1, -1 }; @@ -7618,8 +6913,7 @@ public virtual Task Nav_expansion_inside_Contains_argument(bool async) ss => ss.Set().Where(x => numbers.Contains(x.Weapons.Any() ? 1 : 0))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nav_expansion_with_member_pushdown_inside_Contains_argument(bool async) { var weapons = new[] { "Marcus' Lancer", "Dom's Gnasher" }; @@ -7629,61 +6923,53 @@ public virtual Task Nav_expansion_with_member_pushdown_inside_Contains_argument( ss => ss.Set().Where(x => weapons.Contains(x.Weapons.OrderBy(w => w.Id).FirstOrDefault().Name))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_inside_Take_argument(bool async) { var numbers = new[] { 0, 1, 2 }; return AssertQuery( async, - ss => ss.Set().OrderBy(x => x.Nickname).Select( - x => x.Weapons.OrderBy(g => g.Id).Take(numbers.OrderBy(xx => xx).Skip(1).FirstOrDefault())), + ss => ss.Set().OrderBy(x => x.Nickname) + .Select(x => x.Weapons.OrderBy(g => g.Id).Take(numbers.OrderBy(xx => xx).Skip(1).FirstOrDefault())), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); } - [ConditionalTheory(Skip = "issue #32303")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #32303"), MemberData(nameof(IsAsyncData))] public virtual Task Nav_expansion_inside_Skip_correlated_to_source(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(x => x.Name).Select( - x => x.BornGears.OrderBy(g => g.FullName).Skip(x.StationedGears.Any() ? 1 : 0))); + ss => ss.Set().OrderBy(x => x.Name) + .Select(x => x.BornGears.OrderBy(g => g.FullName).Skip(x.StationedGears.Any() ? 1 : 0))); - [ConditionalTheory(Skip = "issue #32303")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #32303"), MemberData(nameof(IsAsyncData))] public virtual Task Nav_expansion_inside_Take_correlated_to_source(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(x => x.Nickname).Select( - x => x.Weapons.OrderBy(g => g.Id).Take(x.AssignedCity.Name.Length))); + ss => ss.Set().OrderBy(x => x.Nickname).Select(x => x.Weapons.OrderBy(g => g.Id).Take(x.AssignedCity.Name.Length))); - [ConditionalTheory(Skip = "issue #32303")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #32303"), MemberData(nameof(IsAsyncData))] public virtual Task Nav_expansion_with_member_pushdown_inside_Take_correlated_to_source(bool async) { var numbers = new[] { 0, 1, 2 }; return AssertQuery( async, - ss => ss.Set().OrderBy(x => x.Nickname).Select( - x => x.Weapons.OrderBy(g => g.Id).Take( - ss.Set().OrderBy(xx => xx.Nickname).FirstOrDefault().AssignedCity.Name.Length)), + ss => ss.Set().OrderBy(x => x.Nickname).Select(x => x.Weapons.OrderBy(g => g.Id).Take( + ss.Set().OrderBy(xx => xx.Nickname).FirstOrDefault().AssignedCity.Name.Length)), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); } - [ConditionalTheory(Skip = "issue #32303")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #32303"), MemberData(nameof(IsAsyncData))] public virtual Task Nav_expansion_inside_ElementAt_correlated_to_source(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(x => x.Nickname).Select( - x => x.Weapons.OrderBy(g => g.Id).ElementAt(x.AssignedCity != null ? 1 : 0))); + ss => ss.Set().OrderBy(x => x.Nickname) + .Select(x => x.Weapons.OrderBy(g => g.Id).ElementAt(x.AssignedCity != null ? 1 : 0))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_one_to_many_on_composite_key_then_orderby_key_properties(bool async) => AssertQuery( async, @@ -7691,8 +6977,7 @@ public virtual Task Include_one_to_many_on_composite_key_then_orderby_key_proper assertOrder: true, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.Weapons))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Find_underlying_property_after_GroupJoin_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -7719,8 +7004,7 @@ private class GearLocustLeaderDto public int? ThreatLevel { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Join_include_coalesce_simple(bool async) { await AssertQuery( @@ -7760,8 +7044,7 @@ from o in grouping.DefaultIfEmpty() elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.Weapons))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Join_include_coalesce_nested(bool async) { await AssertQuery( @@ -7807,8 +7090,7 @@ from o in grouping.DefaultIfEmpty() }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_include_conditional(bool async) => AssertQuery( async, @@ -7830,16 +7112,14 @@ from o in grouping.DefaultIfEmpty() } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Derived_reference_is_skipped_when_base_type(bool async) => AssertQuery( async, ss => ss.Set().Include(x => ((LocustCommander)x).HighCommand), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.HighCommand))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Nested_contains_with_enum(bool async) { var key = Guid.Parse("5f221fb9-66f4-442a-92c9-d97ed5989cc7"); @@ -7858,8 +7138,8 @@ await AssertQuery( ss => ss.Set().Where(x => keys.Contains(ammoTypes.Contains(x.AmmunitionType) ? key : key))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] // Issue #33330 + [ConditionalTheory, MemberData(nameof(IsAsyncData))] + // Issue #33330 public virtual Task Non_string_concat_uses_appropriate_type_mapping(bool async) { var interval = TimeSpan.FromTicks(10); diff --git a/test/EFCore.Specification.Tests/Query/IncludeOneToOneTestBase.cs b/test/EFCore.Specification.Tests/Query/IncludeOneToOneTestBase.cs index cc229a8f950..7548ce4e4f0 100644 --- a/test/EFCore.Specification.Tests/Query/IncludeOneToOneTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/IncludeOneToOneTestBase.cs @@ -205,16 +205,14 @@ protected override string StoreName protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { modelBuilder - .Entity
( - e => e.HasOne(a => a.Resident).WithOne(p => p.Address) - .HasPrincipalKey(person => person.Id)); + .Entity
(e => e.HasOne(a => a.Resident).WithOne(p => p.Address) + .HasPrincipalKey(person => person.Id)); modelBuilder.Entity().Property("PersonId"); modelBuilder - .Entity( - e => e.HasOne(p => p.Address).WithOne(a => a.Resident) - .HasForeignKey("PersonId")); + .Entity(e => e.HasOne(p => p.Address).WithOne(a => a.Resident) + .HasForeignKey("PersonId")); } protected override Task SeedAsync(PoolableDbContext context) diff --git a/test/EFCore.Specification.Tests/Query/InheritanceQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/InheritanceQueryFixtureBase.cs index 4bcd243ae37..031fb7520f4 100644 --- a/test/EFCore.Specification.Tests/Query/InheritanceQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/InheritanceQueryFixtureBase.cs @@ -30,11 +30,10 @@ public virtual bool EnableComplexTypes => true; public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - w => w.Ignore( - CoreEventId.MappedEntityTypeIgnoredWarning, - CoreEventId.MappedPropertyIgnoredWarning, - CoreEventId.MappedNavigationIgnoredWarning)); + => base.AddOptions(builder).ConfigureWarnings(w => w.Ignore( + CoreEventId.MappedEntityTypeIgnoredWarning, + CoreEventId.MappedPropertyIgnoredWarning, + CoreEventId.MappedNavigationIgnoredWarning)); public Func GetContextCreator() => () => CreateContext(); diff --git a/test/EFCore.Specification.Tests/Query/InheritanceQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/InheritanceQueryTestBase.cs index d08b64c8dd4..052609b4bab 100644 --- a/test/EFCore.Specification.Tests/Query/InheritanceQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/InheritanceQueryTestBase.cs @@ -11,8 +11,7 @@ namespace Microsoft.EntityFrameworkCore.Query; public abstract class InheritanceQueryTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : InheritanceQueryFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Can_query_when_shared_column(bool async) { await AssertSingle( @@ -28,37 +27,32 @@ await AssertSingle( ss => ss.Set()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_all_types_when_shared_column(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_animal(bool async) => AssertQuery( async, ss => ss.Set().OfType().OrderBy(a => a.Species), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_is_kiwi(bool async) => AssertQuery( async, ss => ss.Set().Where(a => a is Kiwi)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_is_kiwi_with_cast(bool async) => AssertQuery( async, ss => ss.Set().Select(a => new { Value = a is Kiwi ? ((Kiwi)a).FoundOn : default })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_backwards_is_animal(bool async) => AssertQuery( async, @@ -66,30 +60,26 @@ public virtual Task Can_use_backwards_is_animal(bool async) // ReSharper disable once ConvertTypeCheckToNullCheck ss => ss.Set().Where(a => a is Animal)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_is_kiwi_with_other_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(a => a is Kiwi && a.CountryId == 1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_is_kiwi_in_projection(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(a => a is Kiwi)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_bird(bool async) => AssertQuery( async, ss => ss.Set().OfType().OrderBy(a => a.Species), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_bird_predicate(bool async) => AssertQuery( async, @@ -99,8 +89,7 @@ public virtual Task Can_use_of_type_bird_predicate(bool async) .OrderBy(a => a.Species), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_bird_with_projection(bool async) => AssertQuery( async, @@ -108,60 +97,52 @@ public virtual Task Can_use_of_type_bird_with_projection(bool async) .OfType() .Select(b => new { b.EagleId })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_bird_first(bool async) => AssertFirst( async, ss => ss.Set().OfType().OrderBy(a => a.Species)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_kiwi(bool async) => AssertQuery( async, ss => ss.Set().OfType()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_backwards_of_type_animal(bool async) => AssertQuery( async, ss => ss.Set().OfType()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_rose(bool async) => AssertQuery( async, ss => ss.Set().OfType()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_all_animals(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(a => a.Species), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_all_animal_views(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(av => av.CountryId), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_all_plants(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(a => a.Species), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_property_inside_complex_type_on_derived_type(bool async) => Fixture.EnableComplexTypes ? AssertQuery( @@ -169,8 +150,7 @@ public virtual Task Filter_on_property_inside_complex_type_on_derived_type(bool ss => ss.Set().Where(d => d.AdditionalInfo.LeafStructure.AreLeavesBig)) : Task.CompletedTask; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_filter_all_animals(bool async) => AssertQuery( async, @@ -178,30 +158,26 @@ public virtual Task Can_filter_all_animals(bool async) .OrderBy(a => a.Species) .Where(a => a.Name == "Great spotted kiwi")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_all_birds(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(a => a.Species), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_just_kiwis(bool async) => AssertSingle( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_just_roses(bool async) => AssertSingle( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_include_animals(bool async) => AssertQuery( async, @@ -213,8 +189,7 @@ public virtual Task Can_include_animals(bool async) AssertInclude(e, a, new ExpectedInclude(x => x.Animals)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_include_prey(bool async) => AssertSingle( async, @@ -225,8 +200,7 @@ public virtual Task Can_include_prey(bool async) AssertInclude(e, a, new ExpectedInclude(x => x.Prey)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_kiwi_where_south_on_derived_property(bool async) => AssertQuery( async, @@ -234,8 +208,7 @@ public virtual Task Can_use_of_type_kiwi_where_south_on_derived_property(bool as .OfType() .Where(x => x.FoundOn == Island.South)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_use_of_type_kiwi_where_north_on_derived_property(bool async) => AssertQuery( async, @@ -244,15 +217,13 @@ public virtual Task Can_use_of_type_kiwi_where_north_on_derived_property(bool as .Where(x => x.FoundOn == Island.North), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Discriminator_used_when_projection_over_derived_type(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(k => k.FoundOn)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Discriminator_used_when_projection_over_derived_type2(bool async) => AssertQuery( async, @@ -262,8 +233,7 @@ public virtual Task Discriminator_used_when_projection_over_derived_type2(bool a .Select(b => new { b.IsFlightless, Discriminator = b.GetType().Name }), elementSorter: e => (e.IsFlightless, e.Discriminator)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Discriminator_with_cast_in_shadow_property(bool async) => AssertQuery( async, @@ -275,8 +245,7 @@ public virtual Task Discriminator_with_cast_in_shadow_property(bool async) .Select(k => new { Predator = ((Bird)k).Name }), elementSorter: e => e.Predator); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Discriminator_used_when_projection_over_of_type(bool async) => AssertQueryScalar( async, @@ -327,8 +296,7 @@ public virtual Task Can_insert_update_delete() }); } - [ConditionalTheory(Skip = "Issue#16298")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#16298"), MemberData(nameof(IsAsyncData))] public virtual Task Union_siblings_with_duplicate_property_in_subquery(bool async) // Coke and Tea both have CaffeineGrams, which both need to be projected out on each side and so // requiring alias uniquification. They also have a different number of properties. @@ -338,8 +306,7 @@ public virtual Task Union_siblings_with_duplicate_property_in_subquery(bool asyn .Union(ss.Set()) .Where(d => d.SortIndex > 0)); - [ConditionalTheory(Skip = "Issue#16298")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#16298"), MemberData(nameof(IsAsyncData))] public virtual Task OfType_Union_subquery(bool async) => AssertQuery( async, @@ -348,8 +315,7 @@ public virtual Task OfType_Union_subquery(bool async) .Union(ss.Set().OfType()) .Where(o => o.FoundOn == Island.North)); - [ConditionalTheory(Skip = "Issue#16298")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#16298"), MemberData(nameof(IsAsyncData))] public virtual Task OfType_Union_OfType(bool async) => AssertQuery( async, @@ -358,8 +324,7 @@ public virtual Task OfType_Union_OfType(bool async) .Union(ss.Set()) .OfType()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_OfType(bool async) => AssertQuery( async, @@ -369,8 +334,7 @@ public virtual Task Subquery_OfType(bool async) .Distinct() .OfType()); - [ConditionalTheory(Skip = "Issue#16298")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#16298"), MemberData(nameof(IsAsyncData))] public virtual Task Union_entity_equality(bool async) => AssertQuery( async, @@ -404,8 +368,7 @@ public virtual async Task Setting_foreign_key_to_a_different_type_throws() } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Byte_enum_value_constant_used_in_projection(bool async) => AssertQueryScalar( async, @@ -433,8 +396,7 @@ public virtual async Task Member_access_on_intermediate_type_works() Assert.Equal("Great spotted kiwi", kiwi.Name); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Is_operator_on_result_of_FirstOrDefault(bool async) => AssertQuery( async, @@ -443,86 +405,74 @@ public virtual Task Is_operator_on_result_of_FirstOrDefault(bool async) .OrderBy(a => a.Species), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Selecting_only_base_properties_on_base_type(bool async) => AssertQuery( async, ss => ss.Set().Select(a => new { a.Name }), elementSorter: e => e.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Selecting_only_base_properties_on_derived_type(bool async) => AssertQuery( async, ss => ss.Set().Select(a => new { a.Name }), elementSorter: e => e.Name); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Using_is_operator_on_multiple_type_with_no_result(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e is Kiwi).Where(e => e is Eagle), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Using_is_operator_with_of_type_on_multiple_type_with_no_result(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e is Kiwi).OfType(), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Using_OfType_on_multiple_type_with_no_result(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().OfType().OfType(), - elementSorter: e => e.Name)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().OfType().OfType(), + elementSorter: e => e.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_abstract_base_type(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(Animal)), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_intermediate_type(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(Bird)), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_leaf_type_with_sibling(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(Eagle))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_leaf_type_with_sibling2(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(Kiwi))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_leaf_type_with_sibling2_reverse(bool async) => AssertQuery( async, ss => ss.Set().Where(e => typeof(Kiwi) == e.GetType())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_leaf_type_with_sibling2_not_equal(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/InheritanceRelationshipsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/InheritanceRelationshipsQueryTestBase.cs index 2e011bfee7e..006d622b39b 100644 --- a/test/EFCore.Specification.Tests/Query/InheritanceRelationshipsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/InheritanceRelationshipsQueryTestBase.cs @@ -70,8 +70,7 @@ public virtual void Entity_can_make_separate_relationships_with_base_type_and_de Assert.Equal(nameof(DerivedInheritanceRelationshipEntity.DerivedReferenceOnDerived), fkOnDerived.PrincipalToDependent.Name); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance(bool async) => AssertQuery( async, @@ -80,8 +79,7 @@ public virtual Task Include_reference_with_inheritance(bool async) e, a, new ExpectedInclude(x => x.BaseReferenceOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_reverse(bool async) => AssertQuery( async, @@ -90,8 +88,7 @@ public virtual Task Include_reference_with_inheritance_reverse(bool async) e, a, new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_self_reference_with_inheritance(bool async) => AssertQuery( async, @@ -100,8 +97,7 @@ public virtual Task Include_self_reference_with_inheritance(bool async) e, a, new ExpectedInclude(x => x.DerivedSefReferenceOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_self_reference_with_inheritance_reverse(bool async) => AssertQuery( async, @@ -110,8 +106,7 @@ public virtual Task Include_self_reference_with_inheritance_reverse(bool async) e, a, new ExpectedInclude(x => x.BaseSelfReferenceOnDerived))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_with_filter(bool async) => AssertQuery( async, @@ -120,8 +115,7 @@ public virtual Task Include_reference_with_inheritance_with_filter(bool async) e, a, new ExpectedInclude(x => x.BaseReferenceOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_with_filter_reverse(bool async) => AssertQuery( async, @@ -130,8 +124,7 @@ public virtual Task Include_reference_with_inheritance_with_filter_reverse(bool e, a, new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_without_inheritance(bool async) => AssertQuery( async, @@ -140,8 +133,7 @@ public virtual Task Include_reference_without_inheritance(bool async) e, a, new ExpectedInclude(x => x.ReferenceOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_without_inheritance_reverse(bool async) => AssertQuery( async, @@ -150,8 +142,7 @@ public virtual Task Include_reference_without_inheritance_reverse(bool async) e, a, new ExpectedInclude(x => x.Parent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_without_inheritance_with_filter(bool async) => AssertQuery( async, @@ -160,8 +151,7 @@ public virtual Task Include_reference_without_inheritance_with_filter(bool async e, a, new ExpectedInclude(x => x.ReferenceOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_without_inheritance_with_filter_reverse(bool async) => AssertQuery( async, @@ -170,8 +160,7 @@ public virtual Task Include_reference_without_inheritance_with_filter_reverse(bo e, a, new ExpectedInclude(x => x.Parent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_inheritance(bool async) => AssertQuery( async, @@ -180,8 +169,7 @@ public virtual Task Include_collection_with_inheritance(bool async) e, a, new ExpectedInclude(x => x.BaseCollectionOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_inheritance_reverse(bool async) => AssertQuery( async, @@ -191,8 +179,7 @@ public virtual Task Include_collection_with_inheritance_reverse(bool async) a, new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_inheritance_with_filter(bool async) => AssertQuery( async, @@ -201,8 +188,7 @@ public virtual Task Include_collection_with_inheritance_with_filter(bool async) e, a, new ExpectedInclude(x => x.BaseCollectionOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_inheritance_with_filter_reverse(bool async) => AssertQuery( async, @@ -211,8 +197,7 @@ public virtual Task Include_collection_with_inheritance_with_filter_reverse(bool e, a, new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_without_inheritance(bool async) => AssertQuery( async, @@ -221,8 +206,7 @@ public virtual Task Include_collection_without_inheritance(bool async) e, a, new ExpectedInclude(x => x.CollectionOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_without_inheritance_reverse(bool async) => AssertQuery( async, @@ -231,8 +215,7 @@ public virtual Task Include_collection_without_inheritance_reverse(bool async) e, a, new ExpectedInclude(x => x.Parent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_without_inheritance_with_filter(bool async) => AssertQuery( async, @@ -241,8 +224,7 @@ public virtual Task Include_collection_without_inheritance_with_filter(bool asyn e, a, new ExpectedInclude(x => x.CollectionOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_without_inheritance_with_filter_reverse(bool async) => AssertQuery( async, @@ -251,8 +233,7 @@ public virtual Task Include_collection_without_inheritance_with_filter_reverse(b e, a, new ExpectedInclude(x => x.Parent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_on_derived1(bool async) => AssertQuery( async, @@ -261,8 +242,7 @@ public virtual Task Include_reference_with_inheritance_on_derived1(bool async) e, a, new ExpectedInclude(x => x.BaseReferenceOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_on_derived2(bool async) => AssertQuery( async, @@ -271,8 +251,7 @@ public virtual Task Include_reference_with_inheritance_on_derived2(bool async) e, a, new ExpectedInclude(x => x.BaseReferenceOnDerived))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_on_derived4(bool async) => AssertQuery( async, @@ -281,8 +260,7 @@ public virtual Task Include_reference_with_inheritance_on_derived4(bool async) e, a, new ExpectedInclude(x => x.DerivedReferenceOnDerived))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_on_derived_reverse(bool async) => AssertQuery( async, @@ -291,8 +269,7 @@ public virtual Task Include_reference_with_inheritance_on_derived_reverse(bool a e, a, new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_on_derived_with_filter1(bool async) => AssertQuery( async, @@ -301,8 +278,7 @@ public virtual Task Include_reference_with_inheritance_on_derived_with_filter1(b e, a, new ExpectedInclude(x => x.BaseReferenceOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_on_derived_with_filter2(bool async) => AssertQuery( async, @@ -311,8 +287,7 @@ public virtual Task Include_reference_with_inheritance_on_derived_with_filter2(b e, a, new ExpectedInclude(x => x.BaseReferenceOnDerived))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_on_derived_with_filter4(bool async) => AssertQuery( async, @@ -321,8 +296,7 @@ public virtual Task Include_reference_with_inheritance_on_derived_with_filter4(b e, a, new ExpectedInclude(x => x.DerivedReferenceOnDerived))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_inheritance_on_derived_with_filter_reverse(bool async) => AssertQuery( async, @@ -331,8 +305,7 @@ public virtual Task Include_reference_with_inheritance_on_derived_with_filter_re e, a, new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_without_inheritance_on_derived1(bool async) => AssertQuery( async, @@ -341,8 +314,7 @@ public virtual Task Include_reference_without_inheritance_on_derived1(bool async e, a, new ExpectedInclude(x => x.ReferenceOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_without_inheritance_on_derived2(bool async) => AssertQuery( async, @@ -351,8 +323,7 @@ public virtual Task Include_reference_without_inheritance_on_derived2(bool async e, a, new ExpectedInclude(x => x.ReferenceOnDerived))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_without_inheritance_on_derived_reverse(bool async) => AssertQuery( async, @@ -361,8 +332,7 @@ public virtual Task Include_reference_without_inheritance_on_derived_reverse(boo e, a, new ExpectedInclude(x => x.Parent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_inheritance_on_derived1(bool async) => AssertQuery( async, @@ -371,8 +341,7 @@ public virtual Task Include_collection_with_inheritance_on_derived1(bool async) e, a, new ExpectedInclude(x => x.BaseCollectionOnBase))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_inheritance_on_derived2(bool async) => AssertQuery( async, @@ -381,8 +350,7 @@ public virtual Task Include_collection_with_inheritance_on_derived2(bool async) e, a, new ExpectedInclude(x => x.BaseCollectionOnDerived))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_inheritance_on_derived3(bool async) => AssertQuery( async, @@ -391,8 +359,7 @@ public virtual Task Include_collection_with_inheritance_on_derived3(bool async) e, a, new ExpectedInclude(x => x.DerivedCollectionOnDerived))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_inheritance_on_derived_reverse(bool async) => AssertQuery( async, @@ -401,8 +368,7 @@ public virtual Task Include_collection_with_inheritance_on_derived_reverse(bool e, a, new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_with_inheritance_reference_reference(bool async) => AssertQuery( async, @@ -412,8 +378,7 @@ public virtual Task Nested_include_with_inheritance_reference_reference(bool asy new ExpectedInclude(x => x.BaseReferenceOnBase), new ExpectedInclude(x => x.NestedReference))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_with_inheritance_reference_reference_on_base(bool async) => AssertQuery( async, @@ -423,8 +388,7 @@ public virtual Task Nested_include_with_inheritance_reference_reference_on_base( new ExpectedInclude(x => x.BaseReferenceOnBase), new ExpectedInclude(x => x.NestedReference))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_with_inheritance_reference_reference_reverse(bool async) => AssertQuery( async, @@ -434,8 +398,7 @@ public virtual Task Nested_include_with_inheritance_reference_reference_reverse( new ExpectedInclude(x => x.ParentReference), new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_with_inheritance_reference_collection(bool async) => AssertQuery( async, @@ -445,8 +408,7 @@ public virtual Task Nested_include_with_inheritance_reference_collection(bool as new ExpectedInclude(x => x.BaseReferenceOnBase), new ExpectedInclude(x => x.NestedCollection))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_with_inheritance_reference_collection_on_base(bool async) => AssertQuery( async, @@ -456,8 +418,7 @@ public virtual Task Nested_include_with_inheritance_reference_collection_on_base new ExpectedInclude(x => x.BaseReferenceOnBase), new ExpectedInclude(x => x.NestedCollection))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_with_inheritance_reference_collection_reverse(bool async) => AssertQuery( async, @@ -467,8 +428,7 @@ public virtual Task Nested_include_with_inheritance_reference_collection_reverse new ExpectedInclude(x => x.ParentReference), new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_with_inheritance_collection_reference(bool async) => AssertQuery( async, @@ -478,8 +438,7 @@ public virtual Task Nested_include_with_inheritance_collection_reference(bool as new ExpectedInclude(x => x.BaseCollectionOnBase), new ExpectedInclude(x => x.NestedReference))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_with_inheritance_collection_reference_reverse(bool async) => AssertQuery( async, @@ -489,8 +448,7 @@ public virtual Task Nested_include_with_inheritance_collection_reference_reverse new ExpectedInclude(x => x.ParentCollection), new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_with_inheritance_collection_collection(bool async) => AssertQuery( async, @@ -500,8 +458,7 @@ public virtual Task Nested_include_with_inheritance_collection_collection(bool a new ExpectedInclude(x => x.BaseCollectionOnBase), new ExpectedInclude(x => x.NestedCollection))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_with_inheritance_collection_collection_reverse(bool async) => AssertQuery( async, @@ -511,8 +468,7 @@ public virtual Task Nested_include_with_inheritance_collection_collection_revers new ExpectedInclude(x => x.ParentCollection), new ExpectedInclude(x => x.BaseParent))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_include_collection_reference_on_non_entity_base(bool async) => AssertQuery( async, @@ -522,14 +478,12 @@ public virtual Task Nested_include_collection_reference_on_non_entity_base(bool new ExpectedInclude(x => x.Principals), new ExpectedInclude(x => x.Reference))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_on_base_type(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => - new { e.Id, e.BaseCollectionOnBase }), + ss => ss.Set().Select(e => + new { e.Id, e.BaseCollectionOnBase }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -537,8 +491,7 @@ public virtual Task Collection_projection_on_base_type(bool async) AssertCollection(e.BaseCollectionOnBase, a.BaseCollectionOnBase); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_on_derived_type_with_queryable_Cast(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/JsonQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/JsonQueryFixtureBase.cs index de2bc86c787..f1d8009acb1 100644 --- a/test/EFCore.Specification.Tests/Query/JsonQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/JsonQueryFixtureBase.cs @@ -453,12 +453,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con { modelBuilder.Entity().Property(x => x.Id).ValueGeneratedNever(); modelBuilder.Entity().Property(x => x.Id).ValueGeneratedNever(); - modelBuilder.Entity( - b => - { - b.Property(x => x.Id).ValueGeneratedNever(); - b.Property(x => x.Name); - }); + modelBuilder.Entity(b => + { + b.Property(x => x.Id).ValueGeneratedNever(); + b.Property(x => x.Name); + }); modelBuilder.Entity().Property(x => x.Id).ValueGeneratedNever(); modelBuilder.Entity().OwnsOne( @@ -531,46 +530,44 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con }); modelBuilder.Entity().Property(x => x.Id).ValueGeneratedNever(); - modelBuilder.Entity( - b => - { - b.OwnsOne( - x => x.ReferenceOnBase, bb => - { - bb.OwnsOne(x => x.OwnedReferenceLeaf); - bb.OwnsMany(x => x.OwnedCollectionLeaf); - bb.Property(x => x.Fraction).HasPrecision(18, 2); - }); + modelBuilder.Entity(b => + { + b.OwnsOne( + x => x.ReferenceOnBase, bb => + { + bb.OwnsOne(x => x.OwnedReferenceLeaf); + bb.OwnsMany(x => x.OwnedCollectionLeaf); + bb.Property(x => x.Fraction).HasPrecision(18, 2); + }); - b.OwnsMany( - x => x.CollectionOnBase, bb => - { - bb.OwnsOne(x => x.OwnedReferenceLeaf); - bb.OwnsMany(x => x.OwnedCollectionLeaf); - bb.Property(x => x.Fraction).HasPrecision(18, 2); - }); - }); + b.OwnsMany( + x => x.CollectionOnBase, bb => + { + bb.OwnsOne(x => x.OwnedReferenceLeaf); + bb.OwnsMany(x => x.OwnedCollectionLeaf); + bb.Property(x => x.Fraction).HasPrecision(18, 2); + }); + }); - modelBuilder.Entity( - b => - { - b.HasBaseType(); - b.OwnsOne( - x => x.ReferenceOnDerived, bb => - { - bb.OwnsOne(x => x.OwnedReferenceLeaf); - bb.OwnsMany(x => x.OwnedCollectionLeaf); - bb.Property(x => x.Fraction).HasPrecision(18, 2); - }); + modelBuilder.Entity(b => + { + b.HasBaseType(); + b.OwnsOne( + x => x.ReferenceOnDerived, bb => + { + bb.OwnsOne(x => x.OwnedReferenceLeaf); + bb.OwnsMany(x => x.OwnedCollectionLeaf); + bb.Property(x => x.Fraction).HasPrecision(18, 2); + }); - b.OwnsMany( - x => x.CollectionOnDerived, bb => - { - bb.OwnsOne(x => x.OwnedReferenceLeaf); - bb.OwnsMany(x => x.OwnedCollectionLeaf); - bb.Property(x => x.Fraction).HasPrecision(18, 2); - }); - }); + b.OwnsMany( + x => x.CollectionOnDerived, bb => + { + bb.OwnsOne(x => x.OwnedReferenceLeaf); + bb.OwnsMany(x => x.OwnedCollectionLeaf); + bb.Property(x => x.Fraction).HasPrecision(18, 2); + }); + }); modelBuilder.Entity().Property(x => x.Id).ValueGeneratedNever(); modelBuilder.Entity().OwnsOne( diff --git a/test/EFCore.Specification.Tests/Query/JsonQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/JsonQueryTestBase.cs index 845336fa9ea..5a5aa932f5b 100644 --- a/test/EFCore.Specification.Tests/Query/JsonQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/JsonQueryTestBase.cs @@ -10,15 +10,13 @@ namespace Microsoft.EntityFrameworkCore.Query; public abstract class JsonQueryTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : JsonQueryFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owner_entity_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, ss => ss.Set().AsNoTrackingWithIdentityResolution()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owner_entity_duplicated_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, @@ -30,8 +28,7 @@ public virtual Task Basic_json_projection_owner_entity_duplicated_NoTrackingWith AssertEqual(e.Second, a.Second); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owner_entity_twice_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, @@ -43,28 +40,25 @@ public virtual Task Basic_json_projection_owner_entity_twice_NoTrackingWithIdent AssertEqual(e.Second, a.Second); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owned_reference_root_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot).AsNoTrackingWithIdentityResolution()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owned_reference_duplicated_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => new - { - Root1 = x.OwnedReferenceRoot, - Branch1 = x.OwnedReferenceRoot.OwnedReferenceBranch, - Root2 = x.OwnedReferenceRoot, - Branch2 = x.OwnedReferenceRoot.OwnedReferenceBranch, - }).AsNoTrackingWithIdentityResolution(), + .Select(x => new + { + Root1 = x.OwnedReferenceRoot, + Branch1 = x.OwnedReferenceRoot.OwnedReferenceBranch, + Root2 = x.OwnedReferenceRoot, + Branch2 = x.OwnedReferenceRoot.OwnedReferenceBranch, + }).AsNoTrackingWithIdentityResolution(), assertOrder: true, elementAsserter: (e, a) => { @@ -74,21 +68,19 @@ public virtual Task Basic_json_projection_owned_reference_duplicated_NoTrackingW AssertEqual(e.Branch2, a.Branch2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owned_reference_duplicated2_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => new - { - Root1 = x.OwnedReferenceRoot, - Leaf1 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, - Root2 = x.OwnedReferenceRoot, - Leaf2 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, - }).AsNoTrackingWithIdentityResolution(), + .Select(x => new + { + Root1 = x.OwnedReferenceRoot, + Leaf1 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, + Root2 = x.OwnedReferenceRoot, + Leaf2 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, + }).AsNoTrackingWithIdentityResolution(), assertOrder: true, elementAsserter: (e, a) => { @@ -98,68 +90,59 @@ public virtual Task Basic_json_projection_owned_reference_duplicated2_NoTracking AssertEqual(e.Leaf2, a.Leaf2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owned_collection_root_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedCollectionRoot).AsNoTrackingWithIdentityResolution(), elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owned_reference_branch_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch).AsNoTrackingWithIdentityResolution()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owned_collection_branch_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot.OwnedCollectionBranch).AsNoTrackingWithIdentityResolution(), elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owned_reference_leaf(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf).AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_owned_collection_leaf(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf).AsNoTracking(), elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_scalar(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_scalar_length(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.OwnedReferenceRoot.Name.Length > 2).Select(x => x.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Basic_json_projection_enum_inside_json_entity(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, x.OwnedReferenceRoot.OwnedReferenceBranch.Enum, - }), + ss => ss.Set().Select(x => new + { + x.Id, x.OwnedReferenceRoot.OwnedReferenceBranch.Enum, + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -167,16 +150,14 @@ public virtual Task Basic_json_projection_enum_inside_json_entity(bool async) Assert.Equal(e.Enum, a.Enum); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_enum_with_custom_conversion(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, x.OwnedReferenceRoot.Enum, - }), + ss => ss.Set().Select(x => new + { + x.Id, x.OwnedReferenceRoot.Enum, + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -184,16 +165,14 @@ public virtual Task Json_projection_enum_with_custom_conversion(bool async) Assert.Equal(e.Enum, a.Enum); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_property_in_predicate(bool async) => AssertQueryScalar( async, ss => ss.Set() .Where(x => x.OwnedReferenceRoot.OwnedReferenceBranch.Fraction < 20.5M).Select(x => x.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_subquery_property_pushdown_length(bool async) => AssertQueryScalar( async, @@ -204,8 +183,7 @@ public virtual Task Json_subquery_property_pushdown_length(bool async) .Distinct() .Select(x => x.Length)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_subquery_reference_pushdown_reference(bool async) => AssertQuery( async, @@ -216,19 +194,17 @@ public virtual Task Json_subquery_reference_pushdown_reference(bool async) .Distinct() .Select(x => x.OwnedReferenceBranch).AsNoTracking()); - [ConditionalTheory(Skip = "issue #24263")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #24263"), MemberData(nameof(IsAsyncData))] public virtual Task Json_subquery_reference_pushdown_reference_anonymous_projection(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => new - { - Entity = x.OwnedReferenceRoot, - Scalar = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething - }) + .Select(x => new + { + Entity = x.OwnedReferenceRoot, + Scalar = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething + }) .Take(10) .Distinct() .Select(x => new { x.Entity.OwnedReferenceBranch, x.Scalar.Length }).AsNoTracking(), @@ -239,32 +215,29 @@ public virtual Task Json_subquery_reference_pushdown_reference_anonymous_project Assert.Equal(e.Length, a.Length); }); - [ConditionalTheory(Skip = "issue #24263")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #24263"), MemberData(nameof(IsAsyncData))] public virtual Task Json_subquery_reference_pushdown_reference_pushdown_anonymous_projection(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => new - { - Root = x.OwnedReferenceRoot, - Scalar = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething - }) + .Select(x => new + { + Root = x.OwnedReferenceRoot, + Scalar = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething + }) .Take(10) .Distinct() .Select(x => new { Branch = x.Root.OwnedReferenceBranch, x.Scalar.Length }) .OrderBy(x => x.Length) .Take(10) .Distinct() - .Select( - x => new - { - x.Branch.OwnedReferenceLeaf, - x.Branch.OwnedCollectionLeaf, - x.Length - }) + .Select(x => new + { + x.Branch.OwnedReferenceLeaf, + x.Branch.OwnedCollectionLeaf, + x.Length + }) .AsNoTracking(), elementSorter: e => (e.OwnedReferenceLeaf.SomethingSomething, e.OwnedCollectionLeaf.Count, e.Length), elementAsserter: (e, a) => @@ -274,8 +247,7 @@ public virtual Task Json_subquery_reference_pushdown_reference_pushdown_anonymou Assert.Equal(e.Length, a.Length); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_subquery_reference_pushdown_reference_pushdown_reference(bool async) => AssertQuery( async, @@ -290,8 +262,7 @@ public virtual Task Json_subquery_reference_pushdown_reference_pushdown_referenc .Distinct() .Select(x => x.OwnedReferenceLeaf).AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_subquery_reference_pushdown_reference_pushdown_collection(bool async) => AssertQuery( async, @@ -307,8 +278,7 @@ public virtual Task Json_subquery_reference_pushdown_reference_pushdown_collecti .Select(x => x.OwnedCollectionLeaf).AsNoTracking(), elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_subquery_reference_pushdown_property(bool async) => AssertQuery( async, @@ -319,22 +289,19 @@ public virtual Task Json_subquery_reference_pushdown_property(bool async) .Distinct() .Select(x => x.SomethingSomething)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Custom_naming_projection_owner_entity(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Custom_naming_projection_owned_reference(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch).AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Custom_naming_projection_owned_collection(bool async) => AssertQuery( async, @@ -342,29 +309,26 @@ public virtual Task Custom_naming_projection_owned_collection(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Custom_naming_projection_owned_scalar(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch.Fraction)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Custom_naming_projection_everything(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - root = x, - referece = x.OwnedReferenceRoot, - nested_reference = x.OwnedReferenceRoot.OwnedReferenceBranch, - collection = x.OwnedCollectionRoot, - nested_collection = x.OwnedReferenceRoot.OwnedCollectionBranch, - scalar = x.OwnedReferenceRoot.Name, - nested_scalar = x.OwnedReferenceRoot.OwnedReferenceBranch.Fraction, - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + root = x, + referece = x.OwnedReferenceRoot, + nested_reference = x.OwnedReferenceRoot.OwnedReferenceBranch, + collection = x.OwnedCollectionRoot, + nested_collection = x.OwnedReferenceRoot.OwnedCollectionBranch, + scalar = x.OwnedReferenceRoot.Name, + nested_scalar = x.OwnedReferenceRoot.OwnedReferenceBranch.Fraction, + }).AsNoTracking(), elementSorter: e => e.root.Id, elementAsserter: (e, a) => { @@ -377,15 +341,13 @@ public virtual Task Custom_naming_projection_everything(bool async) Assert.Equal(e.nested_scalar, a.nested_scalar); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_entity_with_single_owned(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LeftJoin_json_entities(bool async) => AssertQuery( async, @@ -398,8 +360,7 @@ public virtual Task LeftJoin_json_entities(bool async) AssertEqual(e.e2, a.e2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task RightJoin_json_entities(bool async) => AssertQuery( async, @@ -416,8 +377,7 @@ public virtual Task RightJoin_json_entities(bool async) AssertEqual(e.e2, a.e2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_json_entities_complex_projection(bool async) => AssertQuery( async, @@ -444,8 +404,7 @@ from e2 in g.DefaultIfEmpty() AssertCollection(e.OwnedCollectionLeaf, a.OwnedCollectionLeaf, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_json_entities_json_being_inner(bool async) => AssertQuery( async, @@ -460,8 +419,7 @@ from e2 in g.DefaultIfEmpty() AssertEqual(e.e2, a.e2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_json_entities_complex_projection_json_being_inner(bool async) => AssertQuery( async, @@ -490,65 +448,56 @@ from e2 in g.DefaultIfEmpty() AssertEqual(e.Name, a.Name); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_json_entity_FirstOrDefault_subquery_with_binding_on_top(bool async) => AssertQueryScalar( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => ss.Set() - .OrderBy(xx => xx.Id) - .Select(xx => xx.OwnedReferenceRoot) - .FirstOrDefault().OwnedReferenceBranch.Date)); + .Select(x => ss.Set() + .OrderBy(xx => xx.Id) + .Select(xx => xx.OwnedReferenceRoot) + .FirstOrDefault().OwnedReferenceBranch.Date)); - [ConditionalTheory(Skip = "issue #28733")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #28733"), MemberData(nameof(IsAsyncData))] public virtual Task Project_json_entity_FirstOrDefault_subquery_with_entity_comparison_on_top(bool async) => AssertQueryScalar( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => ss.Set() + .Select(x => ss.Set() + .OrderBy(xx => xx.Id) + .Select(xx => xx.OwnedReferenceRoot) + .FirstOrDefault().OwnedReferenceBranch + == ss.Set() + .OrderByDescending(x => x.Id) + .Select(x => ss.Set() .OrderBy(xx => xx.Id) .Select(xx => xx.OwnedReferenceRoot) - .FirstOrDefault().OwnedReferenceBranch - == ss.Set() - .OrderByDescending(x => x.Id) - .Select( - x => ss.Set() - .OrderBy(xx => xx.Id) - .Select(xx => xx.OwnedReferenceRoot) - .FirstOrDefault().OwnedReferenceBranch))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .FirstOrDefault().OwnedReferenceBranch))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_entity_with_inheritance_basic_projection(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_entity_with_inheritance_project_derived(bool async) => AssertQuery( async, ss => ss.Set().OfType()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_entity_with_inheritance_project_navigations(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - x.ReferenceOnBase, - x.CollectionOnBase - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + x.Id, + x.ReferenceOnBase, + x.CollectionOnBase + }).AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -557,20 +506,18 @@ public virtual Task Json_entity_with_inheritance_project_navigations(bool async) AssertCollection(e.CollectionOnBase, a.CollectionOnBase, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_entity_with_inheritance_project_navigations_on_derived(bool async) => AssertQuery( async, - ss => ss.Set().OfType().Select( - x => new - { - x.Id, - x.ReferenceOnBase, - x.ReferenceOnDerived, - x.CollectionOnBase, - x.CollectionOnDerived - }).AsNoTracking(), + ss => ss.Set().OfType().Select(x => new + { + x.Id, + x.ReferenceOnBase, + x.ReferenceOnDerived, + x.CollectionOnBase, + x.CollectionOnDerived + }).AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -581,44 +528,38 @@ public virtual Task Json_entity_with_inheritance_project_navigations_on_derived( AssertCollection(e.CollectionOnDerived, a.CollectionOnDerived, ordered: true); }); - [ConditionalTheory(Skip = "issue #28645")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #28645"), MemberData(nameof(IsAsyncData))] public virtual Task Json_entity_backtracking(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf.Parent.Date)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_basic(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedCollectionRoot[1]).AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_ElementAt_in_projection(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedCollectionRoot.AsQueryable().ElementAt(1)).AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_ElementAtOrDefault_in_projection(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedCollectionRoot.AsQueryable().ElementAtOrDefault(1)).AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_project_collection(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedCollectionRoot[1].OwnedCollectionBranch).AsNoTracking(), elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_ElementAt_project_collection(bool async) => AssertQuery( async, @@ -627,8 +568,7 @@ public virtual Task Json_collection_ElementAt_project_collection(bool async) .AsNoTracking(), elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_ElementAtOrDefault_project_collection(bool async) => AssertQuery( async, @@ -637,8 +577,7 @@ public virtual Task Json_collection_ElementAtOrDefault_project_collection(bool a .AsNoTracking(), elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_using_parameter(bool async) { var prm = 0; @@ -648,8 +587,7 @@ public virtual Task Json_collection_index_in_projection_using_parameter(bool asy ss => ss.Set().Select(x => x.OwnedCollectionRoot[prm]).AsNoTracking()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_using_column(bool async) => AssertQuery( async, @@ -658,47 +596,41 @@ public virtual Task Json_collection_index_in_projection_using_column(bool async) private static int MyMethod(int value) => value; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_using_untranslatable_client_method(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedCollectionRoot[MyMethod(x.Id)]).AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_using_untranslatable_client_method2(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedCollectionRoot[0].OwnedReferenceBranch.OwnedCollectionLeaf[MyMethod(x.Id)]) .AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_outside_bounds(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedCollectionRoot[25]).AsNoTracking(), ss => ss.Set().Select(x => (JsonOwnedRoot)null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_outside_bounds2(bool async) => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf[25]).AsNoTracking(), ss => ss.Set().Select(x => (JsonOwnedLeaf)null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_outside_bounds_with_property_access(bool async) => AssertQueryScalar( async, ss => ss.Set().OrderBy(x => x.Id).Select(x => (int?)x.OwnedCollectionRoot[25].Number), ss => ss.Set().Select(x => (int?)null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_nested(bool async) { var prm = 1; @@ -708,8 +640,7 @@ public virtual Task Json_collection_index_in_projection_nested(bool async) ss => ss.Set().Select(x => x.OwnedCollectionRoot[0].OwnedCollectionBranch[prm]).AsNoTracking()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_nested_project_scalar(bool async) { var prm = 1; @@ -719,8 +650,7 @@ public virtual Task Json_collection_index_in_projection_nested_project_scalar(bo ss => ss.Set().Select(x => x.OwnedCollectionRoot[0].OwnedCollectionBranch[prm].Date)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_nested_project_reference(bool async) { var prm = 1; @@ -731,8 +661,7 @@ public virtual Task Json_collection_index_in_projection_nested_project_reference .AsNoTracking()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_nested_project_collection(bool async) { var prm = 1; @@ -747,8 +676,7 @@ public virtual Task Json_collection_index_in_projection_nested_project_collectio elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_nested_project_collection_anonymous_projection(bool async) { var prm = 1; @@ -766,15 +694,13 @@ public virtual Task Json_collection_index_in_projection_nested_project_collectio }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_predicate_using_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(x => x.OwnedCollectionRoot[0].Name != "Foo").Select(x => x.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_predicate_using_variable(bool async) { var prm = 1; @@ -784,8 +710,7 @@ public virtual Task Json_collection_index_in_predicate_using_variable(bool async ss => ss.Set().Where(x => x.OwnedCollectionRoot[prm].Name != "Foo").Select(x => x.Id)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_predicate_using_column(bool async) => AssertQuery( async, @@ -797,8 +722,7 @@ public virtual Task Json_collection_index_in_predicate_using_column(bool async) AssertEqual(e.x, a.x); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_predicate_using_complex_expression1(bool async) => AssertQuery( async, @@ -811,8 +735,7 @@ public virtual Task Json_collection_index_in_predicate_using_complex_expression1 AssertEqual(e.x, a.x); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_predicate_using_complex_expression2(bool async) => AssertQuery( async, @@ -825,106 +748,92 @@ public virtual Task Json_collection_index_in_predicate_using_complex_expression2 AssertEqual(e.x, a.x); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_ElementAt_in_predicate(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(x => x.OwnedCollectionRoot.AsQueryable().ElementAt(1).Name != "Foo").Select(x => x.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_predicate_nested_mix(bool async) { var prm = 0; return AssertQuery( async, - ss => ss.Set().Where( - x => x.OwnedCollectionRoot[1].OwnedCollectionBranch[prm].OwnedCollectionLeaf[x.Id - 1].SomethingSomething - == "e1_c2_c1_c1")); + ss => ss.Set().Where(x + => x.OwnedCollectionRoot[1].OwnedCollectionBranch[prm].OwnedCollectionLeaf[x.Id - 1].SomethingSomething + == "e1_c2_c1_c1")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_ElementAt_and_pushdown(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new { x.Id, CollectionElement = x.OwnedCollectionRoot.Select(xx => xx.Number).ElementAt(0) })); + ss => ss.Set() + .Select(x => new { x.Id, CollectionElement = x.OwnedCollectionRoot.Select(xx => xx.Number).ElementAt(0) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_Any_with_predicate(bool async) => AssertQuery( async, - ss => ss.Set().Where( - j => j.OwnedReferenceRoot.OwnedCollectionBranch.Any(b => b.OwnedReferenceLeaf.SomethingSomething == "e1_r_c1_r"))); + ss => ss.Set().Where(j + => j.OwnedReferenceRoot.OwnedCollectionBranch.Any(b => b.OwnedReferenceLeaf.SomethingSomething == "e1_r_c1_r"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_Where_ElementAt(bool async) => AssertQuery( async, - ss => ss.Set().Where( - j => - j.OwnedReferenceRoot.OwnedCollectionBranch - .Where(o => o.Enum == JsonEnum.Three) - .ElementAt(0).OwnedReferenceLeaf.SomethingSomething - == "e1_r_c2_r")); + ss => ss.Set().Where(j => + j.OwnedReferenceRoot.OwnedCollectionBranch + .Where(o => o.Enum == JsonEnum.Three) + .ElementAt(0).OwnedReferenceLeaf.SomethingSomething + == "e1_r_c2_r")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_Skip(bool async) => AssertQuery( async, ss => ss.Set() - .Where( - j => j.OwnedReferenceRoot.OwnedCollectionBranch - .Skip(1) - .ElementAt(0).OwnedReferenceLeaf.SomethingSomething - == "e1_r_c2_r")); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .Where(j => j.OwnedReferenceRoot.OwnedCollectionBranch + .Skip(1) + .ElementAt(0).OwnedReferenceLeaf.SomethingSomething + == "e1_r_c2_r")); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_OrderByDescending_Skip_ElementAt(bool async) => AssertQuery( async, ss => ss.Set() - .Where( - j => j.OwnedReferenceRoot.OwnedCollectionBranch - .OrderByDescending(b => b.Date) - .Skip(1) - .ElementAt(0).OwnedReferenceLeaf.SomethingSomething - == "e1_r_c1_r")); + .Where(j => j.OwnedReferenceRoot.OwnedCollectionBranch + .OrderByDescending(b => b.Date) + .Skip(1) + .ElementAt(0).OwnedReferenceLeaf.SomethingSomething + == "e1_r_c1_r")); // If this test is failing because of DistinctAfterOrderByWithoutRowLimitingOperatorWarning, this is because EF warns/errors by // default for Distinct after OrderBy (without Skip/Take); but you likely have a naturally-ordered JSON collection, where the // ordering has been added by the provider as part of the collection translation. // Consider overriding RelationalQueryableMethodTranslatingExpressionVisitor.IsNaturallyOrdered() to identify such naturally-ordered // collections, exempting them from the warning. - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_Distinct_Count_with_predicate(bool async) => AssertQuery( async, ss => ss.Set() - .Where( - j => j.OwnedReferenceRoot.OwnedCollectionBranch - .Distinct() - .Count(b => b.OwnedReferenceLeaf.SomethingSomething == "e1_r_c2_r") - == 1)); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .Where(j => j.OwnedReferenceRoot.OwnedCollectionBranch + .Distinct() + .Count(b => b.OwnedReferenceLeaf.SomethingSomething == "e1_r_c2_r") + == 1)); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_within_collection_Count(bool async) => AssertQuery( async, ss => ss.Set() .Where(j => j.OwnedCollectionRoot.Any(c => c.OwnedCollectionBranch.Count == 2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_in_projection_with_composition_count(bool async) => AssertQueryScalar( async, @@ -932,46 +841,39 @@ public virtual Task Json_collection_in_projection_with_composition_count(bool as .OrderBy(x => x.Id) .Select(x => x.OwnedCollectionRoot.Count)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_in_projection_with_anonymous_projection_of_scalars(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot - .Select(xx => new { xx.Name, xx.Number }) - .ToList())); + .Select(x => x.OwnedCollectionRoot + .Select(xx => new { xx.Name, xx.Number }) + .ToList())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_in_projection_with_composition_where_and_anonymous_projection_of_scalars(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot - .Where(xx => xx.Name == "Foo") - .Select(xx => new { xx.Name, xx.Number }) - .ToList())); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .Select(x => x.OwnedCollectionRoot + .Where(xx => xx.Name == "Foo") + .Select(xx => new { xx.Name, xx.Number }) + .ToList())); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_in_projection_with_composition_where_and_anonymous_projection_of_primitive_arrays(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot - .Where(xx => xx.Name == "Foo") - .Select(xx => new { xx.Names, xx.Numbers }) - .ToList())); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .Select(x => x.OwnedCollectionRoot + .Where(xx => xx.Name == "Foo") + .Select(xx => new { xx.Names, xx.Numbers }) + .ToList())); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_filter_in_projection(bool async) => AssertQuery( async, @@ -985,41 +887,35 @@ public virtual Task Json_collection_filter_in_projection(bool async) AssertCollection(e, a, ordered: true, elementAsserter: (ee, aa) => AssertEqual(ee, aa)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_nested_collection_filter_in_projection(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot - .Select(xx => xx.OwnedCollectionBranch.Where(xxx => xxx.Date != new DateTime(2000, 1, 1)).ToList())) + .Select(x => x.OwnedCollectionRoot + .Select(xx => xx.OwnedCollectionBranch.Where(xxx => xxx.Date != new DateTime(2000, 1, 1)).ToList())) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => AssertCollection( e, a, ordered: true, elementAsserter: (ee, aa) => AssertCollection(ee, aa, ordered: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_nested_collection_anonymous_projection_in_projection(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot - .Select( - xx => xx.OwnedCollectionBranch.Select( - xxx => new - { - xxx.Date, - xxx.Enum, - xxx.Enums, - xxx.Fraction, - xxx.OwnedReferenceLeaf, - xxx.OwnedCollectionLeaf - }).ToList())) + .Select(x => x.OwnedCollectionRoot + .Select(xx => xx.OwnedCollectionBranch.Select(xxx => new + { + xxx.Date, + xxx.Enum, + xxx.Enums, + xxx.Fraction, + xxx.OwnedReferenceLeaf, + xxx.OwnedCollectionLeaf + }).ToList())) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => AssertCollection( @@ -1034,8 +930,7 @@ public virtual Task Json_nested_collection_anonymous_projection_in_projection(bo AssertCollection(eee.OwnedCollectionLeaf, aaa.OwnedCollectionLeaf, ordered: true); }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_skip_take_in_projection(bool async) => AssertQuery( async, @@ -1046,28 +941,25 @@ public virtual Task Json_collection_skip_take_in_projection(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_skip_take_in_projection_project_into_anonymous_type(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot - .OrderBy(xx => xx.Name) - .Skip(1) - .Take(5) - .Select( - xx => new - { - xx.Name, - xx.Names, - xx.Number, - xx.Numbers, - xx.OwnedCollectionBranch, - xx.OwnedReferenceBranch - }).ToList()) + .Select(x => x.OwnedCollectionRoot + .OrderBy(xx => xx.Name) + .Skip(1) + .Take(5) + .Select(xx => new + { + xx.Name, + xx.Names, + xx.Number, + xx.Numbers, + xx.OwnedCollectionBranch, + xx.OwnedReferenceBranch + }).ToList()) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => @@ -1084,25 +976,22 @@ public virtual Task Json_collection_skip_take_in_projection_project_into_anonymo }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_skip_take_in_projection_with_json_reference_access_as_final_operation(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot - .OrderBy(xx => xx.Name) - .Skip(1) - .Take(5) - .Select(xx => xx.OwnedReferenceBranch).ToList()) + .Select(x => x.OwnedCollectionRoot + .OrderBy(xx => xx.Name) + .Skip(1) + .Take(5) + .Select(xx => xx.OwnedReferenceBranch).ToList()) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_distinct_in_projection(bool async) => AssertQuery( async, @@ -1113,8 +1002,7 @@ public virtual Task Json_collection_distinct_in_projection(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => (ee.Name, ee.Number))); - [ConditionalTheory(Skip = "issue #31397")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #31397"), MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_anonymous_projection_distinct_in_projection(bool async) => AssertQuery( async, @@ -1125,37 +1013,33 @@ public virtual Task Json_collection_anonymous_projection_distinct_in_projection( assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => ee)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_leaf_filter_in_projection(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf - .Where(xx => xx.SomethingSomething != "Baz").ToList()) + .Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf + .Where(xx => xx.SomethingSomething != "Baz").ToList()) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_multiple_collection_projections(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => new - { - First = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf - .Where(xx => xx.SomethingSomething != "Baz").ToList(), - Second = x.OwnedCollectionRoot.Distinct().ToList(), - Third = x.OwnedCollectionRoot - .Select(xx => xx.OwnedCollectionBranch.Where(xxx => xxx.Date != new DateTime(2000, 1, 1)).ToList()), - Fourth = x.EntityCollection.ToList() - }) + .Select(x => new + { + First = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf + .Where(xx => xx.SomethingSomething != "Baz").ToList(), + Second = x.OwnedCollectionRoot.Distinct().ToList(), + Third = x.OwnedCollectionRoot + .Select(xx => xx.OwnedCollectionBranch.Where(xxx => xxx.Date != new DateTime(2000, 1, 1)).ToList()), + Fourth = x.EntityCollection.ToList() + }) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => @@ -1166,18 +1050,16 @@ public virtual Task Json_multiple_collection_projections(bool async) AssertCollection(e.Fourth, a.Fourth); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_branch_collection_distinct_and_other_collection(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => new - { - First = x.OwnedReferenceRoot.OwnedCollectionBranch.Distinct().ToList(), Second = x.EntityCollection.ToList() - }) + .Select(x => new + { + First = x.OwnedReferenceRoot.OwnedCollectionBranch.Distinct().ToList(), Second = x.EntityCollection.ToList() + }) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => @@ -1186,19 +1068,17 @@ public virtual Task Json_branch_collection_distinct_and_other_collection(bool as AssertCollection(e.Second, a.Second); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_leaf_collection_distinct_and_other_collection(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => new - { - First = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf.Distinct().ToList(), - Second = x.EntityCollection.ToList() - }) + .Select(x => new + { + First = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf.Distinct().ToList(), + Second = x.EntityCollection.ToList() + }) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => @@ -1207,79 +1087,71 @@ public virtual Task Json_leaf_collection_distinct_and_other_collection(bool asyn AssertCollection(e.Second, a.Second); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_of_primitives_SelectMany(bool async) => AssertQuery( async, ss => ss.Set() .SelectMany(x => x.OwnedReferenceRoot.Names)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_of_primitives_index_used_in_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.OwnedReferenceRoot.Names[0] == "e1_r1")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_of_primitives_index_used_in_projection(bool async) => AssertQueryScalar( async, ss => ss.Set().OrderBy(x => x.Id).Select(x => x.OwnedReferenceRoot.OwnedReferenceBranch.Enums[0]), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_of_primitives_index_used_in_orderby(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(x => x.OwnedReferenceRoot.Numbers[0]), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_of_primitives_contains_in_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.OwnedReferenceRoot.Names.Contains("e1_r1")), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Json_collection_index_with_parameter_Select_ElementAt(bool async) { var prm = 0; await AssertQuery( async, - ss => ss.Set().Select( - x => new { x.Id, CollectionElement = x.OwnedCollectionRoot[prm].OwnedCollectionBranch.Select(xx => "Foo").ElementAt(0) })); + ss => ss.Set().Select(x => new + { + x.Id, CollectionElement = x.OwnedCollectionRoot[prm].OwnedCollectionBranch.Select(xx => "Foo").ElementAt(0) + })); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Json_collection_index_with_expression_Select_ElementAt(bool async) { var prm = 0; await AssertQuery( async, - ss => ss.Set().Select( - j => j.OwnedCollectionRoot[prm + j.Id].OwnedCollectionBranch + ss => ss.Set().Select(j => j.OwnedCollectionRoot[prm + j.Id].OwnedCollectionBranch + .Select(b => b.OwnedReferenceLeaf.SomethingSomething) + .ElementAt(0)), + ss => ss.Set().Select(j => j.OwnedCollectionRoot.Count > prm + j.Id + ? j.OwnedCollectionRoot[prm + j.Id].OwnedCollectionBranch .Select(b => b.OwnedReferenceLeaf.SomethingSomething) - .ElementAt(0)), - ss => ss.Set().Select( - j => j.OwnedCollectionRoot.Count > prm + j.Id - ? j.OwnedCollectionRoot[prm + j.Id].OwnedCollectionBranch - .Select(b => b.OwnedReferenceLeaf.SomethingSomething) - .ElementAt(0) - : null)); + .ElementAt(0) + : null)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Json_collection_Select_entity_collection_ElementAt(bool async) => await AssertQuery( async, @@ -1295,50 +1167,43 @@ public virtual async Task Json_collection_Select_entity_collection_ElementAt(boo } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Json_collection_Select_entity_ElementAt(bool async) => await AssertQuery( async, - ss => ss.Set().AsNoTracking().Select( - x => - x.OwnedCollectionRoot.Select(xx => xx.OwnedReferenceBranch).ElementAt(0))); + ss => ss.Set().AsNoTracking().Select(x => + x.OwnedCollectionRoot.Select(xx => xx.OwnedReferenceBranch).ElementAt(0))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Json_collection_Select_entity_in_anonymous_object_ElementAt(bool async) => await AssertQuery( async, - ss => ss.Set().AsNoTracking().OrderBy(x => x.Id).Select( - x => - x.OwnedCollectionRoot.Select(xx => new { xx.OwnedReferenceBranch }).ElementAt(0)), + ss => ss.Set().AsNoTracking().OrderBy(x => x.Id).Select(x => + x.OwnedCollectionRoot.Select(xx => new { xx.OwnedReferenceBranch }).ElementAt(0)), assertOrder: true, elementAsserter: (e, a) => { AssertEqual(e.OwnedReferenceBranch, a.OwnedReferenceBranch); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Json_collection_Select_entity_with_initializer_ElementAt(bool async) => await AssertQuery( async, - ss => ss.Set().Select( - x => x.OwnedCollectionRoot.Select(xx => new JsonEntityBasic { Id = x.Id }).ElementAt(0))); + ss => ss.Set() + .Select(x => x.OwnedCollectionRoot.Select(xx => new JsonEntityBasic { Id = x.Id }).ElementAt(0))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_deduplication_with_collection_indexer_in_original(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Duplicate1 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, - Original = x.OwnedCollectionRoot[0], - Duplicate2 = x.OwnedCollectionRoot[0].OwnedReferenceBranch.OwnedCollectionLeaf - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + x.Id, + Duplicate1 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, + Original = x.OwnedCollectionRoot[0], + Duplicate2 = x.OwnedCollectionRoot[0].OwnedReferenceBranch.OwnedCollectionLeaf + }).AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -1348,22 +1213,20 @@ public virtual Task Json_projection_deduplication_with_collection_indexer_in_ori AssertCollection(e.Duplicate2, a.Duplicate2, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_deduplication_with_collection_indexer_in_target(bool async) { var prm = 1; return AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Duplicate1 = x.OwnedReferenceRoot.OwnedCollectionBranch[1], - Original = x.OwnedReferenceRoot, - Duplicate2 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf[prm] - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + x.Id, + Duplicate1 = x.OwnedReferenceRoot.OwnedCollectionBranch[1], + Original = x.OwnedReferenceRoot, + Duplicate2 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf[prm] + }).AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -1374,23 +1237,21 @@ public virtual Task Json_projection_deduplication_with_collection_indexer_in_tar }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_deduplication_with_collection_in_original_and_collection_indexer_in_target(bool async) { var prm = 1; return AssertQuery( async, - ss => ss.Set().Select( - x => new - { - DuplicateMix = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[prm], - DuplicatePrm = x.OwnedReferenceRoot.OwnedCollectionBranch[prm], - x.Id, - Original = x.OwnedReferenceRoot.OwnedCollectionBranch, - DuplicateConstant = x.OwnedReferenceRoot.OwnedCollectionBranch[0], - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + DuplicateMix = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[prm], + DuplicatePrm = x.OwnedReferenceRoot.OwnedCollectionBranch[prm], + x.Id, + Original = x.OwnedReferenceRoot.OwnedCollectionBranch, + DuplicateConstant = x.OwnedReferenceRoot.OwnedCollectionBranch[0], + }).AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -1402,8 +1263,7 @@ public virtual Task Json_projection_deduplication_with_collection_in_original_an }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_using_constant_when_owner_is_present(bool async) => AssertQuery( async, @@ -1415,8 +1275,7 @@ public virtual Task Json_collection_index_in_projection_using_constant_when_owne AssertEqual(e.CollectionElement, a.CollectionElement); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_using_constant_when_owner_is_not_present(bool async) => AssertQuery( async, @@ -1428,8 +1287,7 @@ public virtual Task Json_collection_index_in_projection_using_constant_when_owne AssertEqual(e.CollectionElement, a.CollectionElement); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_using_parameter_when_owner_is_present(bool async) { var prm = 1; @@ -1445,8 +1303,7 @@ public virtual Task Json_collection_index_in_projection_using_parameter_when_own }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_using_parameter_when_owner_is_not_present(bool async) { var prm = 1; @@ -1462,8 +1319,7 @@ public virtual Task Json_collection_index_in_projection_using_parameter_when_own }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_after_collection_index_in_projection_using_constant_when_owner_is_present(bool async) => AssertQuery( async, @@ -1476,8 +1332,7 @@ public virtual Task Json_collection_after_collection_index_in_projection_using_c AssertCollection(e.Collection, a.Collection, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_after_collection_index_in_projection_using_constant_when_owner_is_not_present(bool async) => AssertQuery( async, @@ -1490,8 +1345,7 @@ public virtual Task Json_collection_after_collection_index_in_projection_using_c AssertCollection(e.Collection, a.Collection, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_after_collection_index_in_projection_using_parameter_when_owner_is_present(bool async) { var prm = 1; @@ -1508,8 +1362,7 @@ public virtual Task Json_collection_after_collection_index_in_projection_using_p }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_after_collection_index_in_projection_using_parameter_when_owner_is_not_present(bool async) { var prm = 1; @@ -1526,19 +1379,17 @@ public virtual Task Json_collection_after_collection_index_in_projection_using_p }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_when_owner_is_present_misc1(bool async) { var prm = 1; return AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x, CollectionElement = x.OwnedCollectionRoot[1].OwnedCollectionBranch[prm], - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + x, CollectionElement = x.OwnedCollectionRoot[1].OwnedCollectionBranch[prm], + }).AsNoTracking(), elementSorter: e => e.x.Id, elementAsserter: (e, a) => { @@ -1547,19 +1398,17 @@ public virtual Task Json_collection_index_in_projection_when_owner_is_present_mi }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_when_owner_is_not_present_misc1(bool async) { var prm = 1; return AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, CollectionElement = x.OwnedCollectionRoot[1].OwnedCollectionBranch[prm], - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + x.Id, CollectionElement = x.OwnedCollectionRoot[1].OwnedCollectionBranch[prm], + }).AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -1568,8 +1417,7 @@ public virtual Task Json_collection_index_in_projection_when_owner_is_not_presen }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_when_owner_is_present_misc2(bool async) => AssertQuery( async, @@ -1583,8 +1431,7 @@ public virtual Task Json_collection_index_in_projection_when_owner_is_present_mi AssertEqual(e.CollectionElement, a.CollectionElement); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_when_owner_is_not_present_misc2(bool async) => AssertQuery( async, @@ -1598,28 +1445,26 @@ public virtual Task Json_collection_index_in_projection_when_owner_is_not_presen AssertEqual(e.CollectionElement, a.CollectionElement); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_when_owner_is_present_multiple(bool async) { var prm = 1; return AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x, - CollectionElement1 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[1], - CollectionElement2 = x.OwnedCollectionRoot[1].OwnedCollectionBranch[1].OwnedReferenceLeaf, - CollectionElement3 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, - CollectionElement4 = x.OwnedCollectionRoot[prm].OwnedReferenceBranch, - CollectionElement5 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[x.Id], - CollectionElement6 = x.OwnedCollectionRoot[x.Id].OwnedCollectionBranch[1].OwnedReferenceLeaf, - CollectionElement7 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, - CollectionElement8 = x.OwnedCollectionRoot[x.Id].OwnedReferenceBranch, - CollectionElement9 = x.OwnedCollectionRoot[x.Id].OwnedCollectionBranch[x.Id], - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + x, + CollectionElement1 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[1], + CollectionElement2 = x.OwnedCollectionRoot[1].OwnedCollectionBranch[1].OwnedReferenceLeaf, + CollectionElement3 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, + CollectionElement4 = x.OwnedCollectionRoot[prm].OwnedReferenceBranch, + CollectionElement5 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[x.Id], + CollectionElement6 = x.OwnedCollectionRoot[x.Id].OwnedCollectionBranch[1].OwnedReferenceLeaf, + CollectionElement7 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, + CollectionElement8 = x.OwnedCollectionRoot[x.Id].OwnedReferenceBranch, + CollectionElement9 = x.OwnedCollectionRoot[x.Id].OwnedCollectionBranch[x.Id], + }).AsNoTracking(), elementSorter: e => e.x.Id, elementAsserter: (e, a) => { @@ -1636,28 +1481,26 @@ public virtual Task Json_collection_index_in_projection_when_owner_is_present_mu }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_collection_index_in_projection_when_owner_is_not_present_multiple(bool async) { var prm = 1; return AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - CollectionElement1 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[1], - CollectionElement2 = x.OwnedCollectionRoot[1].OwnedCollectionBranch[1].OwnedReferenceLeaf, - CollectionElement3 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, - CollectionElement4 = x.OwnedCollectionRoot[prm].OwnedReferenceBranch, - CollectionElement5 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[x.Id], - CollectionElement6 = x.OwnedCollectionRoot[x.Id].OwnedCollectionBranch[1].OwnedReferenceLeaf, - CollectionElement7 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, - CollectionElement8 = x.OwnedCollectionRoot[x.Id].OwnedReferenceBranch, - CollectionElement9 = x.OwnedCollectionRoot[x.Id].OwnedCollectionBranch[x.Id], - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + x.Id, + CollectionElement1 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[1], + CollectionElement2 = x.OwnedCollectionRoot[1].OwnedCollectionBranch[1].OwnedReferenceLeaf, + CollectionElement3 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, + CollectionElement4 = x.OwnedCollectionRoot[prm].OwnedReferenceBranch, + CollectionElement5 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[x.Id], + CollectionElement6 = x.OwnedCollectionRoot[x.Id].OwnedCollectionBranch[1].OwnedReferenceLeaf, + CollectionElement7 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, + CollectionElement8 = x.OwnedCollectionRoot[x.Id].OwnedReferenceBranch, + CollectionElement9 = x.OwnedCollectionRoot[x.Id].OwnedCollectionBranch[x.Id], + }).AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -1674,8 +1517,7 @@ public virtual Task Json_collection_index_in_projection_when_owner_is_not_presen }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_scalar_required_null_semantics(bool async) => AssertQuery( async, @@ -1683,8 +1525,7 @@ public virtual Task Json_scalar_required_null_semantics(bool async) .Where(x => x.OwnedReferenceRoot.Number != x.OwnedReferenceRoot.Name.Length) .Select(x => x.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_scalar_optional_null_semantics(bool async) => AssertQuery( async, @@ -1692,48 +1533,42 @@ public virtual Task Json_scalar_optional_null_semantics(bool async) .Where(x => x.OwnedReferenceRoot.Name != x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething) .Select(x => x.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_on_json_scalar(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(x => x.OwnedReferenceRoot.Name).Select(x => new { x.Key, Count = x.Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_on_json_scalar_using_collection_indexer(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(x => x.OwnedCollectionRoot[0].Name).Select(x => new { x.Key, Count = x.Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_First_on_json_scalar(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(x => x.OwnedReferenceRoot.Name).Select(g => g.OrderBy(x => x.Id).First())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_FirstOrDefault_on_json_scalar(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(x => x.OwnedReferenceRoot.Name).Select(g => g.OrderBy(x => x.Id).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_Skip_Take_on_json_scalar(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(x => x.OwnedReferenceRoot.Name).Select(g => g.OrderBy(x => x.Id).Skip(1).Take(5))); - [ConditionalTheory(Skip = "issue #29287")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #29287"), MemberData(nameof(IsAsyncData))] public virtual Task Group_by_json_scalar_Orderby_json_scalar_FirstOrDefault(bool async) => AssertQuery( async, @@ -1741,23 +1576,20 @@ public virtual Task Group_by_json_scalar_Orderby_json_scalar_FirstOrDefault(bool .GroupBy(x => x.OwnedReferenceRoot.OwnedReferenceBranch.Enum) .Select(g => g.OrderBy(x => x.OwnedReferenceRoot.Number).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_json_scalar_Skip_First_project_json_scalar(bool async) => AssertQueryScalar( async, ss => ss.Set() .GroupBy(x => x.OwnedReferenceRoot.Name).Select(g => g.First().OwnedReferenceRoot.OwnedReferenceBranch.Enum)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_include_on_json_entity(bool async) => AssertQuery( async, ss => ss.Set().Include(x => x.OwnedReferenceRoot)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_include_on_entity_reference(bool async) => AssertQuery( async, @@ -1766,8 +1598,7 @@ public virtual Task Json_with_include_on_entity_reference(bool async) e, a, new ExpectedInclude(x => x.EntityReference))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_include_on_entity_collection(bool async) => AssertQuery( async, @@ -1776,8 +1607,7 @@ public virtual Task Json_with_include_on_entity_collection(bool async) e, a, new ExpectedInclude(x => x.EntityCollection))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_including_collection_with_json(bool async) => AssertQuery( async, @@ -1786,8 +1616,7 @@ public virtual Task Entity_including_collection_with_json(bool async) e, a, new ExpectedInclude(x => x.JsonEntityBasics))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_include_on_entity_collection_and_reference(bool async) => AssertQuery( async, @@ -1797,8 +1626,7 @@ public virtual Task Json_with_include_on_entity_collection_and_reference(bool as new ExpectedInclude(x => x.EntityReference), new ExpectedInclude(x => x.EntityCollection))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_projection_of_json_reference_leaf_and_entity_collection(bool async) => AssertQuery( async, @@ -1810,8 +1638,7 @@ public virtual Task Json_with_projection_of_json_reference_leaf_and_entity_colle AssertCollection(e.EntityCollection, a.EntityCollection); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_projection_of_json_reference_and_entity_collection(bool async) => AssertQuery( async, @@ -1822,20 +1649,18 @@ public virtual Task Json_with_projection_of_json_reference_and_entity_collection AssertCollection(e.EntityCollection, a.EntityCollection); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_projection_of_multiple_json_references_and_entity_collection(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - Reference1 = x.OwnedReferenceRoot, - Reference2 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, - x.EntityCollection, - Reference3 = x.OwnedCollectionRoot[1].OwnedReferenceBranch.OwnedReferenceLeaf, - Reference4 = x.OwnedCollectionRoot[0].OwnedCollectionBranch[0].OwnedReferenceLeaf, - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + Reference1 = x.OwnedReferenceRoot, + Reference2 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, + x.EntityCollection, + Reference3 = x.OwnedCollectionRoot[1].OwnedReferenceBranch.OwnedReferenceLeaf, + Reference4 = x.OwnedCollectionRoot[0].OwnedCollectionBranch[0].OwnedReferenceLeaf, + }).AsNoTracking(), elementAsserter: (e, a) => { AssertCollection(e.EntityCollection, a.EntityCollection); @@ -1845,8 +1670,7 @@ public virtual Task Json_with_projection_of_multiple_json_references_and_entity_ AssertEqual(e.Reference4, a.Reference4); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_projection_of_json_collection_leaf_and_entity_collection(bool async) => AssertQuery( async, @@ -1858,8 +1682,7 @@ public virtual Task Json_with_projection_of_json_collection_leaf_and_entity_coll AssertCollection(e.EntityCollection, a.EntityCollection); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_projection_of_json_collection_and_entity_collection(bool async) => AssertQuery( async, @@ -1870,18 +1693,16 @@ public virtual Task Json_with_projection_of_json_collection_and_entity_collectio AssertCollection(e.EntityCollection, a.EntityCollection); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_projection_of_json_collection_element_and_entity_collection(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - JsonCollectionElement = x.OwnedCollectionRoot[0], - x.EntityReference, - x.EntityCollection - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + JsonCollectionElement = x.OwnedCollectionRoot[0], + x.EntityReference, + x.EntityCollection + }).AsNoTracking(), elementAsserter: (e, a) => { AssertEqual(e.JsonCollectionElement, a.JsonCollectionElement); @@ -1889,24 +1710,22 @@ public virtual Task Json_with_projection_of_json_collection_element_and_entity_c AssertCollection(e.EntityCollection, a.EntityCollection); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_with_projection_of_mix_of_json_collections_json_references_and_entity_collection(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - Collection1 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf, - x.EntityReference, - Reference1 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, - x.EntityCollection, - Reference2 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf[0], - Collection2 = x.OwnedReferenceRoot.OwnedCollectionBranch, - Collection3 = x.OwnedCollectionRoot, - Reference3 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, - Collection4 = x.OwnedCollectionRoot[0].OwnedCollectionBranch - }).AsNoTracking(), + ss => ss.Set().Select(x => new + { + Collection1 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf, + x.EntityReference, + Reference1 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, + x.EntityCollection, + Reference2 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf[0], + Collection2 = x.OwnedReferenceRoot.OwnedCollectionBranch, + Collection3 = x.OwnedCollectionRoot, + Reference3 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, + Collection4 = x.OwnedCollectionRoot[0].OwnedCollectionBranch + }).AsNoTracking(), elementAsserter: (e, a) => { AssertCollection(e.Collection1, a.Collection1, ordered: true); @@ -1921,15 +1740,13 @@ public virtual Task Json_with_projection_of_mix_of_json_collections_json_referen AssertCollection(e.EntityCollection, a.EntityCollection); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_all_types_entity_projection(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_all_types_projection_from_owned_entity_reference(bool async) => AssertQuery( async, @@ -1937,374 +1754,325 @@ public virtual Task Json_all_types_projection_from_owned_entity_reference(bool a elementSorter: e => e.TestInt32, elementAsserter: (e, a) => AssertEqual(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_all_types_projection_individual_properties(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Reference.TestDefaultString, - x.Reference.TestMaxLengthString, - x.Reference.TestBoolean, - x.Reference.TestByte, - x.Reference.TestCharacter, - x.Reference.TestDateTime, - x.Reference.TestDateTimeOffset, - x.Reference.TestDecimal, - x.Reference.TestDouble, - x.Reference.TestGuid, - x.Reference.TestInt16, - x.Reference.TestInt32, - x.Reference.TestInt64, - x.Reference.TestSignedByte, - x.Reference.TestSingle, - x.Reference.TestTimeSpan, - x.Reference.TestDateOnly, - x.Reference.TestTimeOnly, - x.Reference.TestUnsignedInt16, - x.Reference.TestUnsignedInt32, - x.Reference.TestUnsignedInt64, - x.Reference.TestEnum, - x.Reference.TestEnumWithIntConverter, - x.Reference.TestNullableEnum, - x.Reference.TestNullableEnumWithIntConverter, - x.Reference.TestNullableEnumWithConverterThatHandlesNulls, - })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + ss => ss.Set().Select(x => new + { + x.Reference.TestDefaultString, + x.Reference.TestMaxLengthString, + x.Reference.TestBoolean, + x.Reference.TestByte, + x.Reference.TestCharacter, + x.Reference.TestDateTime, + x.Reference.TestDateTimeOffset, + x.Reference.TestDecimal, + x.Reference.TestDouble, + x.Reference.TestGuid, + x.Reference.TestInt16, + x.Reference.TestInt32, + x.Reference.TestInt64, + x.Reference.TestSignedByte, + x.Reference.TestSingle, + x.Reference.TestTimeSpan, + x.Reference.TestDateOnly, + x.Reference.TestTimeOnly, + x.Reference.TestUnsignedInt16, + x.Reference.TestUnsignedInt32, + x.Reference.TestUnsignedInt64, + x.Reference.TestEnum, + x.Reference.TestEnumWithIntConverter, + x.Reference.TestNullableEnum, + x.Reference.TestNullableEnumWithIntConverter, + x.Reference.TestNullableEnumWithConverterThatHandlesNulls, + })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_boolean_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestBoolean)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_boolean_predicate_negated(bool async) => AssertQuery( async, ss => ss.Set().Where(x => !x.Reference.TestBoolean), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_boolean_projection(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(x => x.Reference.TestBoolean)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_boolean_projection_negated(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(x => !x.Reference.TestBoolean)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_default_string(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestDefaultString != "MyDefaultStringInReference1")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_max_length_string(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestMaxLengthString != "Foo")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_string_condition(bool async) => AssertQuery( async, - ss => ss.Set().Where( - x => (!x.Reference.TestBoolean ? x.Reference.TestMaxLengthString : x.Reference.TestDefaultString) - == "MyDefaultStringInReference1")); + ss => ss.Set().Where(x + => (!x.Reference.TestBoolean ? x.Reference.TestMaxLengthString : x.Reference.TestDefaultString) + == "MyDefaultStringInReference1")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_byte(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestByte != 3)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_byte_array(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestByteArray != new byte[] { 1, 2, 3 }), ss => ss.Set().Where(x => !x.Reference.TestByteArray.SequenceEqual(new byte[] { 1, 2, 3 }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_character(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestCharacter != 'z')); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_datetime(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestDateTime != new DateTime(2000, 1, 3))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_datetimeoffset(bool async) => AssertQuery( async, - ss => ss.Set().Where( - x => x.Reference.TestDateTimeOffset != new DateTimeOffset(new DateTime(2000, 1, 4), new TimeSpan(3, 2, 0)))); + ss => ss.Set().Where(x + => x.Reference.TestDateTimeOffset != new DateTimeOffset(new DateTime(2000, 1, 4), new TimeSpan(3, 2, 0)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_decimal(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestDecimal != 1.35M)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_double(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestDouble != 33.25)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_guid(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestGuid != new Guid())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_int16(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestInt16 != 3)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_int32(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestInt32 != 33)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_int64(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestInt64 != 333)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_signedbyte(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestSignedByte != 100)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_single(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestSingle != 10.4f)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_timespan(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestTimeSpan != new TimeSpan(3, 2, 0))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_dateonly(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestDateOnly != new DateOnly(3, 2, 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_timeonly(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestTimeOnly != new TimeOnly(3, 2, 0))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_unisgnedint16(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestUnsignedInt16 != 100)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_unsignedint32(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestUnsignedInt32 != 1000)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_unsignedint64(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestUnsignedInt64 != 10000)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_enum(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestEnum != JsonEnum.Two)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_enumwithintconverter(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestEnumWithIntConverter != JsonEnum.Three)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_nullableenum1(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestNullableEnum != JsonEnum.One)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_nullableenum2(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestNullableEnum != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_nullableenumwithconverterthathandlesnulls1(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestNullableEnumWithConverterThatHandlesNulls != JsonEnum.One)); - [ConditionalTheory(Skip = "issue #29416")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #29416"), MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_nullableenumwithconverterthathandlesnulls2(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestNullableEnumWithConverterThatHandlesNulls != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_nullableenumwithconverter1(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestNullableEnumWithIntConverter != JsonEnum.Two)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_nullableenumwithconverter2(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestNullableEnumWithIntConverter != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_nullableint321(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestNullableInt32 != 100)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_nullableint322(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.TestNullableInt32 != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_bool_converted_to_int_zero_one(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.BoolConvertedToIntZeroOne)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_bool_converted_to_int_zero_one_with_explicit_comparison(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.BoolConvertedToIntZeroOne == false)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_bool_converted_to_string_True_False(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.BoolConvertedToStringTrueFalse)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_bool_converted_to_string_True_False_with_explicit_comparison(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.BoolConvertedToStringTrueFalse == true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_bool_converted_to_string_Y_N(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.BoolConvertedToStringYN)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_bool_converted_to_string_Y_N_with_explicit_comparison(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.BoolConvertedToStringYN == false)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_int_zero_one_converted_to_bool(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.IntZeroOneConvertedToBool == 1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_string_True_False_converted_to_bool(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.StringTrueFalseConvertedToBool == "False")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_predicate_on_string_Y_N_converted_to_bool(bool async) => AssertQuery( async, ss => ss.Set().Where(x => x.Reference.StringYNConvertedToBool == "N")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_collection_element_and_reference_AsNoTrackingWithIdentityResolution(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - CollectionElement = x.OwnedReferenceRoot.OwnedCollectionBranch[1], - Reference = x.OwnedReferenceRoot.OwnedReferenceBranch, - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, + CollectionElement = x.OwnedReferenceRoot.OwnedCollectionBranch[1], + Reference = x.OwnedReferenceRoot.OwnedReferenceBranch, + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2313,22 +2081,18 @@ public virtual Task Json_projection_collection_element_and_reference_AsNoTrackin AssertEqual(e.Reference, a.Reference); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_nothing_interesting_AsNoTrackingWithIdentityResolution(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new { x.Id, x.Name }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new { x.Id, x.Name }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_owner_entity_AsNoTrackingWithIdentityResolution(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new { x.Id, x }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new { x.Id, x }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2336,24 +2100,20 @@ public virtual Task Json_projection_owner_entity_AsNoTrackingWithIdentityResolut AssertEqual(e.x, a.x); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_nested_collection_anonymous_projection_of_primitives_in_projection_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot - .Select( - xx => xx.OwnedCollectionBranch.Select( - xxx => new - { - xxx.Date, - xxx.Enum, - xxx.Enums, - xxx.Fraction, - }).ToList())) + .Select(x => x.OwnedCollectionRoot + .Select(xx => xx.OwnedCollectionBranch.Select(xxx => new + { + xxx.Date, + xxx.Enum, + xxx.Enums, + xxx.Fraction, + }).ToList())) .AsNoTrackingWithIdentityResolution(), assertOrder: true, elementAsserter: (e, a) => AssertCollection( @@ -2366,20 +2126,18 @@ public virtual Task Json_nested_collection_anonymous_projection_of_primitives_in AssertEqual(eee.Fraction, aaa.Fraction); }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_second_element_through_collection_element_constant_projected_after_owner_nested_AsNoTrackingWithIdentityResolution( bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Original = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf, - Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[1], - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, + Original = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf, + Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[1], + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2388,19 +2146,17 @@ public virtual Task AssertEqual(e.Duplicate, a.Duplicate); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_reference_collection_and_collection_element_nested_AsNoTrackingWithIdentityResolution(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Reference = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedReferenceLeaf, - Collection = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf, - CollectionElement = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[1], - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, + Reference = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedReferenceLeaf, + Collection = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf, + CollectionElement = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[1], + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2410,8 +2166,7 @@ public virtual Task Json_projection_reference_collection_and_collection_element_ AssertEqual(e.CollectionElement, a.CollectionElement); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_second_element_through_collection_element_parameter_correctly_projected_after_owner_nested_AsNoTrackingWithIdentityResolution( bool async) @@ -2420,13 +2175,12 @@ public virtual Task return AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Original = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf, - Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[prm], - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, + Original = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf, + Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[prm], + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2436,18 +2190,16 @@ public virtual Task }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_only_second_element_through_collection_element_constant_projected_nested_AsNoTrackingWithIdentityResolution( bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, Element = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[1], - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, Element = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[1], + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2455,8 +2207,7 @@ public virtual Task AssertEqual(e.Element, a.Element); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_only_second_element_through_collection_element_parameter_projected_nested_AsNoTrackingWithIdentityResolution( bool async) @@ -2466,11 +2217,10 @@ public virtual Task return AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, Element = x.OwnedReferenceRoot.OwnedCollectionBranch[prm1].OwnedCollectionLeaf[prm2], - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, Element = x.OwnedReferenceRoot.OwnedCollectionBranch[prm1].OwnedCollectionLeaf[prm2], + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2479,20 +2229,18 @@ public virtual Task }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_second_element_through_collection_element_constant_different_values_projected_before_owner_nested_AsNoTrackingWithIdentityResolution( bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[1], - Original = x.OwnedReferenceRoot.OwnedCollectionBranch[1].OwnedCollectionLeaf, - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, + Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[1], + Original = x.OwnedReferenceRoot.OwnedCollectionBranch[1].OwnedCollectionLeaf, + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2501,18 +2249,16 @@ public virtual Task AssertCollection(e.Original, a.Original, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_nested_collection_and_element_correct_order_AsNoTrackingWithIdentityResolution(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Original = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf, - Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[1], - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, + Original = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf, + Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[0].OwnedCollectionLeaf[1], + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2521,8 +2267,7 @@ public virtual Task Json_projection_nested_collection_and_element_correct_order_ AssertEqual(e.Duplicate, a.Duplicate); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_nested_collection_element_using_parameter_and_the_owner_in_correct_order_AsNoTrackingWithIdentityResolution( bool async) @@ -2530,13 +2275,12 @@ public virtual Task var prm = 0; return AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Original = x.OwnedReferenceRoot, - Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[prm].OwnedCollectionLeaf[1], - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, + Original = x.OwnedReferenceRoot, + Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[prm].OwnedCollectionLeaf[1], + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2546,19 +2290,17 @@ public virtual Task }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_second_element_projected_before_owner_as_well_as_root_AsNoTrackingWithIdentityResolution(bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[1], - Original = x.OwnedReferenceRoot, - Owned = x - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, + Duplicate = x.OwnedReferenceRoot.OwnedCollectionBranch[1], + Original = x.OwnedReferenceRoot, + Owned = x + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2567,21 +2309,19 @@ public virtual Task Json_projection_second_element_projected_before_owner_as_wel AssertEqual(e.Duplicate, a.Duplicate); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Json_projection_second_element_projected_before_owner_nested_as_well_as_root_AsNoTrackingWithIdentityResolution( bool async) => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x.Id, - Duplicate = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf[1], - Original = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf, - Parent = x.OwnedReferenceRoot.OwnedReferenceBranch, - Owner = x - }).AsNoTrackingWithIdentityResolution(), + ss => ss.Set().Select(x => new + { + x.Id, + Duplicate = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf[1], + Original = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf, + Parent = x.OwnedReferenceRoot.OwnedReferenceBranch, + Owner = x + }).AsNoTrackingWithIdentityResolution(), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2591,33 +2331,29 @@ public virtual Task Json_projection_second_element_projected_before_owner_nested AssertEqual(e.Owner, a.Owner); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_json_reference_in_tracking_query_fails(bool async) // verify exception on the provider level, relational and core throw different exceptions => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedReferenceRoot)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_json_collection_in_tracking_query_fails(bool async) // verify exception on the provider level, relational and core throw different exceptions => AssertQuery( async, ss => ss.Set().Select(x => x.OwnedCollectionRoot)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_json_entity_in_tracking_query_fails_even_when_owner_is_present(bool async) // verify exception on the provider level, relational and core throw different exceptions => AssertQuery( async, - ss => ss.Set().Select( - x => new - { - x, - x.OwnedReferenceRoot, - x.OwnedCollectionRoot - })); + ss => ss.Set().Select(x => new + { + x, + x.OwnedReferenceRoot, + x.OwnedCollectionRoot + })); } diff --git a/test/EFCore.Specification.Tests/Query/ManyToManyFieldsQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/ManyToManyFieldsQueryFixtureBase.cs index b241d1129a3..ffc2e36949f 100644 --- a/test/EFCore.Specification.Tests/Query/ManyToManyFieldsQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/ManyToManyFieldsQueryFixtureBase.cs @@ -157,102 +157,88 @@ public ISetSource GetExpectedData() protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.Name); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.Name); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.Name); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.Name); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.Name); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.Name); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.LeftId); - b.Property(e => e.RightId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.LeftId); + b.Property(e => e.RightId); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id); - b.Property(e => e.Name); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id); + b.Property(e => e.Name); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id); - b.Property(e => e.Name); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id); + b.Property(e => e.Name); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.Name); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.Name); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.Name); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.Name); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.EntityOneId); - b.Property(e => e.EntityBranchId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.EntityOneId); + b.Property(e => e.EntityBranchId); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.ThreeId); - b.Property(e => e.TwoId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.ThreeId); + b.Property(e => e.TwoId); + }); - modelBuilder.Entity().HasKey( - e => new - { - e.Key1, - e.Key2, - e.Key3 - }); + modelBuilder.Entity().HasKey(e => new + { + e.Key1, + e.Key2, + e.Key3 + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.Name); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.Name); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Number); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Number); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.IsGreen); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.IsGreen); + }); modelBuilder.Entity() .HasMany(e => e.Collection) @@ -281,12 +267,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con r => r.HasOne().WithMany().HasForeignKey(e => e.TwoId), l => l.HasOne().WithMany().HasForeignKey(e => e.OneId)); - modelBuilder.Entity( - b => - { - b.Property(e => e.OneId); - b.Property(e => e.ThreeId); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.OneId); + b.Property(e => e.ThreeId); + }); // Nav:6 Payload:Yes Join:Concrete Extra:None modelBuilder.Entity() @@ -353,13 +338,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .HasMany(e => e.CompositeKeySkipFull) .WithMany(e => e.ThreeSkipFull) .UsingEntity( - l => l.HasOne(x => x.Composite).WithMany(x => x.JoinThreeFull).HasForeignKey( - e => new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - }).IsRequired(), + l => l.HasOne(x => x.Composite).WithMany(x => x.JoinThreeFull).HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + }).IsRequired(), r => r.HasOne(x => x.Three).WithMany(x => x.JoinCompositeKeyFull).IsRequired(), b => { @@ -381,13 +365,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .WithMany(e => e.CompositeKeySkipFull) .UsingEntity( r => r.HasOne(x => x.Leaf).WithMany(x => x.JoinCompositeKeyFull), - l => l.HasOne(x => x.Composite).WithMany(x => x.JoinLeafFull).HasForeignKey( - e => new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - })); + l => l.HasOne(x => x.Composite).WithMany(x => x.JoinLeafFull).HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + })); modelBuilder.SharedTypeEntity( "PST", b => diff --git a/test/EFCore.Specification.Tests/Query/ManyToManyNoTrackingQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/ManyToManyNoTrackingQueryTestBase.cs index 57770c03ac0..21887f1bf93 100644 --- a/test/EFCore.Specification.Tests/Query/ManyToManyNoTrackingQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/ManyToManyNoTrackingQueryTestBase.cs @@ -40,20 +40,18 @@ static Expression ApplyNoTracking(Expression source) source); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_skip_navigation_then_include_inverse_throws_in_no_tracking(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle(nameof(EntityThree.OneSkipPayloadFullShared), nameof(EntityOne.ThreeSkipPayloadFullShared)), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().AsNoTracking().Include(e => e.OneSkipPayloadFullShared) - .ThenInclude(e => e.ThreeSkipPayloadFullShared), - elementAsserter: (e, a) => AssertInclude( - e, a, - new ExpectedInclude(et => et.OneSkipPayloadFullShared), - new ExpectedInclude(et => et.ThreeSkipPayloadFullShared, "OneSkipPayloadFullShared"))))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().AsNoTracking().Include(e => e.OneSkipPayloadFullShared) + .ThenInclude(e => e.ThreeSkipPayloadFullShared), + elementAsserter: (e, a) => AssertInclude( + e, a, + new ExpectedInclude(et => et.OneSkipPayloadFullShared), + new ExpectedInclude(et => et.ThreeSkipPayloadFullShared, "OneSkipPayloadFullShared"))))).Message); public override Task Include_skip_navigation_then_include_inverse_works_for_tracking_query(bool async) => Task.CompletedTask; diff --git a/test/EFCore.Specification.Tests/Query/ManyToManyQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/ManyToManyQueryFixtureBase.cs index 51c07ff117c..cf7ebf60b40 100644 --- a/test/EFCore.Specification.Tests/Query/ManyToManyQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/ManyToManyQueryFixtureBase.cs @@ -348,13 +348,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); - modelBuilder.Entity().HasKey( - e => new - { - e.Key1, - e.Key2, - e.Key3 - }); + modelBuilder.Entity().HasKey(e => new + { + e.Key1, + e.Key2, + e.Key3 + }); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().HasBaseType(); modelBuilder.Entity().HasBaseType(); @@ -366,13 +365,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); - modelBuilder.Entity().HasKey( - e => new - { - e.Key1, - e.Key2, - e.Key3 - }); + modelBuilder.Entity().HasKey(e => new + { + e.Key1, + e.Key2, + e.Key3 + }); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().HasBaseType(); modelBuilder.Entity().HasBaseType(); @@ -478,13 +476,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .HasMany(e => e.CompositeKeySkipFull) .WithMany(e => e.ThreeSkipFull) .UsingEntity( - l => l.HasOne(x => x.Composite).WithMany(x => x.JoinThreeFull).HasForeignKey( - e => new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - }).IsRequired(), + l => l.HasOne(x => x.Composite).WithMany(x => x.JoinThreeFull).HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + }).IsRequired(), r => r.HasOne(x => x.Three).WithMany(x => x.JoinCompositeKeyFull).IsRequired()); // Nav:2 Payload:No Join:Shared Extra:Inheritance @@ -503,13 +500,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .WithMany(e => e.CompositeKeySkipFull) .UsingEntity( r => r.HasOne(x => x.Leaf).WithMany(x => x.JoinCompositeKeyFull), - l => l.HasOne(x => x.Composite).WithMany(x => x.JoinLeafFull).HasForeignKey( - e => new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - })); + l => l.HasOne(x => x.Composite).WithMany(x => x.JoinLeafFull).HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + })); modelBuilder.Entity() .HasMany(e => e.Collection) @@ -600,13 +596,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .HasMany() .WithMany(e => e.ThreeSkipFull) .UsingEntity( - l => l.HasOne(x => x.Composite).WithMany(x => x.JoinThreeFull).HasForeignKey( - e => new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - }).IsRequired(), + l => l.HasOne(x => x.Composite).WithMany(x => x.JoinThreeFull).HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + }).IsRequired(), r => r.HasOne(x => x.Three).WithMany(x => x.JoinCompositeKeyFull).IsRequired()); // Nav:2 Payload:No Join:Shared Extra:Inheritance @@ -625,13 +620,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .WithMany(e => e.CompositeKeySkipFull) .UsingEntity( r => r.HasOne(x => x.Leaf).WithMany(x => x.JoinCompositeKeyFull), - l => l.HasOne(x => x.Composite).WithMany(x => x.JoinLeafFull).HasForeignKey( - e => new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - })); + l => l.HasOne(x => x.Composite).WithMany(x => x.JoinLeafFull).HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + })); modelBuilder.SharedTypeEntity( "PST", b => diff --git a/test/EFCore.Specification.Tests/Query/ManyToManyQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/ManyToManyQueryTestBase.cs index af72557c68b..7580293d42e 100644 --- a/test/EFCore.Specification.Tests/Query/ManyToManyQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/ManyToManyQueryTestBase.cs @@ -10,46 +10,40 @@ namespace Microsoft.EntityFrameworkCore.Query; public abstract class ManyToManyQueryTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : ManyToManyQueryFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_all(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.TwoSkip.All(e => e.Name.Contains("B")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_any_without_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.ThreeSkipPayloadFull.Where(e => e.Name.Contains("B")).Any()), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_any_with_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.TwoSkipShared.Any(e => e.Name.Contains("B"))), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_contains(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.ThreeSkipPayloadFullShared.Contains(new EntityThree { Id = 1 })), ss => ss.Set().Where(e => e.ThreeSkipPayloadFullShared.Select(i => i.Id).Contains(1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_count_without_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.SelfSkipPayloadLeft.Count > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_count_with_predicate(bool async) => AssertQuery( async, @@ -57,15 +51,13 @@ public virtual Task Skip_navigation_count_with_predicate(bool async) .ThenBy(e => e.Id), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_long_count_without_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.ThreeSkipFull.LongCount() > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_long_count_with_predicate(bool async) => AssertQuery( async, @@ -73,92 +65,79 @@ public virtual Task Skip_navigation_long_count_with_predicate(bool async) .ThenBy(e => e.Id), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_select_many_average(bool async) => AssertAverage( async, ss => ss.Set().SelectMany(e => e.CompositeKeySkipShared.Select(e => e.Key1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_select_many_max(bool async) => AssertMax( async, ss => ss.Set().SelectMany(e => e.CompositeKeySkipFull.Select(e => e.Key1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_select_many_min(bool async) => AssertMin( async, ss => ss.Set().SelectMany(e => e.RootSkipShared.Select(e => e.Id))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_select_many_sum(bool async) => AssertSum( async, ss => ss.Set().SelectMany(e => e.CompositeKeySkipShared.Select(e => e.Key1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_select_subquery_average(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => e.CompositeKeySkipFull.Average(e => e.Key1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_select_subquery_max(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => e.OneSkip.Max(e => e.Id))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_select_subquery_min(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => e.OneSkipPayloadFull.Min(e => e.Id))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_select_subquery_sum(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => e.OneSkipShared.Sum(e => e.Id))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_order_by_first_or_default(bool async) => AssertQuery( async, ss => ss.Set().Select(e => e.OneSkipPayloadFullShared.OrderBy(i => i.Id).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_order_by_single_or_default(bool async) => AssertQuery( async, ss => ss.Set().Select(e => e.SelfSkipPayloadRight.OrderBy(i => i.Id).Take(1).SingleOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_order_by_last_or_default(bool async) => AssertQuery( async, ss => ss.Set().Select(e => e.OneSkip.OrderBy(i => i.Id).LastOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_order_by_reverse_first_or_default(bool async) => AssertQuery( async, ss => ss.Set().Select(e => e.TwoSkipFull.OrderBy(i => i.Id).Reverse().FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_cast(bool async) => AssertQuery( async, @@ -166,8 +145,7 @@ public virtual Task Skip_navigation_cast(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_of_type(bool async) => AssertQuery( async, @@ -175,8 +153,7 @@ public virtual Task Skip_navigation_of_type(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_skip_navigation(bool async) => AssertQuery( async, @@ -191,8 +168,7 @@ on t.Id equals s.SelfSkipSharedRight.OrderBy(e => e.Id).FirstOrDefault().Id AssertEqual(e.s, a.s); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_with_skip_navigation(bool async) => AssertQuery( async, @@ -217,8 +193,7 @@ from s in grouping.DefaultIfEmpty() AssertEqual(e.s, a.s); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation(bool async) => AssertQuery( async, @@ -226,8 +201,7 @@ public virtual Task Select_many_over_skip_navigation(bool async) from t in r.ThreeSkipShared select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_where(bool async) => AssertQuery( async, @@ -235,8 +209,7 @@ public virtual Task Select_many_over_skip_navigation_where(bool async) from t in r.TwoSkip.DefaultIfEmpty() select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_order_by_skip(bool async) => AssertQuery( async, @@ -244,8 +217,7 @@ public virtual Task Select_many_over_skip_navigation_order_by_skip(bool async) from t in r.ThreeSkipPayloadFull.OrderBy(e => e.Id).Skip(2) select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_order_by_take(bool async) => AssertQuery( async, @@ -253,8 +225,7 @@ public virtual Task Select_many_over_skip_navigation_order_by_take(bool async) from t in r.TwoSkipShared.OrderBy(e => e.Id).Take(2) select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_order_by_skip_take(bool async) => AssertQuery( async, @@ -262,8 +233,7 @@ public virtual Task Select_many_over_skip_navigation_order_by_skip_take(bool asy from t in r.ThreeSkipPayloadFullShared.OrderBy(e => e.Id).Skip(2).Take(3) select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_of_type(bool async) => AssertQuery( async, @@ -271,8 +241,7 @@ public virtual Task Select_many_over_skip_navigation_of_type(bool async) from t in r.RootSkipShared.OfType() select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_cast(bool async) => AssertQuery( async, @@ -280,8 +249,7 @@ public virtual Task Select_many_over_skip_navigation_cast(bool async) from t in r.BranchSkip.Cast() select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_skip_navigation(bool async) => AssertQuery( async, @@ -291,8 +259,7 @@ orderby r.Id assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_skip_navigation_multiple(bool async) => AssertQuery( async, @@ -312,8 +279,7 @@ orderby r.Id AssertCollection(e.CompositeKeySkipShared, a.CompositeKeySkipShared); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_skip_navigation_first_or_default(bool async) => AssertQuery( async, @@ -322,16 +288,14 @@ orderby r.Id select r.CompositeKeySkipFull.OrderBy(e => e.Key1).ThenBy(e => e.Key2).FirstOrDefault(), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation(bool async) => AssertQuery( async, ss => ss.Set().Include(e => e.RootSkipShared), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(et => et.RootSkipShared))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_then_reference(bool async) => AssertQuery( async, @@ -341,8 +305,7 @@ public virtual Task Include_skip_navigation_then_reference(bool async) new ExpectedInclude(et => et.OneSkip), new ExpectedInclude(et => et.Reference, "OneSkip"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_then_include_skip_navigation(bool async) => AssertQuery( async, @@ -352,8 +315,7 @@ public virtual Task Include_skip_navigation_then_include_skip_navigation(bool as new ExpectedInclude(et => et.LeafSkipFull), new ExpectedInclude(et => et.OneSkip, "LeafSkipFull"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_then_include_reference_and_skip_navigation(bool async) => AssertQuery( async, @@ -365,8 +327,7 @@ public virtual Task Include_skip_navigation_then_include_reference_and_skip_navi new ExpectedInclude(et => et.Reference, "OneSkipPayloadFull"), new ExpectedInclude(et => et.SelfSkipPayloadRight, "OneSkipPayloadFull"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_and_reference(bool async) => AssertQuery( async, @@ -376,8 +337,7 @@ public virtual Task Include_skip_navigation_and_reference(bool async) new ExpectedInclude(et => et.OneSkipShared), new ExpectedInclude(et => et.Reference))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_then_include_inverse_works_for_tracking_query(bool async) => AssertQuery( async, @@ -387,8 +347,7 @@ public virtual Task Include_skip_navigation_then_include_inverse_works_for_track new ExpectedInclude(et => et.OneSkipPayloadFullShared), new ExpectedInclude(et => et.ThreeSkipPayloadFullShared, "OneSkipPayloadFullShared"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_where(bool async) => AssertQuery( async, @@ -398,8 +357,7 @@ public virtual Task Filtered_include_skip_navigation_where(bool async) new ExpectedFilteredInclude( et => et.OneSkipPayloadFullShared, includeFilter: x => x.Where(i => i.Id < 10)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by(bool async) => AssertQuery( async, @@ -409,8 +367,7 @@ public virtual Task Filtered_include_skip_navigation_order_by(bool async) new ExpectedFilteredInclude( et => et.TwoSkipFull, includeFilter: x => x.OrderBy(i => i.Id)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by_skip(bool async) => AssertQuery( async, @@ -420,8 +377,7 @@ public virtual Task Filtered_include_skip_navigation_order_by_skip(bool async) new ExpectedFilteredInclude( et => et.SelfSkipSharedRight, includeFilter: x => x.OrderBy(i => i.Id).Skip(2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by_take(bool async) => AssertQuery( async, @@ -431,20 +387,18 @@ public virtual Task Filtered_include_skip_navigation_order_by_take(bool async) new ExpectedFilteredInclude( et => et.TwoSkipShared, includeFilter: x => x.OrderBy(i => i.Id).Take(2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by_take_EF_Property(bool async) => AssertQuery( async, - ss => ss.Set().Include( - e => EF.Property>(e, "TwoSkipShared").OrderBy(i => i.Id).Take(2)), + ss => ss.Set() + .Include(e => EF.Property>(e, "TwoSkipShared").OrderBy(i => i.Id).Take(2)), elementAsserter: (e, a) => AssertInclude( e, a, new ExpectedFilteredInclude( et => et.TwoSkipShared, includeFilter: x => x.OrderBy(i => i.Id).Take(2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by_skip_take(bool async) => AssertQuery( async, @@ -454,8 +408,7 @@ public virtual Task Filtered_include_skip_navigation_order_by_skip_take(bool asy new ExpectedFilteredInclude( et => et.ThreeSkipFull, includeFilter: x => x.OrderBy(i => i.Id).Skip(1).Take(2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_then_include_skip_navigation_where(bool async) => AssertQuery( async, @@ -467,8 +420,7 @@ public virtual Task Filtered_then_include_skip_navigation_where(bool async) new ExpectedFilteredInclude( et => et.OneSkipPayloadFullShared, "ThreeSkipShared", includeFilter: x => x.Where(i => i.Id < 10)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_then_include_skip_navigation_order_by_skip_take(bool async) => AssertQuery( async, @@ -480,8 +432,7 @@ public virtual Task Filtered_then_include_skip_navigation_order_by_skip_take(boo new ExpectedFilteredInclude( et => et.ThreeSkipFull, "CompositeKeySkipShared", includeFilter: x => x.OrderBy(i => i.Id).Skip(1).Take(2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_where_then_include_skip_navigation(bool async) => AssertQuery( async, @@ -492,8 +443,7 @@ public virtual Task Filtered_include_skip_navigation_where_then_include_skip_nav et => et.CompositeKeySkipFull, includeFilter: x => x.Where(i => i.Key1 < 5)), new ExpectedInclude(et => et.TwoSkipShared, "CompositeKeySkipFull"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by_skip_take_then_include_skip_navigation_where(bool async) => AssertQuery( async, @@ -506,14 +456,13 @@ public virtual Task Filtered_include_skip_navigation_order_by_skip_take_then_inc new ExpectedFilteredInclude( et => et.ThreeSkipFull, "TwoSkip", includeFilter: x => x.Where(i => i.Id < 10)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by_skip_take_then_include_skip_navigation_where_EF_Property(bool async) => AssertQuery( async, ss => ss.Set().Include(e => EF.Property>(e, "TwoSkip").OrderBy(i => i.Id).Skip(1).Take(2)) - .ThenInclude>( - e => EF.Property>(e, "ThreeSkipFull").Where(i => i.Id < 10)), + .ThenInclude>(e + => EF.Property>(e, "ThreeSkipFull").Where(i => i.Id < 10)), elementAsserter: (e, a) => AssertInclude( e, a, new ExpectedFilteredInclude( @@ -521,8 +470,7 @@ public virtual Task Filtered_include_skip_navigation_order_by_skip_take_then_inc new ExpectedFilteredInclude( et => et.ThreeSkipFull, "TwoSkip", includeFilter: x => x.Where(i => i.Id < 10)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_where_then_include_skip_navigation_order_by_skip_take(bool async) => AssertQuery( async, @@ -535,8 +483,7 @@ public virtual Task Filtered_include_skip_navigation_where_then_include_skip_nav new ExpectedFilteredInclude( et => et.ThreeSkipFull, "TwoSkip", includeFilter: x => x.OrderBy(i => i.Id).Skip(1).Take(2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_include_on_skip_navigation_combined(bool async) => AssertQuery( async, @@ -548,8 +495,7 @@ public virtual Task Filter_include_on_skip_navigation_combined(bool async) new ExpectedInclude(et => et.Reference, "OneSkip"), new ExpectedInclude(et => et.Collection, "OneSkip"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_include_on_skip_navigation_combined_with_filtered_then_includes(bool async) => AssertQuery( async, @@ -565,39 +511,34 @@ public virtual Task Filter_include_on_skip_navigation_combined_with_filtered_the new ExpectedFilteredInclude( et => et.BranchSkip, "OneSkipPayloadFull", includeFilter: x => x.Where(e => e.Id < 20)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Throws_when_different_filtered_include(bool async) => Assert.Equal( CoreStrings.MultipleFilteredIncludesOnSameNavigation( "navigation .Where(i => i.Id < 20)", "navigation .Where(i => i.Id < 10)") .Replace("\r", "").Replace("\n", ""), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(e => e.OneSkip.Where(i => i.Id < 10)).ThenInclude(e => e.BranchSkip) - .Include(e => e.OneSkip.Where(i => i.Id < 20)).ThenInclude(e => e.ThreeSkipPayloadFull)))).Message + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(e => e.OneSkip.Where(i => i.Id < 10)).ThenInclude(e => e.BranchSkip) + .Include(e => e.OneSkip.Where(i => i.Id < 20)).ThenInclude(e => e.ThreeSkipPayloadFull)))).Message .Replace("\r", "").Replace("\n", "")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Throws_when_different_filtered_then_include(bool async) => Assert.Equal( CoreStrings.MultipleFilteredIncludesOnSameNavigation( "navigation .Where(i => i.Id < 20)", "navigation .Where(i => i.Id < 10)") .Replace("\r", "").Replace("\n", ""), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Include(e => e.TwoSkipShared) - .ThenInclude(e => e.OneSkip.Where(i => i.Id < 10)).ThenInclude(e => e.BranchSkip) - .Include(e => e.TwoSkipShared) - .ThenInclude(e => e.OneSkip.Where(i => i.Id < 20)).ThenInclude(e => e.ThreeSkipPayloadFull)))).Message + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Include(e => e.TwoSkipShared) + .ThenInclude(e => e.OneSkip.Where(i => i.Id < 10)).ThenInclude(e => e.BranchSkip) + .Include(e => e.TwoSkipShared) + .ThenInclude(e => e.OneSkip.Where(i => i.Id < 20)).ThenInclude(e => e.ThreeSkipPayloadFull)))).Message .Replace("\r", "").Replace("\n", "")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_on_skip_navigation_then_filtered_include_on_navigation(bool async) => AssertQuery( async, @@ -610,8 +551,7 @@ public virtual Task Filtered_include_on_skip_navigation_then_filtered_include_on new ExpectedFilteredInclude( et => et.Collection, "OneSkipPayloadFull", includeFilter: x => x.Where(i => i.Id < 5)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_on_navigation_then_filtered_include_on_skip_navigation(bool async) => AssertQuery( async, @@ -623,8 +563,7 @@ public virtual Task Filtered_include_on_navigation_then_filtered_include_on_skip new ExpectedFilteredInclude( et => et.ThreeSkipFull, "Collection", includeFilter: x => x.Where(i => i.Id < 5)))); - [ConditionalTheory(Skip = "Issue#21332")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#21332"), MemberData(nameof(IsAsyncData))] public virtual Task Includes_accessed_via_different_path_are_merged(bool async) => AssertQuery( async, @@ -640,8 +579,7 @@ public virtual Task Includes_accessed_via_different_path_are_merged(bool async) new ExpectedInclude(e => e.ReferenceInverse, "ThreeSkipPayloadFull"), new ExpectedInclude(e => e.CollectionInverse, "JoinThreePayloadFull.Three"))); - [ConditionalTheory(Skip = "Issue#21332")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#21332"), MemberData(nameof(IsAsyncData))] public virtual Task Filtered_includes_accessed_via_different_path_are_merged(bool async) => AssertQuery( async, @@ -660,26 +598,23 @@ public virtual Task Filtered_includes_accessed_via_different_path_are_merged(boo new ExpectedInclude(e => e.Reference, "OneSkipPayloadFull.Collection"), new ExpectedInclude(e => e.Reference, "JoinOnePayloadFull.One.Collection"))); - [ConditionalTheory(Skip = "Issue#21332")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#21332"), MemberData(nameof(IsAsyncData))] public virtual async Task Throws_when_different_filtered_then_include_via_different_paths(bool async) => Assert.Equal( CoreStrings.MultipleFilteredIncludesOnSameNavigation( "navigation .Where(i => i.Id < 20)", "navigation .Where(i => i.Id < 10)") .Replace("\r", "").Replace("\n", ""), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Include(e => e.OneSkipPayloadFull) - .ThenInclude(e => e.Collection.Where(i => i.Id < 20)) - .Include(e => e.JoinOnePayloadFull) - .ThenInclude(e => e.One) - .ThenInclude(e => e.Collection.Where(i => i.Id < 10))))).Message + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Include(e => e.OneSkipPayloadFull) + .ThenInclude(e => e.Collection.Where(i => i.Id < 20)) + .Include(e => e.JoinOnePayloadFull) + .ThenInclude(e => e.One) + .ThenInclude(e => e.Collection.Where(i => i.Id < 10))))).Message .Replace("\r", "").Replace("\n", "")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_where_non_equality(bool async) => AssertQuery( async, @@ -687,8 +622,7 @@ public virtual Task Select_many_over_skip_navigation_where_non_equality(bool asy from t in r.TwoSkip.Where(x => x.Id != r.Id).DefaultIfEmpty() select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_on_skip_collection_navigation(bool async) { var two = new EntityTwo { Id = 1 }; @@ -699,52 +633,45 @@ public virtual Task Contains_on_skip_collection_navigation(bool async) ss => ss.Set().Where(e => e.TwoSkip.Select(i => i.Id).Contains(two.Id))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_base_type(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(EntityRoot))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_intermediate_type(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(EntityBranch))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_leaf_type(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(EntityLeaf))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_querying_base_type(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(EntityRoot)), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_all_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.TwoSkip.All(e => e.Name.Contains("B")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_any_with_predicate_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.TwoSkipShared.Any(e => e.Name.Contains("B"))), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_contains_unidirectional(bool async) => AssertQuery( async, @@ -752,15 +679,13 @@ public virtual Task Skip_navigation_contains_unidirectional(bool async) .Where(e => e.ThreeSkipPayloadFullShared.Contains(new UnidirectionalEntityThree { Id = 1 })), ss => ss.Set().Where(e => e.ThreeSkipPayloadFullShared.Select(i => i.Id).Contains(1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_count_without_predicate_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.SelfSkipPayloadLeft.Count > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_count_with_predicate_unidirectional(bool async) => AssertQuery( async, @@ -768,22 +693,19 @@ public virtual Task Skip_navigation_count_with_predicate_unidirectional(bool asy .ThenBy(e => e.Id), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_select_subquery_average_unidirectional(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => e.CompositeKeySkipFull.Average(e => e.Key1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_order_by_reverse_first_or_default_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Select(e => e.TwoSkipFull.OrderBy(i => i.Id).Reverse().FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_navigation_of_type_unidirectional(bool async) => AssertQuery( async, @@ -792,8 +714,7 @@ public virtual Task Skip_navigation_of_type_unidirectional(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_skip_navigation_unidirectional(bool async) => AssertQuery( async, @@ -808,8 +729,7 @@ on t.Id equals s.SelfSkipSharedRight.OrderBy(e => e.Id).FirstOrDefault().Id AssertEqual(e.s, a.s); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_with_skip_navigation_unidirectional(bool async) => AssertQuery( async, @@ -834,8 +754,7 @@ from s in grouping.DefaultIfEmpty() AssertEqual(e.s, a.s); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_unidirectional(bool async) => AssertQuery( async, @@ -843,8 +762,7 @@ public virtual Task Select_many_over_skip_navigation_unidirectional(bool async) from t in r.ThreeSkipShared select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_where_unidirectional(bool async) => AssertQuery( async, @@ -852,8 +770,7 @@ public virtual Task Select_many_over_skip_navigation_where_unidirectional(bool a from t in r.TwoSkip.DefaultIfEmpty() select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_order_by_take_unidirectional(bool async) => AssertQuery( async, @@ -861,8 +778,7 @@ public virtual Task Select_many_over_skip_navigation_order_by_take_unidirectiona from t in r.TwoSkipShared.OrderBy(e => e.Id).Take(2) select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_order_by_skip_take_unidirectional(bool async) => AssertQuery( async, @@ -870,8 +786,7 @@ public virtual Task Select_many_over_skip_navigation_order_by_skip_take_unidirec from t in r.ThreeSkipPayloadFullShared.OrderBy(e => e.Id).Skip(2).Take(3) select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_cast_unidirectional(bool async) => AssertQuery( async, @@ -879,8 +794,7 @@ public virtual Task Select_many_over_skip_navigation_cast_unidirectional(bool as from t in r.BranchSkip.Cast() select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_skip_navigation_unidirectional(bool async) => AssertQuery( async, @@ -890,52 +804,45 @@ orderby r.Id assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Include(e => e.RootSkipShared), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(et => et.RootSkipShared))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_then_reference_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Include("UnidirectionalEntityOne1.Reference")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_then_include_skip_navigation_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Include("UnidirectionalEntityLeaf.UnidirectionalEntityOne")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_then_include_reference_and_skip_navigation_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Include("UnidirectionalEntityOne.Reference") .Include("UnidirectionalEntityOne.UnidirectionalEntityOne")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_and_reference_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Include("UnidirectionalEntityOne").Include(e => e.Reference)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_skip_navigation_then_include_inverse_works_for_tracking_query_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Include("UnidirectionalEntityOne1.ThreeSkipPayloadFullShared")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_where_unidirectional(bool async) => AssertQuery( async, @@ -945,8 +852,7 @@ public virtual Task Filtered_include_skip_navigation_where_unidirectional(bool a new ExpectedFilteredInclude( et => et.OneSkipPayloadFullShared, includeFilter: x => x.Where(i => i.Id < 10)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by_unidirectional(bool async) => AssertQuery( async, @@ -956,8 +862,7 @@ public virtual Task Filtered_include_skip_navigation_order_by_unidirectional(boo new ExpectedFilteredInclude( et => et.TwoSkipFull, includeFilter: x => x.OrderBy(i => i.Id)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by_skip_unidirectional(bool async) => AssertQuery( async, @@ -967,8 +872,7 @@ public virtual Task Filtered_include_skip_navigation_order_by_skip_unidirectiona new ExpectedFilteredInclude( et => et.SelfSkipSharedRight, includeFilter: x => x.OrderBy(i => i.Id).Skip(2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by_take_unidirectional(bool async) => AssertQuery( async, @@ -978,8 +882,7 @@ public virtual Task Filtered_include_skip_navigation_order_by_take_unidirectiona new ExpectedFilteredInclude( et => et.TwoSkipShared, includeFilter: x => x.OrderBy(i => i.Id).Take(2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_order_by_skip_take_unidirectional(bool async) => AssertQuery( async, @@ -989,8 +892,7 @@ public virtual Task Filtered_include_skip_navigation_order_by_skip_take_unidirec new ExpectedFilteredInclude( et => et.ThreeSkipFull, includeFilter: x => x.OrderBy(i => i.Id).Skip(1).Take(2)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_skip_navigation_where_then_include_skip_navigation_unidirectional(bool async) => AssertQuery( async, @@ -1002,42 +904,37 @@ public virtual Task Filtered_include_skip_navigation_where_then_include_skip_nav et => et.CompositeKeySkipFull, includeFilter: x => x.Where(i => i.Key1 < 5)), new ExpectedInclude(et => et.TwoSkipShared, "CompositeKeySkipFull"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_include_on_skip_navigation_combined_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Include(e => e.OneSkip.Where(i => i.Id < 10)).ThenInclude(e => e.Reference) .Include(e => e.OneSkip).ThenInclude(e => e.Collection)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Throws_when_different_filtered_include_unidirectional(bool async) => Assert.Equal( CoreStrings.MultipleFilteredIncludesOnSameNavigation( "navigation .Where(i => i.Id < 20)", "navigation .Where(i => i.Id < 10)") .Replace("\r", "").Replace("\n", ""), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Include(e => EF.Property>(e, "UnidirectionalEntityOne").Where(i => i.Id < 10)) - .ThenInclude(e => e.BranchSkip) - .Include(e => EF.Property>(e, "UnidirectionalEntityOne").Where(i => i.Id < 20)) - .ThenInclude>( - e => EF.Property>(e, "UnidirectionalEntityThree"))))).Message + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Include(e => EF.Property>(e, "UnidirectionalEntityOne").Where(i => i.Id < 10)) + .ThenInclude(e => e.BranchSkip) + .Include(e => EF.Property>(e, "UnidirectionalEntityOne").Where(i => i.Id < 20)) + .ThenInclude>(e + => EF.Property>(e, "UnidirectionalEntityThree"))))).Message .Replace("\r", "").Replace("\n", "")); - [ConditionalTheory(Skip = "Issue#21332")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#21332"), MemberData(nameof(IsAsyncData))] public virtual Task Includes_accessed_via_different_path_are_merged_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Include("ThreeSkipPayloadFull.CollectionInverse") .Include(e => e.JoinThreePayloadFull).ThenInclude(e => e.Three).ThenInclude(e => e.ReferenceInverse)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_over_skip_navigation_where_non_equality_unidirectional(bool async) => AssertQuery( async, @@ -1045,8 +942,7 @@ public virtual Task Select_many_over_skip_navigation_where_non_equality_unidirec from t in r.TwoSkip.Where(x => x.Id != r.Id).DefaultIfEmpty() select t); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_on_skip_collection_navigation_unidirectional(bool async) { var two = new UnidirectionalEntityTwo { Id = 1 }; @@ -1057,29 +953,25 @@ public virtual Task Contains_on_skip_collection_navigation_unidirectional(bool a ss => ss.Set().Where(e => e.TwoSkip.Select(i => i.Id).Contains(two.Id))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_base_type_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(UnidirectionalEntityRoot))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_intermediate_type_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(UnidirectionalEntityBranch))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_leaf_type_unidirectional(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.GetType() == typeof(UnidirectionalEntityLeaf))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_in_hierarchy_in_querying_base_type_unidirectional(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/NonSharedPrimitiveCollectionsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NonSharedPrimitiveCollectionsQueryTestBase.cs index e744a0cb034..0fe3f76ce6e 100644 --- a/test/EFCore.Specification.Tests/Query/NonSharedPrimitiveCollectionsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NonSharedPrimitiveCollectionsQueryTestBase.cs @@ -5,7 +5,8 @@ namespace Microsoft.EntityFrameworkCore.Query; using static Expression; -public abstract class NonSharedPrimitiveCollectionsQueryTestBase(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture +public abstract class NonSharedPrimitiveCollectionsQueryTestBase(NonSharedFixture fixture) + : NonSharedModelTestBase(fixture), IClassFixture { #region Support for specific element types @@ -98,9 +99,8 @@ private enum MyEnum { Label1, Label2 } [ConditionalFact] public virtual async Task Multidimensional_array_is_not_supported() { - var exception = await Assert.ThrowsAsync( - () => InitializeAsync( - onModelCreating: mb => mb.Entity().Property(typeof(int[,]), "MultidimensionalArray"))); + var exception = await Assert.ThrowsAsync(() => InitializeAsync( + onModelCreating: mb => mb.Entity().Property(typeof(int[,]), "MultidimensionalArray"))); Assert.Equal(CoreStrings.PropertyNotMapped("int[,]", "TestEntity", "MultidimensionalArray"), exception.Message); } @@ -181,8 +181,8 @@ public virtual async Task Constant_with_inferred_value_converter() await using var context = contextFactory.CreateContext(); var result = await context.Set() - .SingleAsync( - m => new IntWrapper[] { new(1), new(8) }.Count(i => i == EF.Property(m, "PropertyWithValueConverter")) == 1); + .SingleAsync(m + => new IntWrapper[] { new(1), new(8) }.Count(i => i == EF.Property(m, "PropertyWithValueConverter")) == 1); Assert.Equal(1, result.Id); } @@ -214,12 +214,11 @@ public virtual async Task Inline_collection_in_query_filter() public virtual async Task Project_collection_from_entity_type_with_owned() { var contextFactory = await InitializeAsync( - onModelCreating: mb => mb.Entity( - b => - { - b.Property(b => b.Id).ValueGeneratedNever(); - b.OwnsOne(b => b.Owned); - }), + onModelCreating: mb => mb.Entity(b => + { + b.Property(b => b.Id).ValueGeneratedNever(); + b.OwnsOne(b => b.Owned); + }), seed: context => { context.AddRange( diff --git a/test/EFCore.Specification.Tests/Query/NorthwindAggregateOperatorsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindAggregateOperatorsQueryTestBase.cs index 7dd82e85d64..165fbb6a5de 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindAggregateOperatorsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindAggregateOperatorsQueryTestBase.cs @@ -21,8 +21,7 @@ protected virtual void ClearLog() { } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_All(bool async) => AssertAll( async, @@ -55,60 +54,52 @@ public override int GetHashCode() => Order.GetHashCode(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_no_arg(bool async) => AssertSum( async, ss => ss.Set().Select(o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_no_data_cast_to_nullable(bool async) => AssertSum( async, ss => ss.Set().Where(o => o.OrderID < 0).Select(o => (int?)o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_no_data_nullable(bool async) => AssertSum( async, ss => ss.Set(), selector: o => o.SupplierID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_binary_expression(bool async) => AssertSum( async, ss => ss.Set().Select(o => o.OrderID * 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_no_arg_empty(bool async) => AssertSum( async, ss => ss.Set().Where(o => o.OrderID == 42).Select(o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_arg(bool async) => AssertSum( async, ss => ss.Set(), selector: o => o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_arg_expression(bool async) => AssertSum( async, ss => ss.Set(), selector: o => o.OrderID + o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_division_on_decimal(bool async) => AssertSum( async, @@ -116,8 +107,7 @@ public virtual Task Sum_with_division_on_decimal(bool async) selector: od => od.Quantity / 2.09m, asserter: (e, a) => Assert.InRange(e - a, -0.1m, 0.1m)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_division_on_decimal_no_significant_digits(bool async) => AssertSum( async, @@ -125,40 +115,35 @@ public virtual Task Sum_with_division_on_decimal_no_significant_digits(bool asyn selector: od => od.Quantity / 2m, asserter: (e, a) => Assert.InRange(e - a, -0.1m, 0.1m)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_coalesce(bool async) => AssertSum( async, ss => ss.Set().Where(p => p.ProductID < 40), selector: p => p.UnitPrice ?? 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_subquery(bool async) => AssertSum( async, ss => ss.Set(), - selector: c => c.Orders.Sum(int (Order o) => o.OrderID)); + selector: c => c.Orders.Sum(int (o) => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_nested_subquery(bool async) => AssertSum( async, ss => ss.Set(), - selector: c => c.Orders.Sum(int (Order o) => 5 + o.OrderDetails.Sum(int (OrderDetail od) => od.ProductID))); + selector: c => c.Orders.Sum(int (o) => 5 + o.OrderDetails.Sum(int (od) => od.ProductID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_min_subquery(bool async) => AssertSum( async, ss => ss.Set(), - selector: c => c.Orders.Sum(int (Order o) => 5 + o.OrderDetails.Min(int (OrderDetail od) => od.ProductID))); + selector: c => c.Orders.Sum(int (o) => 5 + o.OrderDetails.Min(int (od) => od.ProductID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_scalar_returning_subquery(bool async) => AssertSum( async, @@ -167,16 +152,14 @@ public virtual Task Sum_over_scalar_returning_subquery(bool async) actualSelector: c => c.Orders.FirstOrDefault().OrderID, expectedSelector: c => c.Orders.Any() ? c.Orders.FirstOrDefault().OrderID : 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_Any_subquery(bool async) => AssertSum( async, ss => ss.Set(), selector: c => c.Orders.Any() ? c.Orders.FirstOrDefault().OrderID : 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Sum_over_uncorrelated_subquery(bool async) { await using var context = CreateContext(); @@ -190,55 +173,47 @@ public virtual async Task Sum_over_uncorrelated_subquery(bool async) AssertEqual(70707, result); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_on_float_column(bool async) => AssertSum( async, ss => ss.Set().Where(od => od.ProductID == 1), selector: od => od.Discount); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_on_float_column_in_subquery(bool async) => AssertQuery( async, - ss => ss.Set().Where(o => o.OrderID < 10300).Select( - o => new { o.OrderID, Sum = o.OrderDetails.Sum(od => od.Discount) }), + ss => ss.Set().Where(o => o.OrderID < 10300).Select(o => new { o.OrderID, Sum = o.OrderDetails.Sum(od => od.Discount) }), e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_with_no_arg(bool async) => AssertAverage( async, ss => ss.Set().Select(o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_with_binary_expression(bool async) => AssertAverage( async, ss => ss.Set().Select(o => o.OrderID * 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_with_arg(bool async) => AssertAverage( async, ss => ss.Set(), selector: o => o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_with_arg_expression(bool async) => AssertAverage( async, ss => ss.Set(), selector: o => o.OrderID + o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_with_division_on_decimal(bool async) => AssertAverage( async, @@ -246,8 +221,7 @@ public virtual Task Average_with_division_on_decimal(bool async) selector: od => od.Quantity / 2.09m, asserter: (e, a) => Assert.InRange(e - a, -0.1m, 0.1m)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_with_division_on_decimal_no_significant_digits(bool async) => AssertAverage( async, @@ -255,8 +229,7 @@ public virtual Task Average_with_division_on_decimal_no_significant_digits(bool selector: od => od.Quantity / 2m, asserter: (e, a) => Assert.InRange(e - a, -0.1m, 0.1m)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_with_coalesce(bool async) => AssertAverage( async, @@ -264,49 +237,43 @@ public virtual Task Average_with_coalesce(bool async) selector: p => p.UnitPrice ?? 0, asserter: (e, a) => Assert.InRange(e - a, -0.1m, 0.1m)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_over_subquery(bool async) => AssertAverage( async, ss => ss.Set(), - selector: c => c.Orders.Sum(int (Order o) => o.OrderID)); + selector: c => c.Orders.Sum(int (o) => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_over_nested_subquery(bool async) => AssertAverage( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(3), - selector: c => (decimal)c.Orders.Average(double (Order o) => 5 + o.OrderDetails.Average(int (OrderDetail od) => od.ProductID))); + selector: c => (decimal)c.Orders.Average(double (o) => 5 + o.OrderDetails.Average(int (od) => od.ProductID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_over_max_subquery(bool async) => AssertAverage( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(3), - selector: c => (decimal)c.Orders.Average(int (Order o) => 5 + o.OrderDetails.Max(int (OrderDetail od) => od.ProductID))); + selector: c => (decimal)c.Orders.Average(int (o) => 5 + o.OrderDetails.Max(int (od) => od.ProductID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_on_float_column(bool async) => AssertAverage( async, ss => ss.Set().Where(od => od.ProductID == 1), selector: od => od.Discount); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_on_float_column_in_subquery(bool async) => AssertQuery( async, - ss => ss.Set().Where(o => o.OrderID < 10300).Select( - o => new { o.OrderID, Sum = o.OrderDetails.Average(od => od.Discount) }), + ss => ss.Set().Where(o => o.OrderID < 10300) + .Select(o => new { o.OrderID, Sum = o.OrderDetails.Average(od => od.Discount) }), e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_on_float_column_in_subquery_with_cast(bool async) => AssertQuery( async, @@ -314,310 +281,261 @@ public virtual Task Average_on_float_column_in_subquery_with_cast(bool async) .Select(o => new { o.OrderID, Sum = o.OrderDetails.Average(od => (float?)od.Discount) }), e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_with_no_arg(bool async) => AssertMin( async, ss => ss.Set().Select(o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_with_arg(bool async) => AssertMin( async, ss => ss.Set(), selector: o => o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_no_data(bool async) - => Assert.ThrowsAsync( - () => AssertMin( - async, - ss => ss.Set().Where(o => o.OrderID == -1), - selector: o => o.OrderID)); + => Assert.ThrowsAsync(() => AssertMin( + async, + ss => ss.Set().Where(o => o.OrderID == -1), + selector: o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_no_data_nullable(bool async) => AssertMin( async, ss => ss.Set().Where(o => o.SupplierID == -1), selector: o => o.SupplierID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_no_data_cast_to_nullable(bool async) => AssertMin( async, ss => ss.Set().Where(o => o.OrderID == -1), selector: o => (int?)o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_no_data_subquery(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.Orders.Where(o => o.OrderID == -1).Min(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_no_data(bool async) - => Assert.ThrowsAsync( - () => AssertMax( - async, - ss => ss.Set().Where(o => o.OrderID == -1), - selector: o => o.OrderID)); + => Assert.ThrowsAsync(() => AssertMax( + async, + ss => ss.Set().Where(o => o.OrderID == -1), + selector: o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_no_data_nullable(bool async) => AssertMax( async, ss => ss.Set().Where(o => o.SupplierID == -1), selector: o => o.SupplierID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_no_data_cast_to_nullable(bool async) => AssertMax( async, ss => ss.Set().Where(o => o.OrderID == -1), selector: o => (int?)o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_no_data_subquery(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.Orders.Where(o => o.OrderID == -1).Max(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_no_data(bool async) - => Assert.ThrowsAsync( - () => AssertAverage( - async, - ss => ss.Set().Where(o => o.OrderID == -1), - selector: o => o.OrderID)); + => Assert.ThrowsAsync(() => AssertAverage( + async, + ss => ss.Set().Where(o => o.OrderID == -1), + selector: o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_no_data_nullable(bool async) => AssertAverage( async, ss => ss.Set().Where(o => o.SupplierID == -1), selector: o => o.SupplierID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_no_data_cast_to_nullable(bool async) => AssertAverage( async, ss => ss.Set().Where(o => o.OrderID == -1), selector: o => (int?)o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_no_data_subquery(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.Orders.Where(o => o.OrderID == -1).Average(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_with_coalesce(bool async) => AssertMin( async, ss => ss.Set().Where(p => p.ProductID < 40), selector: p => p.UnitPrice ?? 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_over_subquery(bool async) => AssertMin( async, ss => ss.Set(), selector: c => c.Orders.Sum(o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_over_nested_subquery(bool async) => AssertMin( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(3), - selector: c => c.Orders.Min(o => 5 + Enumerable.Min(o.OrderDetails, int (OrderDetail od) => od.ProductID))); + selector: c => c.Orders.Min(o => 5 + o.OrderDetails.Min(int (od) => od.ProductID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_over_max_subquery(bool async) => AssertMin( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(3), - selector: c => c.Orders.Min(o => 5 + o.OrderDetails.Max(int (OrderDetail od) => od.ProductID))); + selector: c => c.Orders.Min(o => 5 + o.OrderDetails.Max(int (od) => od.ProductID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_with_no_arg(bool async) => AssertMax( async, ss => ss.Set().Select(o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_with_arg(bool async) => AssertMax( async, ss => ss.Set(), selector: o => o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_with_coalesce(bool async) => AssertMax( async, ss => ss.Set().Where(p => p.ProductID < 40), selector: p => p.UnitPrice ?? 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_over_subquery(bool async) => AssertMax( async, ss => ss.Set(), selector: c => c.Orders.Sum(o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_over_nested_subquery(bool async) => AssertMax( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(3), - selector: c => c.Orders.Max(o => 5 + Enumerable.Max(o.OrderDetails, int (OrderDetail od) => od.ProductID))); + selector: c => c.Orders.Max(o => 5 + o.OrderDetails.Max(int (od) => od.ProductID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_over_sum_subquery(bool async) => AssertMax( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(3), selector: c => c.Orders.Max(o => 5 + o.OrderDetails.Sum(int (od) => od.ProductID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_with_no_predicate(bool async) => AssertCount( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_with_predicate(bool async) => AssertCount( async, ss => ss.Set(), predicate: o => o.CustomerID == "ALFKI"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_with_order_by(bool async) => AssertCount( async, ss => ss.Set().OrderBy(o => o.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_OrderBy_Count(bool async) => AssertCount( async, ss => ss.Set().Where(o => o.CustomerID == "ALFKI").OrderBy(o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Where_Count(bool async) => AssertCount( async, ss => ss.Set().OrderBy(o => o.OrderID).Where(o => o.CustomerID == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Count_with_predicate(bool async) => AssertCount( async, ss => ss.Set().OrderBy(o => o.OrderID), predicate: o => o.CustomerID == "ALFKI"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Where_Count_with_predicate(bool async) => AssertCount( async, ss => ss.Set().OrderBy(o => o.OrderID).Where(o => o.OrderID > 10), predicate: o => o.CustomerID != "ALFKI"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_OrderBy_Count_client_eval(bool async) - => AssertTranslationFailed( - () => AssertCount( - async, - ss => ss.Set().Where(o => ClientEvalPredicate(o)).OrderBy(o => ClientEvalSelectorStateless()))); + => AssertTranslationFailed(() => AssertCount( + async, + ss => ss.Set().Where(o => ClientEvalPredicate(o)).OrderBy(o => ClientEvalSelectorStateless()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Where_Count_client_eval(bool async) - => AssertTranslationFailed( - () => AssertCount( - async, - ss => ss.Set().OrderBy(o => ClientEvalSelectorStateless()).Where(o => ClientEvalPredicate(o)))); + => AssertTranslationFailed(() => AssertCount( + async, + ss => ss.Set().OrderBy(o => ClientEvalSelectorStateless()).Where(o => ClientEvalPredicate(o)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Where_Count_client_eval_mixed(bool async) - => AssertTranslationFailed( - () => AssertCount( - async, - ss => ss.Set().OrderBy(o => o.OrderID).Where(o => ClientEvalPredicate(o)))); + => AssertTranslationFailed(() => AssertCount( + async, + ss => ss.Set().OrderBy(o => o.OrderID).Where(o => ClientEvalPredicate(o)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Count_with_predicate_client_eval(bool async) - => AssertTranslationFailed( - () => AssertCount( - async, - ss => ss.Set().OrderBy(o => ClientEvalSelectorStateless()), - predicate: o => ClientEvalPredicate(o))); + => AssertTranslationFailed(() => AssertCount( + async, + ss => ss.Set().OrderBy(o => ClientEvalSelectorStateless()), + predicate: o => ClientEvalPredicate(o))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Count_with_predicate_client_eval_mixed(bool async) - => AssertTranslationFailed( - () => AssertCount( - async, - ss => ss.Set().OrderBy(o => o.OrderID), - predicate: o => ClientEvalPredicate(o))); + => AssertTranslationFailed(() => AssertCount( + async, + ss => ss.Set().OrderBy(o => o.OrderID), + predicate: o => ClientEvalPredicate(o))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Where_Count_with_predicate_client_eval(bool async) - => AssertTranslationFailed( - () => AssertCount( - async, - ss => ss.Set().OrderBy(o => ClientEvalSelectorStateless()).Where(o => ClientEvalPredicate(o)), - predicate: o => ClientEvalPredicate(o))); + => AssertTranslationFailed(() => AssertCount( + async, + ss => ss.Set().OrderBy(o => ClientEvalSelectorStateless()).Where(o => ClientEvalPredicate(o)), + predicate: o => ClientEvalPredicate(o))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Where_Count_with_predicate_client_eval_mixed(bool async) - => AssertTranslationFailed( - () => AssertCount( - async, - ss => ss.Set().OrderBy(o => o.OrderID).Where(o => ClientEvalPredicate(o)), - predicate: o => o.CustomerID != "ALFKI")); + => AssertTranslationFailed(() => AssertCount( + async, + ss => ss.Set().OrderBy(o => o.OrderID).Where(o => ClientEvalPredicate(o)), + predicate: o => o.CustomerID != "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_client_Take(bool async) => AssertQuery( async, @@ -629,37 +547,32 @@ protected static bool ClientEvalPredicate(Order order) private static int ClientEvalSelectorStateless() => 42; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct(bool async) => AssertQuery( async, ss => ss.Set().Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_Scalar(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.City).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Distinct(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Select(c => c.City).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_OrderBy(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.Country).Distinct().OrderBy(c => c), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_OrderBy2(bool async) => AssertQuery( async, @@ -667,8 +580,7 @@ public virtual Task Distinct_OrderBy2(bool async) ss => ss.Set().Distinct().OrderBy(c => c.CustomerID, StringComparer.Ordinal), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_OrderBy3(bool async) => AssertQuery( async, @@ -676,216 +588,186 @@ public virtual Task Distinct_OrderBy3(bool async) ss => ss.Set().Select(c => new { c.CustomerID }).Distinct().OrderBy(a => a.CustomerID, StringComparer.Ordinal), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_Count(bool async) => AssertCount( async, ss => ss.Set().Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Select_Distinct_Count(bool async) => AssertCount( async, ss => ss.Set().Select(c => c.City).Select(c => c).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Single_Throws(bool async) - => Assert.ThrowsAsync( - async () => await AssertSingle(async, ss => ss.Set())); + => Assert.ThrowsAsync(async () => await AssertSingle(async, ss => ss.Set())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Single_Predicate(bool async) => AssertSingle( async, ss => ss.Set(), predicate: c => c.CustomerID == "ALFKI"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Single(bool async) => AssertSingle( async, ss => ss.Set().Where(c => c.CustomerID == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SingleOrDefault_Throws(bool async) - => Assert.ThrowsAsync( - async () => - await AssertSingleOrDefault(async, ss => ss.Set())); + => Assert.ThrowsAsync(async () => + await AssertSingleOrDefault(async, ss => ss.Set())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SingleOrDefault_Predicate(bool async) => AssertSingle( async, ss => ss.Set(), predicate: c => c.CustomerID == "ALFKI"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_SingleOrDefault(bool async) => AssertSingleOrDefault( async, ss => ss.Set().Where(c => c.CustomerID == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task First(bool async) => AssertFirst( async, ss => ss.Set().OrderBy(c => c.ContactName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task First_Predicate(bool async) => AssertFirst( async, ss => ss.Set().OrderBy(c => c.ContactName), predicate: c => c.City == "London"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_First(bool async) => AssertFirst( async, // ReSharper disable once ReplaceWithSingleCallToFirst ss => ss.Set().OrderBy(c => c.ContactName).Where(c => c.City == "London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault(bool async) => AssertFirstOrDefault( async, ss => ss.Set().OrderBy(c => c.ContactName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_Predicate(bool async) => AssertFirstOrDefault( async, ss => ss.Set().OrderBy(c => c.ContactName), predicate: c => c.City == "London"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_FirstOrDefault(bool async) => AssertFirstOrDefault( async, ss => ss.Set().OrderBy(c => c.ContactName).Where(c => c.City == "London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_inside_subquery_gets_server_evaluated(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => c.CustomerID == "ALFKI" && c.Orders.Where(o => o.CustomerID == "ALFKI").FirstOrDefault().CustomerID == "ALFKI")); + ss => ss.Set().Where(c + => c.CustomerID == "ALFKI" && c.Orders.Where(o => o.CustomerID == "ALFKI").FirstOrDefault().CustomerID == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_collection_navigation_with_FirstOrDefault_chained(bool async) => AssertQuery( async, - ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")).OrderBy(c => c.CustomerID).Select( - c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault().OrderDetails.OrderBy(od => od.ProductID).FirstOrDefault()), - ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")).OrderBy(c => c.CustomerID).Select( - c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault() - .Maybe(x => x.OrderDetails) - .Maybe(xx => xx.OrderBy(od => od.ProductID).FirstOrDefault()))); + ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")).OrderBy(c => c.CustomerID).Select(c + => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault().OrderDetails.OrderBy(od => od.ProductID).FirstOrDefault()), + ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")).OrderBy(c => c.CustomerID).Select(c => c.Orders + .OrderBy(o => o.OrderID).FirstOrDefault() + .Maybe(x => x.OrderDetails) + .Maybe(xx => xx.OrderBy(od => od.ProductID).FirstOrDefault()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_collection_navigation_with_FirstOrDefault_chained_projecting_scalar(bool async) => AssertQueryScalar( async, - ss => ss.Set().Where(c => c.CustomerID.StartsWith("A")).OrderBy(c => c.CustomerID).Select( - c => (int?)c.Orders.OrderBy(o => o.OrderID).FirstOrDefault().OrderDetails.OrderBy(od => od.ProductID).FirstOrDefault() - .ProductID), - ss => ss.Set().Where(c => c.CustomerID.StartsWith("A")).OrderBy(c => c.CustomerID).Select( - c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault() - .Maybe(x => x.OrderDetails) - .MaybeScalar(x => x.OrderBy(od => od.ProductID).FirstOrDefault().ProductID))); + ss => ss.Set().Where(c => c.CustomerID.StartsWith("A")).OrderBy(c => c.CustomerID).Select(c => (int?)c.Orders + .OrderBy(o => o.OrderID).FirstOrDefault().OrderDetails.OrderBy(od => od.ProductID).FirstOrDefault() + .ProductID), + ss => ss.Set().Where(c => c.CustomerID.StartsWith("A")).OrderBy(c => c.CustomerID).Select(c => c.Orders + .OrderBy(o => o.OrderID).FirstOrDefault() + .Maybe(x => x.OrderDetails) + .MaybeScalar(x => x.OrderBy(od => od.ProductID).FirstOrDefault().ProductID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task First_inside_subquery_gets_client_evaluated(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => c.CustomerID == "ALFKI" && c.Orders.Where(o => o.CustomerID == "ALFKI").First().CustomerID == "ALFKI")); + ss => ss.Set().Where(c + => c.CustomerID == "ALFKI" && c.Orders.Where(o => o.CustomerID == "ALFKI").First().CustomerID == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Last(bool async) => AssertLast( async, ss => ss.Set().OrderBy(c => c.ContactName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Last_when_no_order_by(bool async) => AssertLast( async, ss => ss.Set().Where(c => c.CustomerID == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LastOrDefault_when_no_order_by(bool async) => AssertLastOrDefault( async, ss => ss.Set().Where(c => c.CustomerID == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Last_Predicate(bool async) => AssertLast( async, ss => ss.Set().OrderBy(c => c.ContactName), predicate: c => c.City == "London"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Last(bool async) => AssertLast( async, ss => ss.Set().OrderBy(c => c.ContactName).Where(c => c.City == "London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LastOrDefault(bool async) => AssertLastOrDefault( async, ss => ss.Set().OrderBy(c => c.ContactName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LastOrDefault_Predicate(bool async) => AssertLastOrDefault( async, ss => ss.Set().OrderBy(c => c.ContactName), predicate: c => c.City == "London"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_LastOrDefault(bool async) => AssertLastOrDefault( async, ss => ss.Set().OrderBy(c => c.ContactName).Where(c => c.City == "London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_subquery(bool async) => AssertQuery( async, ss => ss.Set().Where(c => ss.Set().Select(o => o.CustomerID).Contains(c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_array_closure(bool async) { var ids = new[] { "ABCDE", "ALFKI" }; @@ -902,27 +784,25 @@ await AssertQuery( assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_subquery_and_local_array_closure(bool async) { var ids = new[] { "London", "Buenos Aires" }; await AssertQuery( async, - ss => ss.Set().Where( - c => ss.Set().Where(c1 => ids.Contains(c1.City)).Any(e => e.CustomerID == c.CustomerID))); + ss => ss.Set() + .Where(c => ss.Set().Where(c1 => ids.Contains(c1.City)).Any(e => e.CustomerID == c.CustomerID))); ids = ["London"]; await AssertQuery( async, - ss => ss.Set().Where( - c => ss.Set().Where(c1 => ids.Contains(c1.City)).Any(e => e.CustomerID == c.CustomerID))); + ss => ss.Set() + .Where(c => ss.Set().Where(c1 => ids.Contains(c1.City)).Any(e => e.CustomerID == c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_uint_array_closure(bool async) { var ids = new uint[] { 0, 1 }; @@ -939,8 +819,7 @@ await AssertQuery( assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_nullable_uint_array_closure(bool async) { var ids = new uint?[] { 0, 1 }; @@ -957,15 +836,13 @@ await AssertQuery( assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_array_inline(bool async) => AssertQuery( async, ss => ss.Set().Where(c => new[] { "ABCDE", "ALFKI" }.Contains(c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_list_closure(bool async) { var ids = new List { "ABCDE", "ALFKI" }; @@ -974,8 +851,7 @@ public virtual Task Contains_with_local_list_closure(bool async) ss => ss.Set().Where(c => ids.Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_object_list_closure(bool async) { var ids = new List { "ABCDE", "ALFKI" }; @@ -984,8 +860,7 @@ public virtual Task Contains_with_local_object_list_closure(bool async) ss => ss.Set().Where(c => ids.Contains(EF.Property(c, nameof(Customer.CustomerID))))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_list_closure_all_null(bool async) { var ids = new List { null, null }; @@ -995,16 +870,13 @@ public virtual Task Contains_with_local_list_closure_all_null(bool async) assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_list_inline(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new List { "ABCDE", "ALFKI" }.Contains(c.CustomerID))); + ss => ss.Set().Where(c => new List { "ABCDE", "ALFKI" }.Contains(c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_list_inline_closure_mix(bool async) { var id = "ALFKI"; @@ -1020,8 +892,7 @@ await AssertQuery( ss => ss.Set().Where(c => new List { "ABCDE", id }.Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_enumerable_closure(bool async) { var ids = new[] { "ABCDE", "ALFKI" }.Where(e => e != null); @@ -1038,8 +909,7 @@ await AssertQuery( assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_object_enumerable_closure(bool async) { var ids = new List { "ABCDE", "ALFKI" }.Where(e => e != null); @@ -1048,8 +918,7 @@ public virtual Task Contains_with_local_object_enumerable_closure(bool async) ss => ss.Set().Where(c => ids.Contains(EF.Property(c, nameof(Customer.CustomerID))))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_enumerable_closure_all_null(bool async) { var ids = new List { null, null }.Where(e => e != null); @@ -1059,16 +928,13 @@ public virtual Task Contains_with_local_enumerable_closure_all_null(bool async) assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_enumerable_inline(bool async) => await AssertQuery( async, - ss => ss.Set().Where( - c => new List { "ABCDE", "ALFKI" }.Where(e => e != null).Contains(c.CustomerID))); + ss => ss.Set().Where(c => new List { "ABCDE", "ALFKI" }.Where(e => e != null).Contains(c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_enumerable_inline_closure_mix(bool async) { var id = "ALFKI"; @@ -1084,8 +950,7 @@ await AssertQuery( ss => ss.Set().Where(c => new List { "ABCDE", id }.Where(e => e != null).Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_ordered_enumerable_closure(bool async) { var ids = new[] { "ABCDE", "ALFKI" }.Order(); @@ -1102,8 +967,7 @@ await AssertQuery( assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_object_ordered_enumerable_closure(bool async) { var ids = new List { "ABCDE", "ALFKI" }.Order(); @@ -1112,8 +976,7 @@ public virtual Task Contains_with_local_object_ordered_enumerable_closure(bool a ss => ss.Set().Where(c => ids.Contains(EF.Property(c, nameof(Customer.CustomerID))))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_ordered_enumerable_closure_all_null(bool async) { var ids = new List { null, null }.Order(); @@ -1123,16 +986,13 @@ public virtual Task Contains_with_local_ordered_enumerable_closure_all_null(bool assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_ordered_enumerable_inline(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new List { "ABCDE", "ALFKI" }.Order().Contains(c.CustomerID))); + ss => ss.Set().Where(c => new List { "ABCDE", "ALFKI" }.Order().Contains(c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_ordered_enumerable_inline_closure_mix(bool async) { var id = "ALFKI"; @@ -1148,8 +1008,7 @@ await AssertQuery( ss => ss.Set().Where(c => new List { "ABCDE", id }.Order().Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_read_only_collection_closure(bool async) { var ids = new[] { "ABCDE", "ALFKI" }.AsReadOnly(); @@ -1166,8 +1025,7 @@ await AssertQuery( assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_object_read_only_collection_closure(bool async) { var ids = new List { "ABCDE", "ALFKI" }.AsReadOnly(); @@ -1176,8 +1034,7 @@ public virtual Task Contains_with_local_object_read_only_collection_closure(bool ss => ss.Set().Where(c => ids.Contains(EF.Property(c, nameof(Customer.CustomerID))))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_ordered_read_only_collection_all_null(bool async) { var ids = new List { null, null }.AsReadOnly(); @@ -1187,16 +1044,13 @@ public virtual Task Contains_with_local_ordered_read_only_collection_all_null(bo assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_read_only_collection_inline(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new List { "ABCDE", "ALFKI" }.AsReadOnly().Contains(c.CustomerID))); + ss => ss.Set().Where(c => new List { "ABCDE", "ALFKI" }.AsReadOnly().Contains(c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_read_only_collection_inline_closure_mix(bool async) { var id = "ALFKI"; @@ -1212,41 +1066,35 @@ await AssertQuery( ss => ss.Set().Where(c => new List { "ABCDE", id }.AsReadOnly().Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_local_non_primitive_list_inline_closure_mix(bool async) { var id = "ALFKI"; await AssertQuery( async, - ss => ss.Set().Where( - c => new List { new() { CustomerID = "ABCDE" }, new() { CustomerID = id } } - .Select(i => i.CustomerID).Contains(c.CustomerID))); + ss => ss.Set().Where(c => new List { new() { CustomerID = "ABCDE" }, new() { CustomerID = id } } + .Select(i => i.CustomerID).Contains(c.CustomerID))); id = "ANATR"; await AssertQuery( async, - ss => ss.Set().Where( - c => new List { new() { CustomerID = "ABCDE" }, new() { CustomerID = id } } - .Select(i => i.CustomerID).Contains(c.CustomerID))); + ss => ss.Set().Where(c => new List { new() { CustomerID = "ABCDE" }, new() { CustomerID = id } } + .Select(i => i.CustomerID).Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_non_primitive_list_closure_mix(bool async) { var ids = new List { new() { CustomerID = "ABCDE" }, new() { CustomerID = "ALFKI" } }; return AssertQuery( async, - ss => ss.Set().Where( - c => ids.Select(i => i.CustomerID).Contains(c.CustomerID))); + ss => ss.Set().Where(c => ids.Select(i => i.CustomerID).Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_collection_false(bool async) { string[] ids = ["ABCDE", "ALFKI"]; @@ -1256,8 +1104,7 @@ public virtual Task Contains_with_local_collection_false(bool async) ss => ss.Set().Where(c => !ids.Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_collection_complex_predicate_and(bool async) { string[] ids = ["ABCDE", "ALFKI"]; @@ -1267,8 +1114,7 @@ public virtual Task Contains_with_local_collection_complex_predicate_and(bool as ss => ss.Set().Where(c => (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE") && ids.Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_collection_complex_predicate_or(bool async) { string[] ids = ["ABCDE", "ALFKI"]; @@ -1278,8 +1124,7 @@ public virtual Task Contains_with_local_collection_complex_predicate_or(bool asy ss => ss.Set().Where(c => ids.Contains(c.CustomerID) || (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE"))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_collection_complex_predicate_not_matching_ins1(bool async) { string[] ids = ["ABCDE", "ALFKI"]; @@ -1289,8 +1134,7 @@ public virtual Task Contains_with_local_collection_complex_predicate_not_matchin ss => ss.Set().Where(c => (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE") || !ids.Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_collection_complex_predicate_not_matching_ins2(bool async) { string[] ids = ["ABCDE", "ALFKI"]; @@ -1301,8 +1145,7 @@ public virtual Task Contains_with_local_collection_complex_predicate_not_matchin assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_collection_sql_injection(bool async) { string[] ids = ["ALFKI", "ABC')); GO; DROP TABLE Orders; GO; --"]; @@ -1312,8 +1155,7 @@ public virtual Task Contains_with_local_collection_sql_injection(bool async) ss => ss.Set().Where(c => ids.Contains(c.CustomerID) || (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE"))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_collection_empty_closure(bool async) { string[] ids = []; @@ -1324,23 +1166,20 @@ public virtual Task Contains_with_local_collection_empty_closure(bool async) assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_collection_empty_inline(bool async) => AssertQuery( async, ss => ss.Set().Where(c => !(new List().Contains(c.CustomerID)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_top_level(bool async) => AssertSingleResult( async, syncQuery: ss => ss.Set().Select(c => c.CustomerID).Contains("ALFKI"), asyncQuery: ss => ss.Set().Select(c => c.CustomerID).ContainsAsync("ALFKI", default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_tuple_array_closure(bool async) { var ids = new[] { Tuple.Create(1, 2), Tuple.Create(10248, 11) }; @@ -1350,8 +1189,7 @@ public virtual Task Contains_with_local_tuple_array_closure(bool async) ss => ss.Set().Where(o => ids.Contains(new Tuple(o.OrderID, o.ProductID)))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_local_anonymous_type_array_closure(bool async) { var ids = new[] { new { Id1 = 1, Id2 = 2 }, new { Id1 = 10248, Id2 = 11 } }; @@ -1361,8 +1199,7 @@ public virtual Task Contains_with_local_anonymous_type_array_closure(bool async) ss => ss.Set().Where(o => ids.Contains(new { Id1 = o.OrderID, Id2 = o.ProductID }))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OfType_Select(bool async) => AssertFirst( async, @@ -1371,8 +1208,7 @@ public virtual Task OfType_Select(bool async) .OrderBy(o => o.OrderID) .Select(o => o.Customer.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OfType_Select_OfType_Select(bool async) => AssertFirst( async, @@ -1383,8 +1219,7 @@ public virtual Task OfType_Select_OfType_Select(bool async) .OrderBy(o => o.OrderID) .Select(o => o.Customer.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_with_non_matching_types_in_projection_doesnt_produce_second_explicit_cast(bool async) => AssertAverage( async, @@ -1393,8 +1228,7 @@ public virtual Task Average_with_non_matching_types_in_projection_doesnt_produce .OrderBy(o => o.OrderID) .Select(o => (long)o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_with_non_matching_types_in_projection_introduces_explicit_cast(bool async) => AssertMax( async, @@ -1403,8 +1237,7 @@ public virtual Task Max_with_non_matching_types_in_projection_introduces_explici .OrderBy(o => o.OrderID) .Select(o => (long)o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_with_non_matching_types_in_projection_introduces_explicit_cast(bool async) => AssertMin( async, @@ -1412,22 +1245,19 @@ public virtual Task Min_with_non_matching_types_in_projection_introduces_explici .Where(o => o.CustomerID.StartsWith("A")) .Select(o => (long)o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Take_Last_gives_correct_result(bool async) => AssertLast( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(20)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Skip_Last_gives_correct_result(bool async) => AssertLast( async, ss => ss.Set().OrderBy(c => c.CustomerID).Skip(20)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_entityType_should_rewrite_to_identity_equality(bool async) => AssertSingleResult( async, @@ -1438,8 +1268,7 @@ public virtual Task Contains_over_entityType_should_rewrite_to_identity_equality .Where(o => o.CustomerID == "VINET") .ContainsAsync(ss.Set().Single(o => o.OrderID == 10248), default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task List_Contains_over_entityType_should_rewrite_to_identity_equality(bool async) { var someOrder = new Order { OrderID = 10248 }; @@ -1449,16 +1278,14 @@ public virtual Task List_Contains_over_entityType_should_rewrite_to_identity_equ ss => ss.Set().Where(c => c.Orders.Contains(someOrder))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task List_Contains_with_constant_list(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new List { new() { CustomerID = "ALFKI" }, new() { CustomerID = "ANATR" } }.Contains(c))); + ss => ss.Set().Where(c + => new List { new() { CustomerID = "ALFKI" }, new() { CustomerID = "ANATR" } }.Contains(c))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task List_Contains_with_parameter_list(bool async) { var customers = new List { new() { CustomerID = "ALFKI" }, new() { CustomerID = "ANATR" } }; @@ -1468,8 +1295,7 @@ public virtual Task List_Contains_with_parameter_list(bool async) ss => ss.Set().Where(c => customers.Contains(c))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_parameter_list_value_type_id(bool async) { var orders = new List { new() { OrderID = 10248 }, new() { OrderID = 10249 } }; @@ -1479,16 +1305,13 @@ public virtual Task Contains_with_parameter_list_value_type_id(bool async) ss => ss.Set().Where(o => orders.Contains(o))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_constant_list_value_type_id(bool async) => AssertQuery( async, - ss => ss.Set().Where( - o => new List { new() { OrderID = 10248 }, new() { OrderID = 10249 } }.Contains(o))); + ss => ss.Set().Where(o => new List { new() { OrderID = 10248 }, new() { OrderID = 10249 } }.Contains(o))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IImmutableSet_Contains_with_parameter(bool async) { IImmutableSet ids = ImmutableHashSet.Empty.Add("ALFKI"); @@ -1498,8 +1321,7 @@ public virtual Task IImmutableSet_Contains_with_parameter(bool async) ss => ss.Set().Where(c => ids.Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IReadOnlySet_Contains_with_parameter(bool async) { IReadOnlySet ids = new HashSet { "ALFKI" }; @@ -1509,8 +1331,7 @@ public virtual Task IReadOnlySet_Contains_with_parameter(bool async) ss => ss.Set().Where(c => ids.Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task HashSet_Contains_with_parameter(bool async) { var ids = new HashSet { "ALFKI" }; @@ -1520,8 +1341,7 @@ public virtual Task HashSet_Contains_with_parameter(bool async) ss => ss.Set().Where(c => ids.Contains(c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ImmutableHashSet_Contains_with_parameter(bool async) { var ids = ImmutableHashSet.Empty.Add("ALFKI"); @@ -1531,124 +1351,106 @@ public virtual Task ImmutableHashSet_Contains_with_parameter(bool async) ss => ss.Set().Where(c => ids.Contains(c.CustomerID))); } - private static readonly IEnumerable _customers = new[] { "ALFKI", "WRONG" }; + private static readonly IEnumerable _customers = ["ALFKI", "WRONG"]; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Array_cast_to_IEnumerable_Contains_with_constant(bool async) => AssertQuery( async, ss => ss.Set().Where(c => _customers.Contains(c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_keyless_entity_throws(bool async) => AssertSingleResult( async, ss => ss.Set().Contains(ss.Set().First()), ss => ss.Set().ContainsAsync(ss.Set().First(), default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_entityType_with_null_should_rewrite_to_false(bool async) => AssertSingleResult( async, ss => ss.Set().Where(o => o.CustomerID == "VINET").Contains(null), ss => ss.Set().Where(o => o.CustomerID == "VINET").ContainsAsync(null, default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_entityType_with_null_should_rewrite_to_identity_equality_subquery(bool async) => AssertQuery( async, ss => ss.Set().Where(o => ss.Set().Where(o => o.CustomerID == "VINET").Contains(null)), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_entityType_with_null_in_projection(bool async) => AssertQuery( async, - ss => ss.Set().Where( - o => ss.Set().Where(o => o.CustomerID == "VINET") - .Contains(null)), + ss => ss.Set().Where(o => ss.Set().Where(o => o.CustomerID == "VINET") + .Contains(null)), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_scalar_with_null_should_rewrite_to_identity_equality_subquery(bool async) => AssertQuery( async, - ss => ss.Set().Where( - o => ss.Set().Where(o => o.CustomerID == "VINET").Select(o => o.EmployeeID).Contains(null)), + ss => ss.Set().Where(o => ss.Set().Where(o => o.CustomerID == "VINET").Select(o => o.EmployeeID).Contains(null)), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_entityType_with_null_should_rewrite_to_identity_equality_subquery_negated(bool async) => AssertQuery( async, - ss => ss.Set().Where( - o => !ss.Set().Where(o => o.CustomerID == "VINET").Select(o => o.EmployeeID).Contains(null))); + ss => ss.Set() + .Where(o => !ss.Set().Where(o => o.CustomerID == "VINET").Select(o => o.EmployeeID).Contains(null))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_entityType_with_null_should_rewrite_to_identity_equality_subquery_complex(bool async) => AssertQuery( async, - ss => ss.Set().Where( - o => ss.Set().Where(o => o.CustomerID == "VINET").Select(o => o.EmployeeID) - .Contains(null) - == ss.Set().Where(o => o.CustomerID != "VINET").Select(o => o.EmployeeID) - .Contains(null))); + ss => ss.Set().Where(o => ss.Set().Where(o => o.CustomerID == "VINET").Select(o => o.EmployeeID) + .Contains(null) + == ss.Set().Where(o => o.CustomerID != "VINET").Select(o => o.EmployeeID) + .Contains(null))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_nullable_scalar_with_null_in_subquery_translated_correctly(bool async) => AssertQueryScalar( async, - ss => ss.Set().Select( - o => ss.Set().Where(o => o.CustomerID == "VINET").Select(o => o.EmployeeID).Contains(null))); + ss => ss.Set() + .Select(o => ss.Set().Where(o => o.CustomerID == "VINET").Select(o => o.EmployeeID).Contains(null))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_non_nullable_scalar_with_null_in_subquery_simplifies_to_false(bool async) => AssertQueryScalar( async, - ss => ss.Set().Select( - o => ss.Set().Where(o => o.CustomerID != "VINET").Select(o => o.CustomerID).Contains(null))); + ss => ss.Set().Select(o + => ss.Set().Where(o => o.CustomerID != "VINET").Select(o => o.CustomerID).Contains(null))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_entityType_should_materialize_when_composite(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.ProductID == 42 && ss.Set().Contains(o))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_entityType_should_materialize_when_composite2(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.ProductID == 42 && ss.Set().Where(x => x.OrderID > 42).Contains(o))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_FirstOrDefault_in_projection_does_not_do_client_eval(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.CustomerID.FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_constant_Sum(bool async) => AssertSum( async, ss => ss.Set(), selector: e => 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_any_equals_operator(bool async) { var ids = new List @@ -1663,15 +1465,13 @@ public virtual Task Where_subquery_any_equals_operator(bool async) ss => ss.Set().Where(c => ids.Any(li => li == c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_any_equals(bool async) => AssertQuery( async, ss => ss.Set().Where(c => new[] { "ABCDE", "ALFKI", "ANATR" }.Any(li => li.Equals(c.CustomerID)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_any_equals_static(bool async) { var ids = new List @@ -1686,8 +1486,7 @@ public virtual Task Where_subquery_any_equals_static(bool async) ss => ss.Set().Where(c => ids.Any(li => Equals(li, c.CustomerID)))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_subquery_where_any(bool async) { var ids = new[] { "ABCDE", "ALFKI", "ANATR" }; @@ -1701,8 +1500,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.City == "México D.F.").Where(c => ids.Any(li => c.CustomerID == li))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_all_not_equals_operator(bool async) { var ids = new List @@ -1717,21 +1515,18 @@ public virtual Task Where_subquery_all_not_equals_operator(bool async) ss => ss.Set().Where(c => ids.All(li => li != c.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_all_not_equals(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new List - { - "ABCDE", - "ALFKI", - "ANATR" - }.All(li => !li.Equals(c.CustomerID)))); + ss => ss.Set().Where(c => new List + { + "ABCDE", + "ALFKI", + "ANATR" + }.All(li => !li.Equals(c.CustomerID)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_all_not_equals_static(bool async) { var ids = new List @@ -1746,8 +1541,7 @@ public virtual Task Where_subquery_all_not_equals_static(bool async) ss => ss.Set().Where(c => ids.All(li => !Equals(li, c.CustomerID)))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_subquery_where_all(bool async) { var ids = new List @@ -1766,43 +1560,37 @@ await AssertQuery( ss => ss.Set().Where(c => c.City == "México D.F.").Where(c => ids.All(li => c.CustomerID != li))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_to_same_Type_Count_works(bool async) => AssertCount( async, ss => ss.Set().Cast()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_before_aggregate_is_preserved(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.Orders.Select(o => (double?)o.OrderID).Average())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Enumerable_min_is_mapped_to_Queryable_1(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.Orders.Min(o => (double?)o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Enumerable_min_is_mapped_to_Queryable_2(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.Orders.Select(o => (double?)o.OrderID).Min())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_selects_only_required_columns(bool async) => AssertQuery( async, ss => ss.Set().Select(p => new { p.ProductID, p.ProductName }).DefaultIfEmpty().Select(p => p.ProductName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_Last_member_access_in_projection_translated(bool async) => AssertQuery( async, @@ -1811,8 +1599,7 @@ public virtual Task Collection_Last_member_access_in_projection_translated(bool ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")) .Where(c => c.Orders.OrderByDescending(o => o.OrderID).LastOrDefault().Maybe(x => x.CustomerID) == c.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_LastOrDefault_member_access_in_projection_translated(bool async) => AssertQuery( async, @@ -1821,16 +1608,14 @@ public virtual Task Collection_LastOrDefault_member_access_in_projection_transla ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")) .Where(c => c.Orders.OrderByDescending(o => o.OrderID).LastOrDefault().Maybe(x => x.CustomerID) == c.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_explicit_cast_over_column(bool async) => AssertSum( async, ss => ss.Set(), o => (long?)o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Count_on_projection_with_client_eval(bool async) { await AssertCount( @@ -1846,8 +1631,7 @@ await AssertCount( ss => ss.Set().Select(o => new { Id = CodeFormat(o.OrderID) })); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_with_unmapped_property_access_throws_meaningful_exception(bool async) => AssertTranslationFailedWithDetails( () => AssertAverage( @@ -1859,61 +1643,53 @@ public virtual Task Average_with_unmapped_property_access_throws_meaningful_exce private static string CodeFormat(int str) => str.ToString(); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_empty_returns_zero(bool async) => AssertSum( async, ss => ss.Set().Where(o => o.OrderID == 42), o => o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_over_default_returns_default(bool async) => AssertAverage( async, ss => ss.Set().Where(o => o.OrderID == 10248), o => o.OrderID - 10248); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_over_default_returns_default(bool async) => AssertMax( async, ss => ss.Set().Where(o => o.OrderID == 10248), o => o.OrderID - 10248); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_over_default_returns_default(bool async) => AssertMin( async, ss => ss.Set().Where(o => o.OrderID == 10248), o => o.OrderID - 10248); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_after_DefaultIfEmpty_does_not_throw(bool async) => AssertAverage( async, ss => ss.Set().Where(o => o.OrderID == 10243).Select(o => o.OrderID).DefaultIfEmpty()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Max_after_DefaultIfEmpty_does_not_throw(bool async) => AssertMax( async, ss => ss.Set().Where(o => o.OrderID == 10243).Select(o => o.OrderID).DefaultIfEmpty()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Min_after_DefaultIfEmpty_does_not_throw(bool async) => AssertMin( async, ss => ss.Set().Where(o => o.OrderID == 10243).Select(o => o.OrderID).DefaultIfEmpty()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Average_on_nav_subquery_in_projection(bool async) => AssertQuery( async, @@ -1933,16 +1709,14 @@ public virtual Task Average_on_nav_subquery_in_projection(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_true(bool async) => AssertAll( async, ss => ss.Set(), predicate: x => true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_after_client_projection(bool async) => AssertCount( async, @@ -1951,15 +1725,13 @@ public virtual Task Count_after_client_projection(bool async) .Select(o => new { o.OrderID, Customer = o.Customer is Customer ? new { o.Customer.ContactName } : null }) .Take(1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Not_Any_false(bool async) => AssertQuery( async, ss => ss.Set().Where(c => !c.Orders.Any(o => false)).Select(c => c.CustomerID)); - [ConditionalTheory] // #32374 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #32374 public virtual Task Contains_inside_aggregate_function_with_GroupBy(bool async) { var cities = new[] { "London", "Berlin" }; @@ -1971,8 +1743,7 @@ public virtual Task Contains_inside_aggregate_function_with_GroupBy(bool async) .Select(g => g.Count(c => cities.Contains(c.City)))); } - [ConditionalTheory] // #32374 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #32374 public virtual Task Contains_inside_Average_without_GroupBy(bool async) { var cities = new[] { "London", "Berlin" }; @@ -1983,8 +1754,7 @@ public virtual Task Contains_inside_Average_without_GroupBy(bool async) selector: c => cities.Contains(c.City) ? 1.0 : 0.0); } - [ConditionalTheory] // #32374 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #32374 public virtual Task Contains_inside_Sum_without_GroupBy(bool async) { var cities = new[] { "London", "Berlin" }; @@ -1995,8 +1765,7 @@ public virtual Task Contains_inside_Sum_without_GroupBy(bool async) selector: c => cities.Contains(c.City) ? 1 : 0); } - [ConditionalTheory] // #32374 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #32374 public virtual Task Contains_inside_Count_without_GroupBy(bool async) { var cities = new[] { "London", "Berlin" }; @@ -2007,8 +1776,7 @@ public virtual Task Contains_inside_Count_without_GroupBy(bool async) predicate: c => cities.Contains(c.City)); } - [ConditionalTheory] // #32374 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #32374 public virtual Task Contains_inside_LongCount_without_GroupBy(bool async) { var cities = new[] { "London", "Berlin" }; @@ -2019,8 +1787,7 @@ public virtual Task Contains_inside_LongCount_without_GroupBy(bool async) predicate: c => cities.Contains(c.City)); } - [ConditionalTheory] // #32374 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #32374 public virtual Task Contains_inside_Max_without_GroupBy(bool async) { var cities = new[] { "London", "Berlin" }; @@ -2031,8 +1798,7 @@ public virtual Task Contains_inside_Max_without_GroupBy(bool async) selector: c => cities.Contains(c.City) ? 1 : 0); } - [ConditionalTheory] // #32374 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #32374 public virtual Task Contains_inside_Min_without_GroupBy(bool async) { var cities = new[] { "London", "Berlin" }; @@ -2043,8 +1809,7 @@ public virtual Task Contains_inside_Min_without_GroupBy(bool async) selector: c => cities.Contains(c.City) ? 1 : 0); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Return_type_of_singular_operator_is_preserved(bool async) { await AssertFirst( @@ -2092,8 +1857,7 @@ await AssertLastOrDefault( asserter: (e, a) => Assert.Equal(e.CustomerId, a.CustomerId)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Type_casting_inside_sum(bool async) => AssertSum( async, diff --git a/test/EFCore.Specification.Tests/Query/NorthwindAsNoTrackingQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindAsNoTrackingQueryTestBase.cs index 95fda7e92bb..144c98f7f4d 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindAsNoTrackingQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindAsNoTrackingQueryTestBase.cs @@ -10,11 +10,7 @@ namespace Microsoft.EntityFrameworkCore.Query; public abstract class NorthwindAsNoTrackingQueryTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : NorthwindQueryFixtureBase, new() { - [ConditionalTheory] - [InlineData(false, false)] - [InlineData(false, true)] - [InlineData(true, false)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(false, true), InlineData(true, false), InlineData(true, true)] public virtual Task Entity_not_added_to_state_manager(bool useParam, bool async) => useParam ? AssertQuery( @@ -24,8 +20,7 @@ public virtual Task Entity_not_added_to_state_manager(bool useParam, bool async) async, ss => ss.Set().AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Applied_to_body_clause(bool async) => AssertQuery( async, @@ -35,8 +30,7 @@ on c.CustomerID equals o.CustomerID where c.CustomerID == "ALFKI" select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Applied_to_multiple_body_clauses(bool async) => AssertQuery( async, @@ -46,8 +40,7 @@ from o in ss.Set().AsNoTracking() select new { c, o }, elementSorter: e => (e.c.CustomerID, e.o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Applied_to_body_clause_with_projection(bool async) => AssertQuery( async, @@ -64,8 +57,7 @@ on c.CustomerID equals o.CustomerID }, elementSorter: e => (e.CustomerID, e.o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Applied_to_projection(bool async) => AssertQuery( async, @@ -76,8 +68,7 @@ on c.CustomerID equals o.CustomerID select new { c, o }).AsNoTracking(), elementSorter: e => (e.c.CustomerID, e.o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Can_get_current_values(bool async) { using var db = CreateContext(); @@ -98,8 +89,7 @@ public virtual async Task Can_get_current_values(bool async) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_and_collection(bool async) => AssertQuery( async, @@ -108,15 +98,13 @@ public virtual Task Include_reference_and_collection(bool async) .Include(o => o.OrderDetails) .AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Applied_after_navigation_expansion(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.Customer.City != "London").AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_simple_shadow(bool async) => AssertQuery( async, @@ -124,15 +112,13 @@ public virtual Task Where_simple_shadow(bool async) .Where(e => EF.Property(e, "Title") == "Sales Representative") .AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_fast_path_when_ctor_binding(bool async) => AssertQuery( async, ss => ss.Set().AsNoTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_simple(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/NorthwindAsTrackingQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindAsTrackingQueryTestBase.cs index a3bc28ea105..2a9824031d2 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindAsTrackingQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindAsTrackingQueryTestBase.cs @@ -11,9 +11,7 @@ public abstract class NorthwindAsTrackingQueryTestBase(TFixture fixtur { protected TFixture Fixture { get; } = fixture; - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual void Entity_added_to_state_manager(bool useParam) { using var context = CreateContext(); diff --git a/test/EFCore.Specification.Tests/Query/NorthwindCompiledQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindCompiledQueryTestBase.cs index ca258ed8632..73346af6d4a 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindCompiledQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindCompiledQueryTestBase.cs @@ -34,8 +34,7 @@ public virtual void DbSet_query() [ConditionalFact] public virtual void DbSet_query_first() { - var query = EF.CompileQuery( - (NorthwindContext context) => context.Set().OrderBy(c => c.CustomerID).First()); + var query = EF.CompileQuery((NorthwindContext context) => context.Set().OrderBy(c => c.CustomerID).First()); using (var context = CreateContext()) { @@ -62,8 +61,7 @@ public virtual void Keyless_query() [ConditionalFact] public virtual void Keyless_query_first() { - var query = EF.CompileQuery( - (NorthwindContext context) => context.CustomerQueries.OrderBy(c => c.CompanyName).First()); + var query = EF.CompileQuery((NorthwindContext context) => context.CustomerQueries.OrderBy(c => c.CompanyName).First()); using (var context = CreateContext()) { @@ -74,9 +72,8 @@ public virtual void Keyless_query_first() [ConditionalFact] public virtual void Query_ending_with_include() { - var query = EF.CompileQuery( - (NorthwindContext context) - => context.Customers.Include(c => c.Orders)); + var query = EF.CompileQuery((NorthwindContext context) + => context.Customers.Include(c => c.Orders)); using (var context = CreateContext()) { @@ -108,9 +105,8 @@ public virtual void Untyped_context() [ConditionalFact] public virtual void Query_with_single_parameter() { - var query = EF.CompileQuery( - (NorthwindContext context, string customerID) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileQuery((NorthwindContext context, string customerID) + => context.Customers.Where(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -126,9 +122,8 @@ public virtual void Query_with_single_parameter() [ConditionalFact] public virtual void Query_with_single_parameter_with_include() { - var query = EF.CompileQuery( - (NorthwindContext context, string customerID) - => context.Customers.Where(c => c.CustomerID == customerID).Include(c => c.Orders)); + var query = EF.CompileQuery((NorthwindContext context, string customerID) + => context.Customers.Where(c => c.CustomerID == customerID).Include(c => c.Orders)); using (var context = CreateContext()) { @@ -144,9 +139,8 @@ public virtual void Query_with_single_parameter_with_include() [ConditionalFact] public virtual void First_query_with_single_parameter() { - var query = EF.CompileQuery( - (NorthwindContext context, string customerID) - => context.Customers.First(c => c.CustomerID == customerID)); + var query = EF.CompileQuery((NorthwindContext context, string customerID) + => context.Customers.First(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -162,9 +156,8 @@ public virtual void First_query_with_single_parameter() [ConditionalFact] public virtual void Query_with_two_parameters() { - var query = EF.CompileQuery( - (NorthwindContext context, object _, string customerID) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileQuery((NorthwindContext context, object _, string customerID) + => context.Customers.Where(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -180,9 +173,8 @@ public virtual void Query_with_two_parameters() [ConditionalFact] public virtual void Query_with_three_parameters() { - var query = EF.CompileQuery( - (NorthwindContext context, object _, int __, string customerID) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileQuery((NorthwindContext context, object _, int __, string customerID) + => context.Customers.Where(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -198,9 +190,8 @@ public virtual void Query_with_three_parameters() [ConditionalFact] public virtual void Query_with_array_parameter() { - var query = EF.CompileQuery( - (NorthwindContext context, string[] args) - => context.Customers.Where(c => c.CustomerID == args[0])); + var query = EF.CompileQuery((NorthwindContext context, string[] args) + => context.Customers.Where(c => c.CustomerID == args[0])); using (var context = CreateContext()) { @@ -216,9 +207,8 @@ public virtual void Query_with_array_parameter() [ConditionalFact] public virtual void Query_with_contains() { - var query = EF.CompileQuery( - (NorthwindContext context, string[] args) - => context.Customers.Where(c => args.Contains(c.CustomerID))); + var query = EF.CompileQuery((NorthwindContext context, string[] args) + => context.Customers.Where(c => args.Contains(c.CustomerID))); using (var context = CreateContext()) { @@ -234,10 +224,9 @@ public virtual void Query_with_contains() [ConditionalFact] public virtual void Multiple_queries() { - var query = EF.CompileQuery( - (NorthwindContext context) - => context.Customers.OrderBy(c => c.CustomerID).Select(c => c.CustomerID).FirstOrDefault() - + context.Orders.OrderBy(o => o.CustomerID).Select(o => o.CustomerID).FirstOrDefault()); + var query = EF.CompileQuery((NorthwindContext context) + => context.Customers.OrderBy(c => c.CustomerID).Select(c => c.CustomerID).FirstOrDefault() + + context.Orders.OrderBy(o => o.CustomerID).Select(o => o.CustomerID).FirstOrDefault()); using (var context = CreateContext()) { @@ -255,9 +244,8 @@ public virtual void Query_with_closure() { var customerID = "ALFKI"; - var query = EF.CompileQuery( - (NorthwindContext context) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileQuery((NorthwindContext context) + => context.Customers.Where(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -277,9 +265,8 @@ public virtual void Query_with_closure_null() { string customerID = null; - var query = EF.CompileQuery( - (NorthwindContext context) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileQuery((NorthwindContext context) + => context.Customers.Where(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -306,9 +293,8 @@ public virtual async Task DbSet_query_async() [ConditionalFact] public virtual async Task DbSet_query_first_async() { - var query = EF.CompileAsyncQuery( - (NorthwindContext context) - => context.Customers.OrderBy(c => c.CustomerID).First()); + var query = EF.CompileAsyncQuery((NorthwindContext context) + => context.Customers.OrderBy(c => c.CustomerID).First()); using (var context = CreateContext()) { @@ -335,9 +321,8 @@ public virtual async Task Keyless_query_async() [ConditionalFact] public virtual async Task Keyless_query_first_async() { - var query = EF.CompileAsyncQuery( - (NorthwindContext context) - => context.CustomerQueries.OrderBy(c => c.CompanyName).First()); + var query = EF.CompileAsyncQuery((NorthwindContext context) + => context.CustomerQueries.OrderBy(c => c.CompanyName).First()); using (var context = CreateContext()) { @@ -364,9 +349,8 @@ public virtual async Task Untyped_context_async() [ConditionalFact] public virtual async Task Query_with_single_parameter_async() { - var query = EF.CompileAsyncQuery( - (NorthwindContext context, string customerID) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileAsyncQuery((NorthwindContext context, string customerID) + => context.Customers.Where(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -382,9 +366,8 @@ public virtual async Task Query_with_single_parameter_async() [ConditionalFact] public virtual async Task First_query_with_single_parameter_async() { - var query = EF.CompileAsyncQuery( - (NorthwindContext context, string customerID) - => context.Customers.First(c => c.CustomerID == customerID)); + var query = EF.CompileAsyncQuery((NorthwindContext context, string customerID) + => context.Customers.First(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -400,9 +383,8 @@ public virtual async Task First_query_with_single_parameter_async() [ConditionalFact] public virtual async Task First_query_with_cancellation_async() { - var query = EF.CompileAsyncQuery( - (NorthwindContext context, string customerID, CancellationToken ct) - => context.Customers.First(c => c.CustomerID == customerID)); + var query = EF.CompileAsyncQuery((NorthwindContext context, string customerID, CancellationToken ct) + => context.Customers.First(c => c.CustomerID == customerID)); var cancellationToken = default(CancellationToken); @@ -420,9 +402,8 @@ public virtual async Task First_query_with_cancellation_async() [ConditionalFact] public virtual async Task Query_with_two_parameters_async() { - var query = EF.CompileAsyncQuery( - (NorthwindContext context, object _, string customerID) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileAsyncQuery((NorthwindContext context, object _, string customerID) + => context.Customers.Where(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -438,9 +419,8 @@ public virtual async Task Query_with_two_parameters_async() [ConditionalFact] public virtual async Task Query_with_three_parameters_async() { - var query = EF.CompileAsyncQuery( - (NorthwindContext context, object _, int __, string customerID) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileAsyncQuery((NorthwindContext context, object _, int __, string customerID) + => context.Customers.Where(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -456,9 +436,8 @@ public virtual async Task Query_with_three_parameters_async() [ConditionalFact] public virtual async Task Query_with_array_parameter_async() { - var query = EF.CompileAsyncQuery( - (NorthwindContext context, string[] args) - => context.Customers.Where(c => c.CustomerID == args[0])); + var query = EF.CompileAsyncQuery((NorthwindContext context, string[] args) + => context.Customers.Where(c => c.CustomerID == args[0])); using (var context = CreateContext()) { @@ -476,9 +455,8 @@ public virtual async Task Query_with_closure_async() { var customerID = "ALFKI"; - var query = EF.CompileAsyncQuery( - (NorthwindContext context) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileAsyncQuery((NorthwindContext context) + => context.Customers.Where(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -498,9 +476,8 @@ public virtual async Task Query_with_closure_async_null() { string customerID = null; - var query = EF.CompileAsyncQuery( - (NorthwindContext context) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileAsyncQuery((NorthwindContext context) + => context.Customers.Where(c => c.CustomerID == customerID)); using (var context = CreateContext()) { @@ -511,9 +488,8 @@ public virtual async Task Query_with_closure_async_null() [ConditionalFact] public virtual void Compiled_query_when_does_not_end_in_query_operator() { - var query = EF.CompileQuery( - (NorthwindContext context, string customerID) - => context.Customers.Where(c => c.CustomerID == customerID).Count() == 1); + var query = EF.CompileQuery((NorthwindContext context, string customerID) + => context.Customers.Where(c => c.CustomerID == customerID).Count() == 1); using (var context = CreateContext()) { @@ -524,9 +500,8 @@ public virtual void Compiled_query_when_does_not_end_in_query_operator() [ConditionalFact] public virtual void Compiled_query_when_using_member_on_context() { - var query = EF.CompileQuery( - (NorthwindContext context) - => context.Customers.Where(c => c.CustomerID.StartsWith(context.TenantPrefix))); + var query = EF.CompileQuery((NorthwindContext context) + => context.Customers.Where(c => c.CustomerID.StartsWith(context.TenantPrefix))); using (var context = CreateContext()) { @@ -544,258 +519,244 @@ public virtual void Compiled_query_when_using_member_on_context() [ConditionalFact] public virtual async Task Compiled_query_with_max_parameters() { - var syncEnumerableQuery = EF.CompileQuery( - ( - NorthwindContext context, - string s1, - string s2, - string s3, - string s4, - string s5, - string s6, - string s7, - string s8, - string s9, - string s10, - string s11, - string s12, - string s13, - string s14, - string s15) - => context.Set() - .Where( - c => c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15)); - - var syncIncludeEnumerableQuery = EF.CompileQuery( - ( - NorthwindContext context, - string s1, - string s2, - string s3, - string s4, - string s5, - string s6, - string s7, - string s8, - string s9, - string s10, - string s11, - string s12, - string s13, - string s14, - string s15) - => context.Set() - .Where( - c => c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15) - .Include(c => c.Orders)); - - var syncSingleResultQuery = EF.CompileQuery( - ( - NorthwindContext context, - string s1, - string s2, - string s3, - string s4, - string s5, - string s6, - string s7, - string s8, - string s9, - string s10, - string s11, - string s12, - string s13, - string s14, - string s15) - => context.Set() - .Count( - c => c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15)); - - var asyncEnumerableQuery = EF.CompileAsyncQuery( - ( - NorthwindContext context, - string s1, - string s2, - string s3, - string s4, - string s5, - string s6, - string s7, - string s8, - string s9, - string s10, - string s11, - string s12, - string s13, - string s14, - string s15) - => context.Set() - .Where( - c => c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15)); - - var asyncIncludeEnumerableQuery = EF.CompileAsyncQuery( - ( - NorthwindContext context, - string s1, - string s2, - string s3, - string s4, - string s5, - string s6, - string s7, - string s8, - string s9, - string s10, - string s11, - string s12, - string s13, - string s14, - string s15) - => context.Set() - .Where( - c => c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15) - .Include(c => c.Orders)); - - var asyncSingleResultQuery = EF.CompileAsyncQuery( - ( - NorthwindContext context, - string s1, - string s2, - string s3, - string s4, - string s5, - string s6, - string s7, - string s8, - string s9, - string s10, - string s11, - string s12, - string s13, - string s14, - string s15) - => context.Set() - .Count( - c => c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15)); - - var asyncSingleResultQueryWithCancellationToken = EF.CompileAsyncQuery( - ( - NorthwindContext context, - string s1, - string s2, - string s3, - string s4, - string s5, - string s6, - string s7, - string s8, - string s9, - string s10, - string s11, - string s12, - string s13, - string s14, - CancellationToken ct) - => context.Set() - .Count( - c => c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14)); + var syncEnumerableQuery = EF.CompileQuery(( + NorthwindContext context, + string s1, + string s2, + string s3, + string s4, + string s5, + string s6, + string s7, + string s8, + string s9, + string s10, + string s11, + string s12, + string s13, + string s14, + string s15) + => context.Set() + .Where(c => c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15)); + + var syncIncludeEnumerableQuery = EF.CompileQuery(( + NorthwindContext context, + string s1, + string s2, + string s3, + string s4, + string s5, + string s6, + string s7, + string s8, + string s9, + string s10, + string s11, + string s12, + string s13, + string s14, + string s15) + => context.Set() + .Where(c => c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15) + .Include(c => c.Orders)); + + var syncSingleResultQuery = EF.CompileQuery(( + NorthwindContext context, + string s1, + string s2, + string s3, + string s4, + string s5, + string s6, + string s7, + string s8, + string s9, + string s10, + string s11, + string s12, + string s13, + string s14, + string s15) + => context.Set() + .Count(c => c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15)); + + var asyncEnumerableQuery = EF.CompileAsyncQuery(( + NorthwindContext context, + string s1, + string s2, + string s3, + string s4, + string s5, + string s6, + string s7, + string s8, + string s9, + string s10, + string s11, + string s12, + string s13, + string s14, + string s15) + => context.Set() + .Where(c => c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15)); + + var asyncIncludeEnumerableQuery = EF.CompileAsyncQuery(( + NorthwindContext context, + string s1, + string s2, + string s3, + string s4, + string s5, + string s6, + string s7, + string s8, + string s9, + string s10, + string s11, + string s12, + string s13, + string s14, + string s15) + => context.Set() + .Where(c => c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15) + .Include(c => c.Orders)); + + var asyncSingleResultQuery = EF.CompileAsyncQuery(( + NorthwindContext context, + string s1, + string s2, + string s3, + string s4, + string s5, + string s6, + string s7, + string s8, + string s9, + string s10, + string s11, + string s12, + string s13, + string s14, + string s15) + => context.Set() + .Count(c => c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15)); + + var asyncSingleResultQueryWithCancellationToken = EF.CompileAsyncQuery(( + NorthwindContext context, + string s1, + string s2, + string s3, + string s4, + string s5, + string s6, + string s7, + string s8, + string s9, + string s10, + string s11, + string s12, + string s13, + string s14, + CancellationToken ct) + => context.Set() + .Count(c => c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14)); using var context = CreateContext(); diff --git a/test/EFCore.Specification.Tests/Query/NorthwindDbFunctionsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindDbFunctionsQueryTestBase.cs index 7e56fe46177..d5e130f7aed 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindDbFunctionsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindDbFunctionsQueryTestBase.cs @@ -9,8 +9,7 @@ namespace Microsoft.EntityFrameworkCore.Query; public abstract class NorthwindDbFunctionsQueryTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : NorthwindQueryFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Like_literal(bool async) => AssertCount( async, @@ -19,8 +18,7 @@ public virtual Task Like_literal(bool async) c => EF.Functions.Like(c.ContactName, "%M%"), c => c.ContactName.Contains("M") || c.ContactName.Contains("m")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Like_identity(bool async) => AssertCount( async, @@ -29,8 +27,7 @@ public virtual Task Like_identity(bool async) c => EF.Functions.Like(c.ContactName, c.ContactName), c => true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Like_literal_with_escape(bool async) => AssertCount( async, @@ -39,8 +36,7 @@ public virtual Task Like_literal_with_escape(bool async) c => EF.Functions.Like(c.ContactName, "!%", "!"), c => c.ContactName.Contains("%")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Like_all_literals(bool async) => AssertCount( async, @@ -49,8 +45,7 @@ public virtual Task Like_all_literals(bool async) c => EF.Functions.Like("FOO", "%O%"), c => "FOO".Contains("O") || "FOO".Contains("m")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Like_all_literals_with_escape(bool async) => AssertCount( async, diff --git a/test/EFCore.Specification.Tests/Query/NorthwindEFPropertyIncludeQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindEFPropertyIncludeQueryTestBase.cs index 6421d4bf30e..b29842a6e09 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindEFPropertyIncludeQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindEFPropertyIncludeQueryTestBase.cs @@ -12,23 +12,20 @@ public abstract class NorthwindEFPropertyIncludeQueryTestBase(TFixture { private static readonly IncludeRewritingExpressionVisitor _includeRewritingExpressionVisitor = new(); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_non_existing_navigation(bool async) => Assert.Contains( CoreStrings.InvalidIncludeExpression("Property(o, \"ArcticMonkeys\")"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(o => EF.Property(o, "ArcticMonkeys"))))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(o => EF.Property(o, "ArcticMonkeys"))))).Message); public override async Task Include_property(bool async) => Assert.Contains( CoreStrings.InvalidIncludeExpression("Property(o, \"OrderDate\")"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(o => o.OrderDate)))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(o => o.OrderDate)))).Message); public override async Task Include_closes_reader(bool async) { @@ -107,10 +104,9 @@ var orders public override async Task Include_specified_on_non_entity_not_supported(bool async) => Assert.Equal( CoreStrings.IncludeOnNonEntity("t => t.Item1.Orders"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Select(c => new Tuple(c, 5)).Include(t => t.Item1.Orders)))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Select(c => new Tuple(c, 5)).Include(t => t.Item1.Orders)))).Message); protected override Expression RewriteServerQueryExpression(Expression serverQueryExpression) { @@ -125,30 +121,26 @@ private class IncludeRewritingExpressionVisitor : ExpressionVisitor private static readonly MethodInfo _includeMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo().GetDeclaredMethods(nameof(EntityFrameworkQueryableExtensions.Include)) - .Single( - mi => - mi.GetGenericArguments().Count() == 2 - && mi.GetParameters().Any( - pi => pi.Name == "navigationPropertyPath" && pi.ParameterType != typeof(string))); + .Single(mi => + mi.GetGenericArguments().Count() == 2 + && mi.GetParameters().Any(pi => pi.Name == "navigationPropertyPath" && pi.ParameterType != typeof(string))); private static readonly MethodInfo _thenIncludeAfterReferenceMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo().GetDeclaredMethods(nameof(EntityFrameworkQueryableExtensions.ThenInclude)) - .Single( - mi => mi.GetGenericArguments().Count() == 3 - && mi.GetParameters()[0].ParameterType.GenericTypeArguments[1].IsGenericParameter); + .Single(mi => mi.GetGenericArguments().Count() == 3 + && mi.GetParameters()[0].ParameterType.GenericTypeArguments[1].IsGenericParameter); private static readonly MethodInfo _thenIncludeAfterEnumerableMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo().GetDeclaredMethods(nameof(EntityFrameworkQueryableExtensions.ThenInclude)) .Where(mi => mi.GetGenericArguments().Count() == 3) - .Single( - mi => - { - var typeInfo = mi.GetParameters()[0].ParameterType.GenericTypeArguments[1]; - return typeInfo.IsGenericType - && typeInfo.GetGenericTypeDefinition() == typeof(IEnumerable<>); - }); + .Single(mi => + { + var typeInfo = mi.GetParameters()[0].ParameterType.GenericTypeArguments[1]; + return typeInfo.IsGenericType + && typeInfo.GetGenericTypeDefinition() == typeof(IEnumerable<>); + }); private static readonly MethodInfo _propertyMethod = typeof(EF).GetTypeInfo().GetDeclaredMethod(nameof(EF.Property))!; diff --git a/test/EFCore.Specification.Tests/Query/NorthwindFunctionsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindFunctionsQueryTestBase.cs index 32241fe87d4..c66bcf4ded5 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindFunctionsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindFunctionsQueryTestBase.cs @@ -28,8 +28,7 @@ protected virtual void ClearLog() { } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_evaluation_of_uncorrelated_method_call(bool async) => AssertQuery( async, @@ -37,16 +36,14 @@ public virtual Task Client_evaluation_of_uncorrelated_method_call(bool async) .Where(od => od.UnitPrice < 7) .Where(od => Math.Abs(-10) < od.ProductID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_length_twice(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID.Length).ThenBy(c => c.CustomerID.Length).ThenBy(c => c.CustomerID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Order_by_length_twice_followed_by_projection_of_naked_collection_navigation(bool async) => AssertQuery( async, @@ -55,8 +52,7 @@ public virtual Task Order_by_length_twice_followed_by_projection_of_naked_collec assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_round_works_correctly_in_projection(bool async) => AssertQuery( async, @@ -70,8 +66,7 @@ public virtual Task Sum_over_round_works_correctly_in_projection(bool async) Assert.Equal(e.Sum, a.Sum); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_round_works_correctly_in_projection_2(bool async) => AssertQuery( async, @@ -85,8 +80,7 @@ public virtual Task Sum_over_round_works_correctly_in_projection_2(bool async) Assert.Equal(e.Sum, a.Sum); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_truncate_works_correctly_in_projection(bool async) => AssertQuery( async, @@ -100,8 +94,7 @@ public virtual Task Sum_over_truncate_works_correctly_in_projection(bool async) Assert.Equal(e.Sum, a.Sum); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Sum_over_truncate_works_correctly_in_projection_2(bool async) => AssertQuery( async, @@ -115,15 +108,13 @@ public virtual Task Sum_over_truncate_works_correctly_in_projection_2(bool async Assert.Equal(e.Sum, a.Sum); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_functions_nested(bool async) => AssertQuery( async, ss => ss.Set().Where(c => Math.Pow(c.CustomerID.Length, 2) == 25)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Static_equals_nullable_datetime_compared_to_non_nullable(bool async) { var arg = new DateTime(1996, 7, 4); @@ -133,8 +124,7 @@ public virtual Task Static_equals_nullable_datetime_compared_to_non_nullable(boo ss => ss.Set().Where(o => Equals(o.OrderDate, arg))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Static_equals_int_compared_to_long(bool async) { long arg = 10248; diff --git a/test/EFCore.Specification.Tests/Query/NorthwindGroupByQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindGroupByQueryTestBase.cs index 49a30ad2bb0..55b5901b5a3 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindGroupByQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindGroupByQueryTestBase.cs @@ -20,232 +20,194 @@ protected virtual void ClearLog() #region GroupByProperty - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Average(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Average(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Average_with_group_enumerable_projected(bool async) // Select with aggregate after grouping. Issue #18923. - => AssertTranslationFailed( - () => - AssertQueryScalar( - async, - ss => ss.Set().Where(o => o.Customer.City != "London") - .GroupBy(o => o.CustomerID, (k, es) => new { k, es }) - .Select(g => g.es.Average(int (Order o) => o.OrderID)))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => + AssertQueryScalar( + async, + ss => ss.Set().Where(o => o.Customer.City != "London") + .GroupBy(o => o.CustomerID, (k, es) => new { k, es }) + .Select(g => g.es.Average(int (o) => o.OrderID)))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Count(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_LongCount(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.LongCount())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Count_with_nulls(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => o.City).Select(g => new { City = g.Key, Faxes = g.Select(g2 => g2.Fax).Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_LongCount_with_nulls(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => o.City).Select(g => new { City = g.Key, Faxes = g.Select(g2 => g2.Fax).LongCount() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Max(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Max(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Min(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Min(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Sum(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => EF.Property(o, "CustomerID")).Select(g => g.Sum(o => o.OrderID))); + ss => ss.Set().GroupBy(o => EF.Property(o, "CustomerID")).Select(g => g.Sum(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Sum_Min_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.CustomerID).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => (e.Min, e.Max)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Key_Average(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.CustomerID).Select( - g => - new { g.Key, Average = g.Average(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => + new { g.Key, Average = g.Average(o => o.OrderID) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Key_Count(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => EF.Property(o, "CustomerID")).Select( - g => - new { g.Key, Count = g.Count() }), + ss => ss.Set().GroupBy(o => EF.Property(o, "CustomerID")).Select(g => + new { g.Key, Count = g.Count() }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Key_LongCount(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.CustomerID).Select( - g => - new { g.Key, LongCount = g.LongCount() }), + ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => + new { g.Key, LongCount = g.LongCount() }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Key_Max(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.CustomerID).Select( - g => - new { g.Key, Max = g.Max(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => + new { g.Key, Max = g.Max(o => o.OrderID) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Key_Min(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.CustomerID).Select( - g => - new { g.Key, Min = g.Min(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => + new { g.Key, Min = g.Min(o => o.OrderID) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Key_Sum(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.CustomerID).Select( - g => - new { g.Key, Sum = g.Sum(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => + new { g.Key, Sum = g.Sum(o => o.OrderID) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Key_Sum_Min_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.CustomerID).Select( - g => - new - { - g.Key, - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => + new + { + g.Key, + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Sum_Min_Key_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => EF.Property(o, "CustomerID")).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => EF.Property(o, "CustomerID")).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_key_multiple_times_and_aggregate(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.CustomerID).Select( - g => - new - { - Key1 = g.Key, - Key2 = g.Key, - Sum = g.Sum(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => + new + { + Key1 = g.Key, + Key2 = g.Key, + Sum = g.Sum(o => o.OrderID) + }), e => e.Key1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Key_with_constant(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => new { Name = "CustomerID", Value = o.CustomerID }).Select( - g => - new { g.Key, Count = g.Count() }), + ss => ss.Set().GroupBy(o => new { Name = "CustomerID", Value = o.CustomerID }).Select(g => + new { g.Key, Count = g.Count() }), e => e.Key.Value); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_projecting_conditional_expression(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.OrderDate).Select( - g => - new { g.Key, SomeValue = g.Count() == 0 ? 1 : g.Sum(o => o.OrderID % 2 == 0 ? 1 : 0) / g.Count() }), + ss => ss.Set().GroupBy(o => o.OrderDate).Select(g => + new { g.Key, SomeValue = g.Count() == 0 ? 1 : g.Sum(o => o.OrderID % 2 == 0 ? 1 : 0) / g.Count() }), e => (e.Key, e.SomeValue)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_projecting_conditional_expression_based_on_group_key(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.OrderDate).Select( - g => - new { Key = g.Key == null ? "is null" : "is not null", Sum = g.Sum(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => o.OrderDate).Select(g => + new { Key = g.Key == null ? "is null" : "is not null", Sum = g.Sum(o => o.OrderID) }), e => e.Sum); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_group_key_access_thru_navigation(bool async) => AssertQuery( async, @@ -254,8 +216,7 @@ public virtual Task GroupBy_with_group_key_access_thru_navigation(bool async) .Select(g => new { g.Key, Aggregate = g.Sum(od => od.OrderID) }), elementSorter: e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_group_key_access_thru_nested_navigation(bool async) => AssertQuery( async, @@ -264,8 +225,7 @@ public virtual Task GroupBy_with_group_key_access_thru_nested_navigation(bool as .Select(g => new { g.Key, Aggregate = g.Sum(od => od.OrderID) }), elementSorter: e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task GroupBy_with_grouping_key_using_Like(bool async) { using var context = CreateContext(); @@ -283,8 +243,7 @@ public virtual async Task GroupBy_with_grouping_key_using_Like(bool async) Assert.Equal(30, result.Single(t => t.Key).Count); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_grouping_key_DateTime_Day(bool async) => AssertQuery( async, @@ -293,24 +252,21 @@ public virtual Task GroupBy_with_grouping_key_DateTime_Day(bool async) .Select(g => new { g.Key, Count = g.Count() }), elementSorter: e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_cast_inside_grouping_aggregate(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => new - { - g.Key, - Count = g.Count(), - Sum = g.Sum(o => (long)o.OrderID) - }), + .Select(g => new + { + g.Key, + Count = g.Count(), + Sum = g.Sum(o => (long)o.OrderID) + }), elementSorter: e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_with_arithmetic_operation_inside_aggregate(bool async) => AssertQuery( async, @@ -324,8 +280,7 @@ public virtual Task Group_by_with_arithmetic_operation_inside_aggregate(bool asy Assert.Equal(e.Sum, a.Sum); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_with_projection_into_DTO(bool async) => AssertQuery( async, @@ -343,38 +298,33 @@ private class LongIntDto public int Count { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_select_function_groupby_followed_by_another_select_with_aggregates(bool async) => await AssertQuery( async, ss => ss.Set() .Where(o => o.CustomerID.StartsWith("A")) - .Select( - o => new - { - o.CustomerID, - Age = 2020 - o.OrderDate.Value.Year, - o.OrderID - }) + .Select(o => new + { + o.CustomerID, + Age = 2020 - o.OrderDate.Value.Year, + o.OrderID + }) .GroupBy(x => x.CustomerID) - .Select( - x => new - { - x.Key, - Sum1 = x.Sum(y => y.Age <= 30 ? y.OrderID : 0), - Sum2 = x.Sum(y => y.Age > 30 && y.Age <= 60 ? y.OrderID : 0) - })); + .Select(x => new + { + x.Key, + Sum1 = x.Sum(y => y.Age <= 30 ? y.OrderID : 0), + Sum2 = x.Sum(y => y.Age > 30 && y.Age <= 60 ? y.OrderID : 0) + })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Group_by_column_project_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID).OrderBy(g => g.Key).Select(e => 42)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Key_plus_key_in_projection(bool async) => AssertQuery( async, @@ -383,20 +333,16 @@ join c in ss.Set() on o.CustomerID equals c.CustomerID into grouping from c in grouping.DefaultIfEmpty() select o) .GroupBy(o => o.OrderID) - .Select( - g => new { Value = g.Key + g.Key, Average = g.Average(o => o.OrderID) })); + .Select(g => new { Value = g.Key + g.Key, Average = g.Average(o => o.OrderID) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_aggregate_through_navigation_property(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(c => c.EmployeeID).Select( - g => new { max = g.Max(i => i.Customer.Region) }), + ss => ss.Set().GroupBy(c => c.EmployeeID).Select(g => new { max = g.Max(i => i.Customer.Region) }), elementSorter: e => e.max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_aggregate_containing_complex_where(bool async) => AssertQuery( async, @@ -410,288 +356,223 @@ into tg #region GroupByAnonymousAggregate - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_anonymous_Select_Average(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID }).Select(g => g.Average(o => o.OrderID))); + ss => ss.Set().GroupBy(o => new { o.CustomerID }).Select(g => g.Average(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_anonymous_Select_Count(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID }).Select(g => g.Count())); + ss => ss.Set().GroupBy(o => new { o.CustomerID }).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_anonymous_Select_LongCount(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID }).Select(g => g.LongCount())); + ss => ss.Set().GroupBy(o => new { o.CustomerID }).Select(g => g.LongCount())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_anonymous_Select_Max(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID }).Select(g => g.Max(o => o.OrderID))); + ss => ss.Set().GroupBy(o => new { o.CustomerID }).Select(g => g.Max(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_anonymous_Select_Min(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID }).Select(g => g.Min(o => o.OrderID))); + ss => ss.Set().GroupBy(o => new { o.CustomerID }).Select(g => g.Min(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_anonymous_Select_Sum(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID }).Select(g => g.Sum(o => o.OrderID))); + ss => ss.Set().GroupBy(o => new { o.CustomerID }).Select(g => g.Sum(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_anonymous_Select_Sum_Min_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID }).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => new { o.CustomerID }).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_anonymous_with_alias_Select_Key_Sum(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { Id = o.CustomerID }).Select( - g => - new { Key = g.Key.Id, Sum = g.Sum(o => o.OrderID) })); + ss => ss.Set().GroupBy(o => new { Id = o.CustomerID }).Select(g => + new { Key = g.Key.Id, Sum = g.Sum(o => o.OrderID) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Average(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select(g => g.Average(o => o.OrderID))); + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => g.Average(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Count(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select(g => g.Count())); + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_LongCount(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select(g => g.LongCount())); + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => g.LongCount())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Max(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select(g => g.Max(o => o.OrderID))); + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => g.Max(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Min(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select(g => g.Min(o => o.OrderID))); + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => g.Min(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Sum(bool async) => AssertQueryScalar( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select(g => g.Sum(o => o.OrderID))); + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => g.Sum(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Sum_Min_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Key_Average(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new { g.Key, Average = g.Average(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new { g.Key, Average = g.Average(o => o.OrderID) }), e => e.Key.CustomerID + " " + e.Key.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Key_Count(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new { g.Key, Count = g.Count() }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new { g.Key, Count = g.Count() }), e => e.Key.CustomerID + " " + e.Key.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Key_LongCount(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new { g.Key, LongCount = g.LongCount() }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new { g.Key, LongCount = g.LongCount() }), e => e.Key.CustomerID + " " + e.Key.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Key_Max(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new { g.Key, Max = g.Max(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new { g.Key, Max = g.Max(o => o.OrderID) }), e => e.Key.CustomerID + " " + e.Key.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Key_Min(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new { g.Key, Min = g.Min(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new { g.Key, Min = g.Min(o => o.OrderID) }), e => e.Key.CustomerID + " " + e.Key.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Key_Sum(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new { g.Key, Sum = g.Sum(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new { g.Key, Sum = g.Sum(o => o.OrderID) }), e => e.Key.CustomerID + " " + e.Key.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Key_Sum_Min_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new - { - g.Key, - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new + { + g.Key, + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Sum_Min_Key_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Sum_Min_Key_flattened_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key.CustomerID, - g.Key.EmployeeID, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key.CustomerID, + g.Key.EmployeeID, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Dto_as_key_Select_Sum(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new NominalType { CustomerID = o.CustomerID, EmployeeID = o.EmployeeID }).Select( - g => - new { Sum = g.Sum(o => o.OrderID), g.Key })); + ss => ss.Set().GroupBy(o => new NominalType { CustomerID = o.CustomerID, EmployeeID = o.EmployeeID }).Select(g => + new { Sum = g.Sum(o => o.OrderID), g.Key })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Dto_as_element_selector_Select_Sum(bool async) => AssertQuery( async, ss => ss.Set().GroupBy( o => o.CustomerID, o => new NominalType { CustomerID = o.CustomerID, EmployeeID = o.EmployeeID }) - .Select( - g => - new { Sum = g.Sum(o => o.EmployeeID), g.Key })); + .Select(g => + new { Sum = g.Sum(o => o.EmployeeID), g.Key })); protected class NominalType { @@ -713,23 +594,20 @@ private bool Equals(NominalType other) && EmployeeID == other.EmployeeID; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Dto_Sum_Min_Key_flattened_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new CompositeDto - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - CustomerId = g.Key.CustomerID, - EmployeeId = g.Key.EmployeeID, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new CompositeDto + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + CustomerId = g.Key.CustomerID, + EmployeeId = g.Key.EmployeeID, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.CustomerId + " " + e.EmployeeId); protected class CompositeDto @@ -756,63 +634,53 @@ private bool Equals(CompositeDto other) && string.Equals(CustomerId, other.CustomerId); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Composite_Select_Sum_Min_part_Key_flattened_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy( - o => new { o.CustomerID, o.EmployeeID }).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key.CustomerID, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => new { o.CustomerID, o.EmployeeID }).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key.CustomerID, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Constant_Select_Sum_Min_Key_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => 2).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => 2).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Constant_with_element_selector_Select_Sum(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => 2, o => new { o.OrderID, o.OrderDate }).Select( - g => - new { Sum = g.Sum(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => 2, o => new { o.OrderID, o.OrderDate }).Select(g => + new { Sum = g.Sum(o => o.OrderID) }), e => e.Sum); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Constant_with_element_selector_Select_Sum2(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => 2, o => new { o.OrderID }).Select( - g => - new { Sum = g.Sum(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => 2, o => new { o.OrderID }).Select(g => + new { Sum = g.Sum(o => o.OrderID) }), e => e.Sum); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Constant_with_element_selector_Select_Sum3(bool async) => AssertQuery( async, @@ -822,105 +690,91 @@ public virtual Task GroupBy_Constant_with_element_selector_Select_Sum3(bool asyn o.OrderID, o.OrderDate, o.CustomerID - }).Select( - g => - new { Sum = g.Sum(o => o.OrderID) }), + }).Select(g => + new { Sum = g.Sum(o => o.OrderID) }), e => e.Sum); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_after_predicate_Constant_Select_Sum_Min_Key_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().Where(o => o.OrderID > 10500).GroupBy(o => 2).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Random = g.Key, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().Where(o => o.OrderID > 10500).GroupBy(o => 2).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Random = g.Key, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Constant_with_element_selector_Select_Sum_Min_Key_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => 2, o => o.OrderID).Select( - g => - new { Sum = g.Sum(), g.Key }), + ss => ss.Set().GroupBy(o => 2, o => o.OrderID).Select(g => + new { Sum = g.Sum(), g.Key }), e => e.Sum); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_constant_with_where_on_grouping_with_aggregate_operators(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => 1) .OrderBy(g => g.Key) - .Select( - g => new - { - Min = g.Where(i => 1 == g.Key).Min(o => o.OrderDate), - Max = g.Where(i => 1 == g.Key).Max(o => o.OrderDate), - Sum = g.Where(i => 1 == g.Key).Sum(o => o.OrderID), - Average = g.Where(i => 1 == g.Key).Average(o => o.OrderID), - })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .Select(g => new + { + Min = g.Where(i => 1 == g.Key).Min(o => o.OrderDate), + Max = g.Where(i => 1 == g.Key).Max(o => o.OrderDate), + Sum = g.Where(i => 1 == g.Key).Sum(o => o.OrderID), + Average = g.Where(i => 1 == g.Key).Average(o => o.OrderID), + })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_param_Select_Sum_Min_Key_Max_Avg(bool async) { var a = 2; return AssertQuery( async, - ss => ss.Set().GroupBy(o => a).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - }), + ss => ss.Set().GroupBy(o => a).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_param_with_element_selector_Select_Sum(bool async) { var a = 2; return AssertQuery( async, - ss => ss.Set().GroupBy(o => a, o => new { o.OrderID, o.OrderDate }).Select( - g => - new { Sum = g.Sum(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => a, o => new { o.OrderID, o.OrderDate }).Select(g => + new { Sum = g.Sum(o => o.OrderID) }), e => e.Sum); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_param_with_element_selector_Select_Sum2(bool async) { var a = 2; return AssertQuery( async, - ss => ss.Set().GroupBy(o => a, o => new { o.OrderID }).Select( - g => - new { Sum = g.Sum(o => o.OrderID) }), + ss => ss.Set().GroupBy(o => a, o => new { o.OrderID }).Select(g => + new { Sum = g.Sum(o => o.OrderID) }), e => e.Sum); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_param_with_element_selector_Select_Sum3(bool async) { var a = 2; @@ -933,28 +787,24 @@ public virtual Task GroupBy_param_with_element_selector_Select_Sum3(bool async) o.OrderID, o.OrderDate, o.CustomerID - }).Select( - g => - new { Sum = g.Sum(o => o.OrderID) }), + }).Select(g => + new { Sum = g.Sum(o => o.OrderID) }), e => e.Sum); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_param_with_element_selector_Select_Sum_Min_Key_Max_Avg(bool async) { var a = 2; return AssertQuery( async, - ss => ss.Set().GroupBy(o => a, o => o.OrderID).Select( - g => - new { Sum = g.Sum(), g.Key }), + ss => ss.Set().GroupBy(o => a, o => o.OrderID).Select(g => + new { Sum = g.Sum(), g.Key }), e => e.Sum); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_anonymous_key_type_mismatch_with_aggregate(bool async) => AssertQuery( async, @@ -963,8 +813,7 @@ public virtual Task GroupBy_anonymous_key_type_mismatch_with_aggregate(bool asyn .Select(g => new { I0 = g.Count(), I1 = g.Key.I0 }), elementSorter: a => a.I1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_based_on_renamed_property_simple(bool async) => AssertQuery( async, @@ -973,8 +822,7 @@ public virtual Task GroupBy_based_on_renamed_property_simple(bool async) .Select(x => new { x.Key, Count = x.Count() }), elementSorter: e => e.Key.Renamed); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_based_on_renamed_property_complex(bool async) => AssertQuery( async, @@ -985,8 +833,7 @@ public virtual Task GroupBy_based_on_renamed_property_complex(bool async) .Select(x => new { x.Key, Count = x.Count() }), elementSorter: e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_groupby_anonymous_orderby_anonymous_projection(bool async) => AssertQuery( async, @@ -997,17 +844,15 @@ into grouping orderby grouping.Key.OrderDate select new { grouping.Key.CustomerID, grouping.Key.OrderDate }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Odata_groupby_empty_key(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(e => new NoGroupByWrapper()) - .Select( - e => new NoGroupByAggregationWrapper - { - Container = new LastInChain { Name = "TotalAmount", Value = e.Sum(e => (decimal)e.OrderID) } - }), + .Select(e => new NoGroupByAggregationWrapper + { + Container = new LastInChain { Name = "TotalAmount", Value = e.Sum(e => (decimal)e.OrderID) } + }), assertOrder: true, elementAsserter: (e, a) => { @@ -1040,163 +885,142 @@ protected class LastInChain #region GroupByWithElementSelectorAggregate - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_scalar_element_selector_Average(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID, o => o.OrderID).Select(g => g.Average())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_scalar_element_selector_Count(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID, o => o.OrderID).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_scalar_element_selector_LongCount(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID, o => o.OrderID).Select(g => g.LongCount())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_scalar_element_selector_Max(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID, o => o.OrderID).Select(g => g.Max())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_scalar_element_selector_Min(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID, o => o.OrderID).Select(g => g.Min())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_scalar_element_selector_Sum(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID, o => o.OrderID).Select(g => g.Sum())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_scalar_element_selector_Sum_Min_Max_Avg(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(o => o.CustomerID, o => o.OrderID).Select( - g => - new - { - Sum = g.Sum(), - Min = g.Min(), - Max = g.Max(), - Avg = g.Average() - }), + ss => ss.Set().GroupBy(o => o.CustomerID, o => o.OrderID).Select(g => + new + { + Sum = g.Sum(), + Min = g.Min(), + Max = g.Max(), + Avg = g.Average() + }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_anonymous_element_selector_Average(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy( o => o.CustomerID, o => new { o.OrderID, o.EmployeeID }).Select(g => g.Average(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_anonymous_element_selector_Count(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy( o => o.CustomerID, o => new { o.OrderID, o.EmployeeID }).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_anonymous_element_selector_LongCount(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy( o => o.CustomerID, o => new { o.OrderID, o.EmployeeID }).Select(g => g.LongCount())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_anonymous_element_selector_Max(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy( o => o.CustomerID, o => new { o.OrderID, o.EmployeeID }).Select(g => g.Max(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_anonymous_element_selector_Min(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy( o => o.CustomerID, o => new { o.OrderID, o.EmployeeID }).Select(g => g.Min(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_anonymous_element_selector_Sum(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy( o => o.CustomerID, o => new { o.OrderID, o.EmployeeID }).Select(g => g.Sum(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_anonymous_element_selector_Sum_Min_Max_Avg(bool async) => AssertQuery( async, ss => ss.Set().GroupBy( - o => o.CustomerID, o => new { o.OrderID, o.EmployeeID }).Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.EmployeeID), - Max = g.Max(o => o.EmployeeID), - Avg = g.Average(o => o.OrderID) - }), + o => o.CustomerID, o => new { o.OrderID, o.EmployeeID }).Select(g => + new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.EmployeeID), + Max = g.Max(o => o.EmployeeID), + Avg = g.Average(o => o.OrderID) + }), e => e.Sum + " " + e.Avg); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_element_selector_complex_aggregate(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID, o => new { o.OrderID }) .Select(g => g.Sum(e => e.OrderID + 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_element_selector_complex_aggregate2(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID, o => new { o.OrderID, o.OrderDate }) .Select(g => g.Sum(e => e.OrderID + 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_element_selector_complex_aggregate3(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID, o => o.OrderID) .Select(g => g.Sum(e => e + 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_element_selector_complex_aggregate4(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID, o => o.OrderID + 1) .Select(g => g.Sum(e => e))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Element_selector_with_case_block_repeated_inside_another_case_block_in_projection(bool async) => AssertQuery( async, @@ -1206,8 +1030,7 @@ public virtual Task Element_selector_with_case_block_repeated_inside_another_cas into g select new { g.Key.OrderID, Aggregate = g.Sum(s => s.IsAlfki ? s.OrderId : -s.OrderId) }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_conditional_properties(bool async) { var groupByMonth = false; @@ -1242,24 +1065,21 @@ public virtual Task GroupBy_conditional_properties(bool async) #region GroupByAfterComposition - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_empty_key_Aggregate(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => new { }) .Select(g => g.Sum(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_empty_key_Aggregate_Key(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => new { }) .Select(g => new { g.Key, Sum = g.Sum(o => o.OrderID) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_GroupBy_Aggregate(bool async) => AssertQueryScalar( async, @@ -1267,8 +1087,7 @@ public virtual Task OrderBy_GroupBy_Aggregate(bool async) .GroupBy(o => o.CustomerID) .Select(g => g.Sum(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Skip_GroupBy_Aggregate(bool async) => AssertQueryScalar( async, @@ -1277,8 +1096,7 @@ public virtual Task OrderBy_Skip_GroupBy_Aggregate(bool async) .GroupBy(o => o.CustomerID) .Select(g => g.Average(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Take_GroupBy_Aggregate(bool async) => AssertQueryScalar( async, @@ -1287,8 +1105,7 @@ public virtual Task OrderBy_Take_GroupBy_Aggregate(bool async) .GroupBy(o => o.CustomerID) .Select(g => g.Min(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Skip_Take_GroupBy_Aggregate(bool async) => AssertQueryScalar( async, @@ -1298,8 +1115,7 @@ public virtual Task OrderBy_Skip_Take_GroupBy_Aggregate(bool async) .GroupBy(o => o.CustomerID) .Select(g => g.Max(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_GroupBy_Aggregate(bool async) => AssertQuery( async, @@ -1308,8 +1124,7 @@ public virtual Task Distinct_GroupBy_Aggregate(bool async) .Select(g => new { g.Key, c = g.Count() }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_projection_Distinct_GroupBy_Aggregate(bool async) => AssertQuery( async, @@ -1319,8 +1134,7 @@ public virtual Task Anonymous_projection_Distinct_GroupBy_Aggregate(bool async) .Select(g => new { g.Key, c = g.Count() }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_GroupBy_Aggregate(bool async) => AssertQuery( async, @@ -1329,8 +1143,7 @@ public virtual Task SelectMany_GroupBy_Aggregate(bool async) .Select(g => new { g.Key, c = g.Count() }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_GroupBy_Aggregate(bool async) => AssertQuery( async, @@ -1341,8 +1154,7 @@ join c in ss.Set() on o.CustomerID equals c.CustomerID .Select(g => new { g.Key, Count = g.Average(o => o.OrderID) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_required_navigation_member_Aggregate(bool async) => AssertQuery( async, @@ -1350,8 +1162,7 @@ public virtual Task GroupBy_required_navigation_member_Aggregate(bool async) .Select(g => new { CustomerId = g.Key, Count = g.Count() }), e => e.CustomerId); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_complex_GroupBy_Aggregate(bool async) => AssertQuery( async, @@ -1361,12 +1172,10 @@ join c in ss.Set().Where(c => c.CustomerID != "DRACD" && c.CustomerID .OrderBy(c => c.City).Skip(10).Take(50) on o.CustomerID equals c.CustomerID group o by c.CustomerID) - .Select( - g => new { g.Key, Count = g.Average(o => o.OrderID) }), + .Select(g => new { g.Key, Count = g.Average(o => o.OrderID) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_GroupBy_Aggregate(bool async) => AssertQuery( async, @@ -1378,12 +1187,10 @@ from o in grouping.DefaultIfEmpty() where o != null select o) .GroupBy(o => o.CustomerID) - .Select( - g => new { g.Key, Average = g.Average(o => o.OrderID) }), + .Select(g => new { g.Key, Average = g.Average(o => o.OrderID) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_GroupBy_Aggregate_2(bool async) => AssertQuery( async, @@ -1394,12 +1201,10 @@ on c.CustomerID equals o.CustomerID into grouping from o in grouping.DefaultIfEmpty() select c) .GroupBy(c => c.CustomerID) - .Select( - g => new { g.Key, Max = g.Max(c => c.City) }), + .Select(g => new { g.Key, Max = g.Max(c => c.City) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_GroupBy_Aggregate_3(bool async) => AssertQuery( async, @@ -1410,12 +1215,10 @@ on o.CustomerID equals c.CustomerID into grouping from c in grouping.DefaultIfEmpty() select o) .GroupBy(o => o.CustomerID) - .Select( - g => new { g.Key, Average = g.Average(o => o.OrderID) }), + .Select(g => new { g.Key, Average = g.Average(o => o.OrderID) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_GroupBy_Aggregate_4(bool async) => AssertQuery( async, @@ -1426,12 +1229,10 @@ on c.CustomerID equals o.CustomerID into grouping from o in grouping.DefaultIfEmpty() select c) .GroupBy(c => c.CustomerID) - .Select( - g => new { Value = g.Key, Max = g.Max(c => c.City) }), + .Select(g => new { Value = g.Key, Max = g.Max(c => c.City) }), e => e.Value); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_GroupBy_Aggregate_5(bool async) => AssertQuery( async, @@ -1442,12 +1243,10 @@ on o.CustomerID equals c.CustomerID into grouping from c in grouping.DefaultIfEmpty() select o) .GroupBy(o => o.OrderID) - .Select( - g => new { Value = g.Key, Average = g.Average(o => o.OrderID) }), + .Select(g => new { Value = g.Key, Average = g.Average(o => o.OrderID) }), e => e.Value); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_optional_navigation_member_Aggregate(bool async) => AssertQuery( async, @@ -1455,8 +1254,7 @@ public virtual Task GroupBy_optional_navigation_member_Aggregate(bool async) .Select(g => new { Country = g.Key, Count = g.Count() }), e => e.Country); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_complex_GroupBy_Aggregate(bool async) => AssertQuery( async, @@ -1469,12 +1267,10 @@ from o in grouping where o.OrderID > 10300 select o) .GroupBy(o => o.CustomerID) - .Select( - g => new { g.Key, Count = g.Average(o => o.OrderID) }), + .Select(g => new { g.Key, Count = g.Average(o => o.OrderID) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Self_join_GroupBy_Aggregate(bool async) => AssertQuery( async, @@ -1484,8 +1280,7 @@ join o2 in ss.Set() on o1.OrderID equals o2.OrderID .Select(g => new { g.Key, Count = g.Average(o => o.OrderID) }), e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_multi_navigation_members_Aggregate(bool async) => AssertQuery( async, @@ -1493,8 +1288,7 @@ public virtual Task GroupBy_multi_navigation_members_Aggregate(bool async) .Select(g => new { CompositeKey = g.Key, Count = g.Count() }), e => e.CompositeKey.CustomerID + " " + e.CompositeKey.ProductName); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_simple_groupby(bool async) => AssertQuery( async, @@ -1503,40 +1297,34 @@ public virtual Task Union_simple_groupby(bool async) .GroupBy(c => c.City) .Select(g => new { g.Key, Total = g.Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_GroupBy_Aggregate(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.OrderID < 10300) - .Select( - o => new - { - A = o.CustomerID, - B = o.OrderDate, - C = o.OrderID - }) + .Select(o => new + { + A = o.CustomerID, + B = o.OrderDate, + C = o.OrderID + }) .GroupBy(e => e.A) - .Select( - g => new - { - Min = g.Min(o => o.B), - Max = g.Max(o => o.B), - Sum = g.Sum(o => o.C), - Avg = g.Average(o => o.C) - })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .Select(g => new + { + Min = g.Min(o => o.B), + Max = g.Max(o => o.B), + Sum = g.Sum(o => o.C), + Avg = g.Average(o => o.C) + })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_principal_key_property_optimization(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => o.Customer.CustomerID) - .Select( - g => new { g.Key, Count = g.Count() })); + .Select(g => new { g.Key, Count = g.Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_after_anonymous_projection_and_distinct_followed_by_another_anonymous_projection(bool async) => AssertQuery( async, @@ -1552,8 +1340,7 @@ public virtual Task GroupBy_after_anonymous_projection_and_distinct_followed_by_ Assert.Equal(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_complex_key_aggregate(bool async) => AssertQuery( async, @@ -1567,8 +1354,7 @@ public virtual Task GroupBy_complex_key_aggregate(bool async) Assert.Equal(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_complex_key_aggregate_2(bool async) => AssertQuery( async, @@ -1580,7 +1366,7 @@ into g { s.Month, s.Total, - Payment = ss.Set().Where(e => e.OrderDate.Value.Month == s.Month).Sum(int (Order e) => e.OrderID) + Payment = ss.Set().Where(e => e.OrderDate.Value.Month == s.Month).Sum(int (e) => e.OrderID) }, elementSorter: e => (e.Month, e.Total), elementAsserter: (e, a) => @@ -1590,19 +1376,17 @@ into g Assert.Equal(e.Payment, a.Payment); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_of_scalar_before_GroupBy_aggregate(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - c.CustomerID, - c.City, - Orders = c.Orders.Select(e => e.OrderID) - }) + .Select(c => new + { + c.CustomerID, + c.City, + Orders = c.Orders.Select(e => e.OrderID) + }) .GroupBy(e => e.City) .Select(g => new { g.Key, Count = g.Count() }), elementSorter: e => (e.Key, e.Count), @@ -1616,8 +1400,7 @@ public virtual Task Select_collection_of_scalar_before_GroupBy_aggregate(bool as #region GroupByAggregateComposition - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_OrderBy_key(bool async) => AssertQuery( async, @@ -1626,8 +1409,7 @@ public virtual Task GroupBy_OrderBy_key(bool async) .Select(g => new { g.Key, c = g.Count() }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_OrderBy_count(bool async) => AssertQuery( async, @@ -1637,8 +1419,7 @@ public virtual Task GroupBy_OrderBy_count(bool async) .Select(g => new { g.Key, Count = g.Count() }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_OrderBy_count_Select_sum(bool async) => AssertQuery( async, @@ -1648,19 +1429,16 @@ public virtual Task GroupBy_OrderBy_count_Select_sum(bool async) .Select(g => new { g.Key, Sum = g.Sum(o => o.OrderID) }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_Contains(bool async) => AssertQuery( async, - ss => ss.Set().Where( - o => ss.Set().GroupBy(e => e.CustomerID) - .Where(g => g.Count() > 30) - .Select(g => g.Key) - .Contains(o.CustomerID))); + ss => ss.Set().Where(o => ss.Set().GroupBy(e => e.CustomerID) + .Where(g => g.Count() > 30) + .Select(g => g.Key) + .Contains(o.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_Pushdown(bool async) => AssertQuery( async, @@ -1671,8 +1449,7 @@ public virtual Task GroupBy_aggregate_Pushdown(bool async) .Take(20) .Skip(4)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_using_grouping_key_Pushdown(bool async) => AssertQuery( async, @@ -1683,8 +1460,7 @@ public virtual Task GroupBy_aggregate_using_grouping_key_Pushdown(bool async) .Take(20) .Skip(4)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_Pushdown_followed_by_projecting_Length(bool async) => AssertQueryScalar( async, @@ -1696,8 +1472,7 @@ public virtual Task GroupBy_aggregate_Pushdown_followed_by_projecting_Length(boo .Skip(4) .Select(e => e.Length)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_Pushdown_followed_by_projecting_constant(bool async) => AssertQueryScalar( async, @@ -1709,8 +1484,7 @@ public virtual Task GroupBy_aggregate_Pushdown_followed_by_projecting_constant(b .Skip(4) .Select(e => 5)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_filter_key(bool async) => AssertQuery( async, @@ -1718,8 +1492,7 @@ public virtual Task GroupBy_filter_key(bool async) .Where(o => o.Key == "ALFKI") .Select(g => new { g.Key, c = g.Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_filter_count(bool async) => AssertQuery( async, @@ -1727,8 +1500,7 @@ public virtual Task GroupBy_filter_count(bool async) .Where(o => o.Count() > 4) .Select(g => new { g.Key, Count = g.Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_count_filter(bool async) => AssertQuery( async, @@ -1737,8 +1509,7 @@ public virtual Task GroupBy_count_filter(bool async) .Select(g => new { Name = g.Key, Count = g.Count() }) .Where(o => o.Count > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_filter_count_OrderBy_count_Select_sum(bool async) => AssertQuery( async, @@ -1746,16 +1517,14 @@ public virtual Task GroupBy_filter_count_OrderBy_count_Select_sum(bool async) .Where(o => o.Count() > 4) .OrderBy(o => o.Count()) .ThenBy(o => o.Key) - .Select( - g => new - { - g.Key, - Count = g.Count(), - Sum = g.Sum(o => o.OrderID) - })); + .Select(g => new + { + g.Key, + Count = g.Count(), + Sum = g.Sum(o => o.OrderID) + })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Aggregate_Join(bool async) => AssertQuery( async, @@ -1767,33 +1536,30 @@ join c in ss.Set() on a.CustomerID equals c.CustomerID join o in ss.Set() on a.LastOrderID equals o.OrderID select new { c, o }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Aggregate_Join_converted_from_SelectMany(bool async) => AssertQuery( async, ss => from c in ss.Set() from o in ss.Set().GroupBy(o => o.CustomerID) .Where(g => g.Count() > 5) - .Select(g => new { CustomerID = g.Key, LastOrderID = g.Max(int (Order o) => o.OrderID) }) + .Select(g => new { CustomerID = g.Key, LastOrderID = g.Max(int (o) => o.OrderID) }) .Where(c1 => c.CustomerID == c1.CustomerID) select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Aggregate_LeftJoin_converted_from_SelectMany(bool async) => AssertQuery( async, ss => from c in ss.Set() from o in ss.Set().GroupBy(o => o.CustomerID) .Where(g => g.Count() > 5) - .Select(g => new { CustomerID = g.Key, LastOrderID = g.Max(int (Order o) => o.OrderID) }) + .Select(g => new { CustomerID = g.Key, LastOrderID = g.Max(int (o) => o.OrderID) }) .Where(c1 => c.CustomerID == c1.CustomerID) .DefaultIfEmpty() select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_GroupBy_Aggregate_multijoins(bool async) => AssertQuery( async, @@ -1806,8 +1572,7 @@ on c.CustomerID equals a.CustomerID join o in ss.Set() on a.LastOrderID equals o.OrderID select new { c, o }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_GroupBy_Aggregate_single_join(bool async) => AssertQuery( async, @@ -1819,8 +1584,7 @@ join a in ss.Set().GroupBy(o => o.CustomerID) on c.CustomerID equals a.CustomerID select new { c, a.LastOrderID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_GroupBy_Aggregate_with_another_join(bool async) => AssertQuery( async, @@ -1828,8 +1592,7 @@ public virtual Task Join_GroupBy_Aggregate_with_another_join(bool async) from c in ss.Set() join a in ss.Set().GroupBy(o => o.CustomerID) .Where(g => g.Count() > 5) - .Select( - g => new { CustomerID = g.Key, LastOrderID = g.Max(o => o.OrderID) }) + .Select(g => new { CustomerID = g.Key, LastOrderID = g.Max(o => o.OrderID) }) on c.CustomerID equals a.CustomerID join o in ss.Set() on c.CustomerID equals o.CustomerID into grouping from g in grouping @@ -1840,8 +1603,7 @@ from g in grouping g.OrderID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_GroupBy_Aggregate_distinct_single_join(bool async) => AssertQuery( async, @@ -1854,8 +1616,7 @@ from c in ss.Set() on c.CustomerID equals a.CustomerID select new { c, a.LastOrderID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_GroupBy_Aggregate_with_left_join(bool async) => AssertQuery( async, @@ -1863,8 +1624,7 @@ public virtual Task Join_GroupBy_Aggregate_with_left_join(bool async) from c in ss.Set().Where(c => c.CustomerID.StartsWith("A")) join a in ss.Set().GroupBy(o => o.CustomerID) .Where(g => g.Count() > 5) - .Select( - g => new { CustomerID = g.Key, LastOrderID = g.Max(o => o.OrderID) }) + .Select(g => new { CustomerID = g.Key, LastOrderID = g.Max(o => o.OrderID) }) on c.CustomerID equals a.CustomerID into grouping from g in grouping.DefaultIfEmpty() select new { c, LastOrderID = (int?)g.LastOrderID }, @@ -1872,15 +1632,13 @@ from g in grouping.DefaultIfEmpty() from c in ss.Set().Where(c => c.CustomerID.StartsWith("A")) join a in ss.Set().GroupBy(o => o.CustomerID) .Where(g => g.Count() > 5) - .Select( - g => new { CustomerID = g.Key, LastOrderID = g.Max(o => o.OrderID) }) + .Select(g => new { CustomerID = g.Key, LastOrderID = g.Max(o => o.OrderID) }) on c.CustomerID equals a.CustomerID into grouping from g in grouping.DefaultIfEmpty() select new { c, LastOrderID = g != null ? g.LastOrderID : (int?)null }, elementSorter: r => r.c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_GroupBy_Aggregate_in_subquery(bool async) => AssertQuery( async, @@ -1889,8 +1647,7 @@ from o in ss.Set().Where(o => o.OrderID < 10400) join i in (from c in ss.Set() join a in ss.Set().GroupBy(o => o.CustomerID) .Where(g => g.Count() > 5) - .Select( - g => new { CustomerID = g.Key, LastOrderID = g.Max(o => o.OrderID) }) + .Select(g => new { CustomerID = g.Key, LastOrderID = g.Max(o => o.OrderID) }) on c.CustomerID equals a.CustomerID select new { c, a.LastOrderID }) on o.CustomerID equals i.c.CustomerID @@ -1901,8 +1658,7 @@ on o.CustomerID equals i.c.CustomerID i.c.CustomerID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_GroupBy_Aggregate_on_key(bool async) => AssertQuery( async, @@ -1910,14 +1666,12 @@ public virtual Task Join_GroupBy_Aggregate_on_key(bool async) (from c in ss.Set() join a in ss.Set().GroupBy(o => o.CustomerID) .Where(g => g.Count() > 5) - .Select( - g => new { g.Key, LastOrderID = g.Max(o => o.OrderID) }) + .Select(g => new { g.Key, LastOrderID = g.Max(o => o.OrderID) }) on c.CustomerID equals a.Key select new { c, a.LastOrderID }), e => e.c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_result_selector(bool async) => AssertQuery( async, @@ -1936,22 +1690,19 @@ public virtual Task GroupBy_with_result_selector(bool async) }), e => e.Min + " " + e.Max); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Sum_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Sum(e => 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Sum_constant_cast(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Sum(e => 1L))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_GroupBy_OrderBy_key(bool async) => AssertQuery( async, @@ -1961,22 +1712,19 @@ public virtual Task Distinct_GroupBy_OrderBy_key(bool async) .Select(g => new { g.Key, c = g.Count() }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_with_groupby(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")) .OrderBy(c => c.CustomerID) - .Select( - c => c.Orders.Any() - ? c.Orders.GroupBy(o => o.OrderID).Select(g => g.Key).ToArray() - : Array.Empty()), + .Select(c => c.Orders.Any() + ? c.Orders.GroupBy(o => o.OrderID).Select(g => g.Key).ToArray() + : Array.Empty()), assertOrder: true, elementAsserter: (e, a) => Assert.True(e.OrderBy(x => x).SequenceEqual(a.OrderBy(x => x)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_uncorrelated_collection_with_groupby_works(bool async) => AssertQuery( async, @@ -1987,20 +1735,18 @@ public virtual Task Select_uncorrelated_collection_with_groupby_works(bool async assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_uncorrelated_collection_with_groupby_multiple_collections_work(bool async) => AssertQuery( async, ss => ss.Set() .Where(c => c.CustomerID.StartsWith("A")) .Select(c => c.Customer.City) - .Select( - c => new - { - c1 = ss.Set().GroupBy(p => p.ProductID).Select(g => g.Key).ToArray(), - c2 = ss.Set().GroupBy(p => p.ProductID).Select(g => g.Count()).ToArray() - }), + .Select(c => new + { + c1 = ss.Set().GroupBy(p => p.ProductID).Select(g => g.Key).ToArray(), + c2 = ss.Set().GroupBy(p => p.ProductID).Select(g => g.Count()).ToArray() + }), assertOrder: true, elementAsserter: (e, a) => { @@ -2008,8 +1754,7 @@ public virtual Task Select_uncorrelated_collection_with_groupby_multiple_collect AssertCollection(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_GroupBy_All(bool async) => AssertAll( async, @@ -2038,8 +1783,7 @@ public override int GetHashCode() => Order.GetHashCode(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_multiple_Count_with_predicate(bool async) => AssertQuery( async, @@ -2055,8 +1799,7 @@ into g }, elementSorter: e => e.Key.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_multiple_Sum_with_conditional_projection(bool async) => AssertQuery( async, @@ -2071,38 +1814,33 @@ into g }, elementSorter: e => e.Key.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Key_as_part_of_element_selector(bool async) => AssertQuery( async, ss => ss.Set().GroupBy( o => o.OrderID, o => new { o.OrderID, o.OrderDate }) - .Select( - g => new - { - g.Key, - Avg = g.Average(e => e.OrderID), - Max = g.Max(o => o.OrderDate) - })); + .Select(g => new + { + g.Key, + Avg = g.Average(e => e.OrderID), + Max = g.Max(o => o.OrderDate) + })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_composite_Key_as_part_of_element_selector(bool async) => AssertQuery( async, ss => ss.Set().GroupBy( o => new { o.OrderID, o.CustomerID }, o => new { o.OrderID, o.OrderDate }) - .Select( - g => new - { - g.Key, - Avg = g.Average(e => e.OrderID), - Max = g.Max(o => o.OrderDate) - })); + .Select(g => new + { + g.Key, + Avg = g.Average(e => e.OrderID), + Max = g.Max(o => o.OrderDate) + })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_order_by_skip_and_another_order_by(bool async) => AssertQueryScalar( async, @@ -2116,22 +1854,19 @@ public virtual Task GroupBy_with_order_by_skip_and_another_order_by(bool async) .Select(g => g.Sum(o => o.OrderID)) ); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_Count_with_predicate(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Count(o => o.OrderID < 10300))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Property_Select_LongCount_with_predicate(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.LongCount(o => o.OrderID < 10300))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_orderby_projection_with_coalesce_operation(bool async) => AssertQuery( async, @@ -2141,8 +1876,7 @@ public virtual Task GroupBy_orderby_projection_with_coalesce_operation(bool asyn .ThenBy(x => x.Key) .Select(x => new { Locality = x.Key ?? "Unknown", Count = x.Count() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_let_orderby_projection_with_coalesce_operation(bool async) // Select with grouping. Issue #18923. => AssertTranslationFailedWithDetails( @@ -2156,8 +1890,7 @@ public virtual Task GroupBy_let_orderby_projection_with_coalesce_operation(bool .Select(x => new { Locality = x.g.Key ?? "Unknown", Count = x.citiesCount })), CoreStrings.QuerySelectContainsGrouping); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Min_Where_optional_relationship(bool async) => AssertQuery( async, @@ -2166,8 +1899,7 @@ public virtual Task GroupBy_Min_Where_optional_relationship(bool async) .Select(g => new { g.Key, Count = g.Count() }) .Where(x => x.Count != 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Min_Where_optional_relationship_2(bool async) => AssertQuery( async, @@ -2176,8 +1908,7 @@ public virtual Task GroupBy_Min_Where_optional_relationship_2(bool async) .Select(g => new { g.Key, Count = g.Count() }) .Where(x => x.Count < 2 || x.Count > 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_over_a_subquery(bool async) => AssertQuery( async, @@ -2191,8 +1922,7 @@ public virtual Task GroupBy_aggregate_over_a_subquery(bool async) AssertEqual(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_join_with_grouping_key(bool async) => AssertQuery( async, @@ -2207,8 +1937,7 @@ public virtual Task GroupBy_aggregate_join_with_grouping_key(bool async) AssertEqual(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_join_with_group_result(bool async) => AssertQuery( async, @@ -2217,8 +1946,7 @@ public virtual Task GroupBy_aggregate_join_with_group_result(bool async) .Select(g => new { g.Key, LastOrderDate = g.Max() }) .Join(ss.Set(), o => o, i => new { Key = i.CustomerID, LastOrderDate = i.OrderDate }, (_, x) => x)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_from_right_side_of_join(bool async) => AssertQuery( async, @@ -2237,8 +1965,7 @@ on c.CustomerID equals o.Key AssertEqual(e.Max, a.Max); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_join_another_GroupBy_aggregate(bool async) => AssertQuery( async, @@ -2259,8 +1986,7 @@ public virtual Task GroupBy_aggregate_join_another_GroupBy_aggregate(bool async) }), elementSorter: o => o.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_after_skip_0_take_0(bool async) => AssertQuery( async, @@ -2271,8 +1997,7 @@ public virtual Task GroupBy_aggregate_after_skip_0_take_0(bool async) .Select(g => new { g.Key, Total = g.Count() }), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_skip_0_take_0_aggregate(bool async) => AssertQuery( async, @@ -2284,8 +2009,7 @@ public virtual Task GroupBy_skip_0_take_0_aggregate(bool async) .Select(g => new { g.Key, Total = g.Count() }), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_followed_another_GroupBy_aggregate(bool async) => AssertQuery( async, @@ -2296,28 +2020,25 @@ public virtual Task GroupBy_aggregate_followed_another_GroupBy_aggregate(bool as .Select(g => new { g.Key, Count = g.Count() }), elementSorter: o => o.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task GroupBy_aggregate_SelectMany(bool async) { - var message = (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => from o in ss.Set() - group o by o.CustomerID - into g - let id = g.Min(x => x.OrderID) - from o in ss.Set() - where o.OrderID == id - select o))).Message; + var message = (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => from o in ss.Set() + group o by o.CustomerID + into g + let id = g.Min(x => x.OrderID) + from o in ss.Set() + where o.OrderID == id + select o))).Message; Assert.Contains( CoreStrings.TranslationFailedWithDetails("", CoreStrings.QuerySelectContainsGrouping)[21..], message); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_without_selectMany_selecting_first(bool async) => AssertQuery( async, @@ -2330,8 +2051,7 @@ from o in ss.Set() where o.OrderID == id select o); - [ConditionalTheory(Skip = "Issue#27480")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#27480"), MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_left_join_GroupBy_aggregate_left_join(bool async) => AssertQuery( async, @@ -2342,7 +2062,8 @@ from oc1 in ss.Set() .Where(x => x.CustomerID == c.CustomerID).DefaultIfEmpty() group new { c.CustomerID, oc1.Count } by c.CustomerID into g - select new { CustomerID = g.Key, Count = g.Sum(int? (x) => x.Count) }).Where(x => x.CustomerID == c1.CustomerID) + select new { CustomerID = g.Key, Count = g.Sum(int? (x) => x.Count) }) + .Where(x => x.CustomerID == c1.CustomerID) .DefaultIfEmpty() select new { @@ -2357,7 +2078,8 @@ from oc1 in ss.Set() .Where(x => x.CustomerID == c.CustomerID).DefaultIfEmpty() group new { c.CustomerID, Count = oc1.MaybeScalar(e => e.Count) } by c.CustomerID into g - select new { CustomerID = g.Key, Count = g.Sum(int? (x) => x.Count) }).Where(x => x.CustomerID == c1.CustomerID) + select new { CustomerID = g.Key, Count = g.Sum(int? (x) => x.Count) }) + .Where(x => x.CustomerID == c1.CustomerID) .DefaultIfEmpty() select new { @@ -2377,8 +2099,7 @@ into g #region GroupByAggregateChainComposition - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_Average(bool async) => AssertQueryScalar( async, @@ -2387,8 +2108,7 @@ public virtual Task GroupBy_Where_Average(bool async) into g select g.Where(e => e.OrderID < 10300).Select(e => (int?)e.OrderID).Average()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_Count(bool async) => AssertQueryScalar( async, @@ -2397,8 +2117,7 @@ public virtual Task GroupBy_Where_Count(bool async) into g select g.Where(e => e.OrderID < 10300).Count()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_LongCount(bool async) => AssertQueryScalar( async, @@ -2407,8 +2126,7 @@ public virtual Task GroupBy_Where_LongCount(bool async) into g select g.Where(e => e.OrderID < 10300).LongCount()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_Max(bool async) => AssertQueryScalar( async, @@ -2417,8 +2135,7 @@ public virtual Task GroupBy_Where_Max(bool async) into g select g.Where(e => e.OrderID < 10300).Select(e => (int?)e.OrderID).Max()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_Min(bool async) => AssertQueryScalar( async, @@ -2427,8 +2144,7 @@ public virtual Task GroupBy_Where_Min(bool async) into g select g.Where(e => e.OrderID < 10300).Select(e => (int?)e.OrderID).Min()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_Sum(bool async) => AssertQueryScalar( async, @@ -2437,8 +2153,7 @@ public virtual Task GroupBy_Where_Sum(bool async) into g select g.Where(e => e.OrderID < 10300).Select(e => e.OrderID).Sum()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_Count_with_predicate(bool async) => AssertQueryScalar( async, @@ -2447,8 +2162,7 @@ public virtual Task GroupBy_Where_Count_with_predicate(bool async) into g select g.Where(e => e.OrderID < 10300).Count(e => e.OrderDate.HasValue && e.OrderDate.Value.Year == 1997)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_Where_Count(bool async) => AssertQueryScalar( async, @@ -2457,8 +2171,7 @@ public virtual Task GroupBy_Where_Where_Count(bool async) into g select g.Where(e => e.OrderID < 10300).Where(e => e.OrderDate.HasValue && e.OrderDate.Value.Year == 1997).Count()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_Select_Where_Count(bool async) => AssertQueryScalar( async, @@ -2468,8 +2181,7 @@ into g select g.Where(e => e.OrderID < 10300).Select(e => e.OrderDate).Where(e => e.HasValue && e.Value.Year == 1997) .Count()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_Select_Where_Select_Min(bool async) => AssertQueryScalar( async, @@ -2481,8 +2193,7 @@ select g.Where(e => e.OrderID < 10300) .Where(e => e.OrderDate.HasValue && e.OrderDate.Value.Year == 1997) .Select(e => (int?)e.OrderID).Min()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_multiple_Sum_with_Select_conditional_projection(bool async) => AssertQuery( async, @@ -2497,8 +2208,7 @@ into g }, elementSorter: e => e.Key.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LongCount_after_GroupBy_aggregate(bool async) => AssertSingleResult( async, @@ -2511,63 +2221,56 @@ select g.Where(e => e.OrderID < 10300).Count()).LongCount(), into g select g.Where(e => e.OrderID < 10300).Count()).LongCountAsync(default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Select_Distinct_aggregate(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - g.Key, - Average = g.Select(e => e.OrderID).Distinct().Average(), - Count = g.Select(e => e.EmployeeID).Distinct().Count(), - LongCount = g.Select(e => e.EmployeeID).Distinct().LongCount(), - Max = g.Select(e => e.OrderDate).Distinct().Max(), - Min = g.Select(e => e.OrderDate).Distinct().Min(), - Sum = g.Select(e => e.OrderID).Distinct().Sum(), - }), + .Select(g => + new + { + g.Key, + Average = g.Select(e => e.OrderID).Distinct().Average(), + Count = g.Select(e => e.EmployeeID).Distinct().Count(), + LongCount = g.Select(e => e.EmployeeID).Distinct().LongCount(), + Max = g.Select(e => e.OrderDate).Distinct().Max(), + Min = g.Select(e => e.OrderDate).Distinct().Min(), + Sum = g.Select(e => e.OrderID).Distinct().Sum(), + }), elementSorter: e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_group_Distinct_Select_Distinct_aggregate(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - g.Key, Max = g.Distinct().Select(e => e.OrderDate).Distinct().Max(), - }), + .Select(g => + new + { + g.Key, Max = g.Distinct().Select(e => e.OrderDate).Distinct().Max(), + }), elementSorter: e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_group_Where_Select_Distinct_aggregate(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - g.Key, Max = g.Where(e => e.OrderDate.HasValue).Select(e => e.OrderDate).Distinct().Max(), - }), + .Select(g => + new + { + g.Key, Max = g.Where(e => e.OrderDate.HasValue).Select(e => e.OrderDate).Distinct().Max(), + }), elementSorter: e => e.Key); #endregion #region FinalGroupBy - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity(bool async) => AssertQuery( async, @@ -2575,8 +2278,7 @@ public virtual Task Final_GroupBy_property_entity(bool async) elementSorter: e => e.Key, elementAsserter: (e, a) => AssertGrouping(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_entity(bool async) => AssertQuery( async, @@ -2584,8 +2286,7 @@ public virtual Task Final_GroupBy_entity(bool async) elementSorter: e => e.Key.CustomerID, elementAsserter: (e, a) => AssertGrouping(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_non_nullable(bool async) => AssertQuery( async, @@ -2593,18 +2294,16 @@ public virtual Task Final_GroupBy_property_entity_non_nullable(bool async) elementSorter: e => e.Key, elementAsserter: (e, a) => AssertGrouping(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_anonymous_type(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new - { - e.City, - e.ContactName, - e.ContactTitle - }).GroupBy(c => c.City), + ss => ss.Set().Select(e => new + { + e.City, + e.ContactName, + e.ContactTitle + }).GroupBy(c => c.City), elementSorter: e => e.Key, elementAsserter: (e, a) => AssertGrouping( e, a, @@ -2616,8 +2315,7 @@ public virtual Task Final_GroupBy_property_anonymous_type(bool async) AssertEqual(ee.ContactTitle, aa.ContactTitle); })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_multiple_properties_entity(bool async) => AssertQuery( async, @@ -2631,8 +2329,7 @@ public virtual Task Final_GroupBy_multiple_properties_entity(bool async) AssertEqual(ee.Region, aa.Region); })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_complex_key_entity(bool async) => AssertQuery( async, @@ -2647,8 +2344,7 @@ public virtual Task Final_GroupBy_complex_key_entity(bool async) AssertEqual(ee.Inner.Constant, aa.Inner.Constant); })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_nominal_type_entity(bool async) => AssertQuery( async, @@ -2672,8 +2368,7 @@ public int GetHashCode([DisallowNull] RandomClass obj) => HashCode.Combine(obj.City, obj.Constant); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_anonymous_type_element_selector(bool async) => AssertQuery( async, @@ -2688,8 +2383,7 @@ public virtual Task Final_GroupBy_property_anonymous_type_element_selector(bool AssertEqual(ee.ContactTitle, aa.ContactTitle); })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_Include_collection(bool async) => AssertQuery( async, @@ -2699,8 +2393,7 @@ public virtual Task Final_GroupBy_property_entity_Include_collection(bool async) e, a, elementAsserter: (ee, aa) => AssertInclude(ee, aa, new ExpectedInclude(c => c.Orders)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_projecting_collection(bool async) => AssertQuery( async, @@ -2715,8 +2408,7 @@ public virtual Task Final_GroupBy_property_entity_projecting_collection(bool asy AssertCollection(ee.Orders, aa.Orders); })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_projecting_collection_composed(bool async) => AssertQuery( async, @@ -2733,19 +2425,17 @@ public virtual Task Final_GroupBy_property_entity_projecting_collection_composed AssertCollection(ee.Orders, aa.Orders); })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_property_entity_projecting_collection_and_single_result(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Country == "USA") - .Select( - c => new - { - c.City, - Orders = c.Orders.Where(o => o.OrderID < 11000), - LastOrder = c.Orders.OrderByDescending(o => o.OrderDate).FirstOrDefault() - }) + .Select(c => new + { + c.City, + Orders = c.Orders.Where(o => o.OrderID < 11000), + LastOrder = c.Orders.OrderByDescending(o => o.OrderDate).FirstOrDefault() + }) .GroupBy(c => c.City), elementSorter: e => e.Key, elementAsserter: (e, a) => AssertGrouping( @@ -2758,8 +2448,7 @@ public virtual Task Final_GroupBy_property_entity_projecting_collection_and_sing AssertEqual(ee.LastOrder, aa.LastOrder); })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Final_GroupBy_TagWith(bool async) => AssertQuery( async, @@ -2771,71 +2460,56 @@ public virtual Task Final_GroupBy_TagWith(bool async) #region GroupByWithoutAggregate - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Where_with_grouping_result(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().GroupBy(c => c.City).Where(e => e.Key.StartsWith("s")))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().GroupBy(c => c.City).Where(e => e.Key.StartsWith("s")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_OrderBy_with_grouping_result(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().GroupBy(c => c.City).OrderBy(e => e.Key), - assertOrder: true)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().GroupBy(c => c.City).OrderBy(e => e.Key), + assertOrder: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_SelectMany(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().GroupBy(c => c.City).SelectMany(g => g))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().GroupBy(c => c.City).SelectMany(g => g))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_GroupBy_SelectMany(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().OrderBy(o => o.OrderID) - .GroupBy(o => o.CustomerID) - .SelectMany(g => g))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().OrderBy(o => o.OrderID) + .GroupBy(o => o.CustomerID) + .SelectMany(g => g))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_GroupBy_SelectMany_shadow(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().OrderBy(e => e.EmployeeID) - .GroupBy(e => e.EmployeeID) - .SelectMany(g => g) - .Select(g => EF.Property(g, "Title")))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().OrderBy(e => e.EmployeeID) + .GroupBy(e => e.EmployeeID) + .SelectMany(g => g) + .Select(g => EF.Property(g, "Title")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_orderby_take_skip_distinct_followed_by_group_key_projection(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().GroupBy(o => o.CustomerID).OrderBy(g => g.Key).Take(5).Skip(3).Distinct().Select(g => g.Key), - assertOrder: true)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().GroupBy(o => o.CustomerID).OrderBy(g => g.Key).Take(5).Skip(3).Distinct().Select(g => g.Key), + assertOrder: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Distinct(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().GroupBy(o => o.CustomerID).Distinct().Select(g => g.Key))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().GroupBy(o => o.CustomerID).Distinct().Select(g => g.Key))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_complex_key_without_aggregate(bool async) => AssertQuery( async, @@ -2849,8 +2523,7 @@ public virtual Task GroupBy_complex_key_without_aggregate(bool async) AssertCollection(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_selecting_grouping_key_list(bool async) => AssertQuery( async, @@ -2862,25 +2535,21 @@ public virtual Task GroupBy_selecting_grouping_key_list(bool async) AssertCollection(e.Data, a.Data); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_GroupBy_SelectMany(bool async) // Entity equality. Issue #15938. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().Select( - o => new ProjectedType { Order = o.OrderID, Customer = o.CustomerID }) - .GroupBy(p => p.Customer) - .SelectMany(g => g), - elementSorter: g => g.Order)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().Select(o => new ProjectedType { Order = o.OrderID, Customer = o.CustomerID }) + .GroupBy(p => p.Customer) + .SelectMany(g => g), + elementSorter: g => g.Order)); #endregion #region GroupBySelectFirst - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Shadow(bool async) => AssertQuery( async, @@ -2888,8 +2557,7 @@ public virtual Task GroupBy_Shadow(bool async) .GroupBy(e => EF.Property(e, "Title")) .Select(g => EF.Property(g.First(), "Title"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Shadow2(bool async) => AssertQuery( async, @@ -2897,8 +2565,7 @@ public virtual Task GroupBy_Shadow2(bool async) .GroupBy(e => EF.Property(e, "Title")) .Select(g => g.First())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Shadow3(bool async) => AssertQuery( async, @@ -2906,8 +2573,7 @@ public virtual Task GroupBy_Shadow3(bool async) .GroupBy(e => e.EmployeeID) .Select(g => EF.Property(g.First(), "Title"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_select_grouping_list(bool async) => AssertQuery( async, @@ -2921,8 +2587,7 @@ public virtual Task GroupBy_select_grouping_list(bool async) AssertCollection(e.List, a.List); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_select_grouping_array(bool async) => AssertQuery( async, @@ -2936,8 +2601,7 @@ public virtual Task GroupBy_select_grouping_array(bool async) AssertCollection(e.List, a.List); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_select_grouping_composed_list(bool async) => AssertQuery( async, @@ -2951,8 +2615,7 @@ public virtual Task GroupBy_select_grouping_composed_list(bool async) AssertCollection(e.List, a.List); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_select_grouping_composed_list_2(bool async) => AssertQuery( async, @@ -2970,8 +2633,7 @@ public virtual Task GroupBy_select_grouping_composed_list_2(bool async) #region GroupByEntityType - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_group_key_being_navigation(bool async) => AssertQuery( async, @@ -2985,8 +2647,7 @@ public virtual Task GroupBy_with_group_key_being_navigation(bool async) AssertEqual(e.Aggregate, a.Aggregate); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_group_key_being_nested_navigation(bool async) => AssertQuery( async, @@ -3000,8 +2661,7 @@ public virtual Task GroupBy_with_group_key_being_nested_navigation(bool async) AssertEqual(e.Aggregate, a.Aggregate); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_group_key_being_navigation_with_entity_key_projection(bool async) => AssertQuery( async, @@ -3009,22 +2669,20 @@ public virtual Task GroupBy_with_group_key_being_navigation_with_entity_key_proj .GroupBy(od => od.Order) .Select(g => g.Key)); - [ConditionalTheory(Skip = "Issue#29014")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#29014"), MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_group_key_being_navigation_with_complex_projection(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(od => od.Order) - .Select( - g => new - { - g.Key, - Id1 = g.Key.CustomerID, - Id2 = g.Key.Customer.CustomerID, - Id3 = g.Key.OrderID, - Aggregate = g.Sum(od => od.OrderID) - }), + .Select(g => new + { + g.Key, + Id1 = g.Key.CustomerID, + Id2 = g.Key.Customer.CustomerID, + Id3 = g.Key.OrderID, + Aggregate = g.Sum(od => od.OrderID) + }), elementSorter: e => e.Id3, elementAsserter: (e, a) => { @@ -3039,16 +2697,14 @@ public virtual Task GroupBy_with_group_key_being_navigation_with_complex_project #region ResultOperatorsAfterGroupBy - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_after_GroupBy_aggregate(bool async) => AssertSingleResult( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Sum(gg => gg.OrderID)).Count(), ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Sum(gg => gg.OrderID)).CountAsync(default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task MinMax_after_GroupBy_aggregate(bool async) { await AssertMin( @@ -3060,117 +2716,102 @@ await AssertMax( ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Sum(gg => gg.OrderID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_after_GroupBy_aggregate(bool async) => AssertAll( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Sum(gg => gg.OrderID)), predicate: ee => true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_after_GroupBy_aggregate2(bool async) => AssertAll( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Sum(gg => gg.OrderID)), predicate: ee => ee >= 0); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_after_GroupBy_aggregate(bool async) => AssertAny( async, ss => ss.Set().GroupBy(o => o.CustomerID).Select(g => g.Sum(gg => gg.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_after_GroupBy_without_aggregate(bool async) => AssertCount( async, ss => ss.Set().GroupBy(o => o.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_with_predicate_after_GroupBy_without_aggregate(bool async) => AssertCount( async, ss => ss.Set().GroupBy(o => o.CustomerID), g => g.Count() > 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LongCount_after_GroupBy_without_aggregate(bool async) => AssertLongCount( async, ss => ss.Set().GroupBy(o => o.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LongCount_with_predicate_after_GroupBy_without_aggregate(bool async) => AssertLongCount( async, ss => ss.Set().GroupBy(o => o.CustomerID), g => g.Count() > 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_after_GroupBy_without_aggregate(bool async) => AssertAny( async, ss => ss.Set().GroupBy(o => o.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_with_predicate_after_GroupBy_without_aggregate(bool async) => AssertAny( async, ss => ss.Set().GroupBy(o => o.CustomerID), g => g.Count() > 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_with_predicate_after_GroupBy_without_aggregate(bool async) => AssertAll( async, ss => ss.Set().GroupBy(o => o.CustomerID), g => g.Count() > 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_followed_by_another_GroupBy_aggregate(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(o => o.CustomerID) - .Select( - g => new - { - g.Key, - Count = g.Count(), - LastOrder = g.Max(e => e.OrderID) - }) + .Select(g => new + { + g.Key, + Count = g.Count(), + LastOrder = g.Max(e => e.OrderID) + }) .GroupBy(e => 1) .Select(g => new { g.Key, Count = g.Sum(e => e.Count) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Count_in_projection(bool async) => AssertQuery( async, ss => ss.Set() .Where(o => o.OrderDate.HasValue) .Select(o => new { o, OrderDetails = o.OrderDetails.Where(od => od.ProductID < 25) }) - .Select( - info => new - { - info.o.OrderID, - info.o.OrderDate, - HasOrderDetails = info.OrderDetails.Any(), - HasMultipleProducts = info.OrderDetails.GroupBy(e => e.Product.ProductName).Count() > 1 - })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .Select(info => new + { + info.o.OrderID, + info.o.OrderDate, + HasOrderDetails = info.OrderDetails.Any(), + HasMultipleProducts = info.OrderDetails.GroupBy(e => e.Product.ProductName).Count() > 1 + })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_nominal_type_count(bool async) => AssertCount( async, @@ -3187,21 +2828,19 @@ private class Result(string customerID) # region GroupByInSubquery - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_groupBy_in_subquery1(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - Key = c.CustomerID, - Subquery = c.Orders - .Select(o => new { First = o.CustomerID, Second = o.OrderID }) - .GroupBy(x => x.First) - .Select(g => new { Sum = g.Sum(int (x) => x.Second) }).ToList() - }), + .Select(c => new + { + Key = c.CustomerID, + Subquery = c.Orders + .Select(o => new { First = o.CustomerID, Second = o.OrderID }) + .GroupBy(x => x.First) + .Select(g => new { Sum = g.Sum(int (x) => x.Second) }).ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -3209,21 +2848,19 @@ public virtual Task Complex_query_with_groupBy_in_subquery1(bool async) AssertCollection(e.Subquery, a.Subquery); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_groupBy_in_subquery2(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - Key = c.CustomerID, - Subquery = c.Orders - .Select(o => new { First = o.CustomerID, Second = o.OrderID }) - .GroupBy(x => x.First) - .Select(g => new { Max = g.Max(int (x) => x.First.Length), Sum = g.Sum(int (x) => x.Second) }).ToList() - }), + .Select(c => new + { + Key = c.CustomerID, + Subquery = c.Orders + .Select(o => new { First = o.CustomerID, Second = o.OrderID }) + .GroupBy(x => x.First) + .Select(g => new { Max = g.Max(int (x) => x.First.Length), Sum = g.Sum(int (x) => x.Second) }).ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -3231,21 +2868,19 @@ public virtual Task Complex_query_with_groupBy_in_subquery2(bool async) AssertCollection(e.Subquery, a.Subquery); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_groupBy_in_subquery3(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - Key = c.CustomerID, - Subquery = ss.Set() - .Select(o => new { First = o.CustomerID, Second = o.OrderID }) - .GroupBy(x => x.First) - .Select(g => new { Max = g.Max(int (x) => x.First.Length), Sum = g.Sum(int (x) => x.Second) }).ToList() - }), + .Select(c => new + { + Key = c.CustomerID, + Subquery = ss.Set() + .Select(o => new { First = o.CustomerID, Second = o.OrderID }) + .GroupBy(x => x.First) + .Select(g => new { Max = g.Max(int (x) => x.First.Length), Sum = g.Sum(int (x) => x.Second) }).ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -3253,21 +2888,19 @@ public virtual Task Complex_query_with_groupBy_in_subquery3(bool async) AssertCollection(e.Subquery, a.Subquery, elementSorter: i => i.Sum); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_groupBy_in_subquery4(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - Key = c.CustomerID, - Subquery = c.Orders - .Select(o => new { First = o.OrderID, Second = o.Customer.City + o.CustomerID }) - .GroupBy(x => x.Second) - .Select(g => new { Sum = g.Sum(int (x) => x.First), Count = g.Count(x => x.Second.StartsWith("Lon")) }).ToList() - }), + .Select(c => new + { + Key = c.CustomerID, + Subquery = c.Orders + .Select(o => new { First = o.OrderID, Second = o.Customer.City + o.CustomerID }) + .GroupBy(x => x.Second) + .Select(g => new { Sum = g.Sum(int (x) => x.First), Count = g.Count(x => x.Second.StartsWith("Lon")) }).ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -3275,8 +2908,7 @@ public virtual Task Complex_query_with_groupBy_in_subquery4(bool async) AssertCollection(e.Subquery, a.Subquery); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_group_by_in_subquery5(bool async) => AssertQuery( async, @@ -3288,7 +2920,7 @@ into grouping { Sum = grouping.Sum(x => x.ProductID + x.OrderID * 1000), Subquery = (from c in ss.Set() - where c.CustomerID.Length < grouping.Min(int (OrderDetail x) => x.OrderID / 100) + where c.CustomerID.Length < grouping.Min(int (x) => x.OrderID / 100) orderby c.CustomerID select new { c.CustomerID, c.City }).ToList() }, @@ -3299,23 +2931,19 @@ orderby c.CustomerID AssertCollection(e.Subquery, a.Subquery, elementSorter: ee => ee.CustomerID); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_scalar_subquery(bool async) => AssertQuery( async, ss => ss.Set() - .GroupBy( - o => ss.Set() - .Where(c => c.CustomerID == o.CustomerID) - .Select(c => c.ContactName) - .FirstOrDefault()) - .Select( - g => new { g.Key, Count = g.Count() }), + .GroupBy(o => ss.Set() + .Where(c => c.CustomerID == o.CustomerID) + .Select(c => c.ContactName) + .FirstOrDefault()) + .Select(g => new { g.Key, Count = g.Count() }), elementSorter: e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_scalar_aggregate_in_set_operation(bool async) => AssertQuery( async, @@ -3328,24 +2956,22 @@ public virtual Task GroupBy_scalar_aggregate_in_set_operation(bool async) .Select(g => new { CustomerID = g.Key, Sequence = 1 })), elementSorter: e => (e.CustomerID, e.Sequence)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task AsEnumerable_in_subquery_for_GroupBy(bool async) => AssertQuery( async, ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Select( - c => new - { - Customer = c, - Orders = ss.Set() - .Where(o => o.CustomerID == c.CustomerID) - .AsEnumerable() - .GroupBy(o => o.CustomerID) - .Select(g => g.OrderByDescending(e => e.OrderDate).FirstOrDefault()) - .ToList() - }), + .Select(c => new + { + Customer = c, + Orders = ss.Set() + .Where(o => o.CustomerID == c.CustomerID) + .AsEnumerable() + .GroupBy(o => o.CustomerID) + .Select(g => g.OrderByDescending(e => e.OrderDate).FirstOrDefault()) + .ToList() + }), elementSorter: e => e.Customer.CustomerID, elementAsserter: (e, a) => { @@ -3353,63 +2979,56 @@ public virtual Task AsEnumerable_in_subquery_for_GroupBy(bool async) AssertCollection(e.Orders, a.Orders); }); - [ConditionalTheory(Skip = "Issue#27130")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#27130"), MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_from_multiple_query_in_same_projection(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(e => e.CustomerID) - .Select( - g => new - { - g.Key, - A = ss.Set().Where(e => e.City == "Seattle").GroupBy(e => e.City) - .Select(g2 => new { g2.Key, C = g2.Count() + g.Count() }) - .OrderBy(e => 1) - .FirstOrDefault() - }), + .Select(g => new + { + g.Key, + A = ss.Set().Where(e => e.City == "Seattle").GroupBy(e => e.City) + .Select(g2 => new { g2.Key, C = g2.Count() + g.Count() }) + .OrderBy(e => 1) + .FirstOrDefault() + }), elementSorter: e => e.Key); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_from_multiple_query_in_same_projection_2(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(e => e.CustomerID) - .Select( - g => new - { - g.Key, - A = ss.Set().Where(e => e.City == "Seattle").GroupBy(e => e.City) - .Select(g2 => g2.Count() + g.Min(int (Order e) => e.OrderID)) - .OrderBy(e => 1) - .FirstOrDefault() - }), + .Select(g => new + { + g.Key, + A = ss.Set().Where(e => e.City == "Seattle").GroupBy(e => e.City) + .Select(g2 => g2.Count() + g.Min(int (e) => e.OrderID)) + .OrderBy(e => 1) + .FirstOrDefault() + }), elementSorter: e => e.Key); - [ConditionalTheory(Skip = "Issue#27130")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "Issue#27130"), MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_from_multiple_query_in_same_projection_3(bool async) => AssertQuery( async, ss => ss.Set().GroupBy(e => e.CustomerID) - .Select( - g => new - { - g.Key, - A = ss.Set().Where(e => e.City == "Seattle").GroupBy(e => e.City) - .Select(g2 => g2.Count() + g.Count()) - .OrderBy(e => e) - .FirstOrDefault() - }), + .Select(g => new + { + g.Key, + A = ss.Set().Where(e => e.City == "Seattle").GroupBy(e => e.City) + .Select(g2 => g2.Count() + g.Count()) + .OrderBy(e => e) + .FirstOrDefault() + }), elementSorter: e => e.Key); #endregion #region GroupByAndDistinctWithCorrelatedCollection - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_uncorrelated_collection_with_groupby_when_outer_is_distinct(bool async) => AssertQuery( async, @@ -3417,12 +3036,11 @@ public virtual Task Select_uncorrelated_collection_with_groupby_when_outer_is_di .Where(c => c.CustomerID.StartsWith("A")) .Select(c => c.Customer.City) .Distinct() - .Select( - c => new - { - c1 = ss.Set().GroupBy(p => p.ProductID).Select(g => g.Key).ToArray(), - c2 = ss.Set().GroupBy(p => p.ProductID).Select(g => g.Count()).ToArray() - }), + .Select(c => new + { + c1 = ss.Set().GroupBy(p => p.ProductID).Select(g => g.Key).ToArray(), + c2 = ss.Set().GroupBy(p => p.ProductID).Select(g => g.Count()).ToArray() + }), assertOrder: true, elementAsserter: (e, a) => { @@ -3430,8 +3048,7 @@ public virtual Task Select_uncorrelated_collection_with_groupby_when_outer_is_di AssertCollection(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_collection_after_GroupBy_aggregate_when_identifier_does_not_change(bool async) => AssertQuery( async, @@ -3447,8 +3064,7 @@ public virtual Task Select_correlated_collection_after_GroupBy_aggregate_when_id AssertCollection(e.Orders, a.Orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_collection_after_GroupBy_aggregate_when_identifier_changes(bool async) => AssertQuery( async, @@ -3464,8 +3080,7 @@ public virtual Task Select_correlated_collection_after_GroupBy_aggregate_when_id AssertCollection(e.Orders, a.Orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_collection_after_GroupBy_aggregate_when_identifier_changes_to_complex(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/NorthwindIncludeNoTrackingQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindIncludeNoTrackingQueryTestBase.cs index 6cdf80afcc2..c5f76305d40 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindIncludeNoTrackingQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindIncludeNoTrackingQueryTestBase.cs @@ -23,74 +23,71 @@ private static readonly MethodInfo _asNoTrackingMethodInfo public override async Task Include_multi_level_reference_and_collection_predicate(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_multi_level_reference_and_collection_predicate(async))).Message); + (await Assert.ThrowsAsync(() => base.Include_multi_level_reference_and_collection_predicate(async))) + .Message); public override async Task Include_multi_level_reference_then_include_collection_predicate(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_multi_level_reference_then_include_collection_predicate(async))).Message); + (await Assert.ThrowsAsync(() + => base.Include_multi_level_reference_then_include_collection_predicate(async))).Message); public override async Task Include_multiple_references_and_collection_multi_level(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_multiple_references_and_collection_multi_level(async))).Message); + (await Assert.ThrowsAsync(() => base.Include_multiple_references_and_collection_multi_level(async))) + .Message); public override async Task Include_multiple_references_and_collection_multi_level_reverse(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_multiple_references_and_collection_multi_level_reverse(async))).Message); + (await Assert.ThrowsAsync(() + => base.Include_multiple_references_and_collection_multi_level_reverse(async))).Message); public override async Task Include_multiple_references_then_include_collection_multi_level(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_multiple_references_then_include_collection_multi_level(async))).Message); + (await Assert.ThrowsAsync(() + => base.Include_multiple_references_then_include_collection_multi_level(async))).Message); public override async Task Include_multiple_references_then_include_collection_multi_level_reverse(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_multiple_references_then_include_collection_multi_level_reverse(async))).Message); + (await Assert.ThrowsAsync(() + => base.Include_multiple_references_then_include_collection_multi_level_reverse(async))).Message); public override async Task Include_reference_and_collection_order_by(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_reference_and_collection_order_by(async))).Message); + (await Assert.ThrowsAsync(() => base.Include_reference_and_collection_order_by(async))).Message); public override async Task Include_references_and_collection_multi_level(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_references_and_collection_multi_level(async))).Message); + (await Assert.ThrowsAsync(() => base.Include_references_and_collection_multi_level(async))).Message); public override async Task Include_references_and_collection_multi_level_predicate(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_references_and_collection_multi_level_predicate(async))).Message); + (await Assert.ThrowsAsync(() => base.Include_references_and_collection_multi_level_predicate(async))) + .Message); public override async Task Include_references_then_include_collection(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_references_then_include_collection(async))).Message); + (await Assert.ThrowsAsync(() => base.Include_references_then_include_collection(async))).Message); public override async Task Include_references_then_include_collection_multi_level(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_references_then_include_collection_multi_level(async))).Message); + (await Assert.ThrowsAsync(() => base.Include_references_then_include_collection_multi_level(async))) + .Message); public override async Task Include_references_then_include_collection_multi_level_predicate(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_references_then_include_collection_multi_level_predicate(async))).Message); + (await Assert.ThrowsAsync(() + => base.Include_references_then_include_collection_multi_level_predicate(async))).Message); public override async Task Include_closes_reader(bool async) { @@ -178,14 +175,14 @@ var orders public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWithIdentityResolution(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_multi_level_reference_then_include_collection_predicate(async))).Message); + (await Assert.ThrowsAsync(() + => base.Include_multi_level_reference_then_include_collection_predicate(async))).Message); public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoTrackingWithIdentityResolution(bool async) => Assert.Equal( CoreStrings.IncludeWithCycle("Customer", "Orders"), - (await Assert.ThrowsAsync( - () => base.Include_multi_level_reference_then_include_collection_predicate(async))).Message); + (await Assert.ThrowsAsync(() + => base.Include_multi_level_reference_then_include_collection_predicate(async))).Message); protected override bool IgnoreEntryCount => true; diff --git a/test/EFCore.Specification.Tests/Query/NorthwindIncludeQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindIncludeQueryTestBase.cs index 036604132ef..4704ed8d712 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindIncludeQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindIncludeQueryTestBase.cs @@ -15,8 +15,7 @@ namespace Microsoft.EntityFrameworkCore.Query; public abstract class NorthwindIncludeQueryTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : NorthwindQueryFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_and_collection_order_by(bool async) => AssertQuery( async, @@ -26,8 +25,7 @@ public virtual Task Include_reference_and_collection_order_by(bool async) new ExpectedInclude(o => o.Customer), new ExpectedInclude(c => c.Orders, "Customer")), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_references_then_include_collection(bool async) => await AssertQuery( async, @@ -37,36 +35,29 @@ public virtual async Task Include_references_then_include_collection(bool async) new ExpectedInclude(o => o.Customer), new ExpectedInclude(c => c.Orders, "Customer"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_property_after_navigation(bool async) => Assert.Equal( CoreStrings.InvalidIncludeExpression("o.Customer.CustomerID"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(o => o.Customer.CustomerID)))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(o => o.Customer.CustomerID)))).Message); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_property(bool async) => Assert.Equal( CoreStrings.InvalidIncludeExpression("o.OrderDate"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(o => o.OrderDate)))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(o => o.OrderDate)))).Message); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_property_expression_invalid(bool async) - => Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(o => new { o.Customer, o.OrderDetails }))); + => Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(o => new { o.Customer, o.OrderDetails }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Then_include_collection_order_by_collection_column(bool async) => AssertFirstOrDefault( async, @@ -80,18 +71,15 @@ public virtual Task Then_include_collection_order_by_collection_column(bool asyn new ExpectedInclude(c => c.Orders), new ExpectedInclude(o => o.OrderDetails, "Orders"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Then_include_property_expression_invalid(bool async) - => Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Include(o => o.Orders) - .ThenInclude(o => new { o.Customer, o.OrderDetails }))); + => Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Include(o => o.Orders) + .ThenInclude(o => new { o.Customer, o.OrderDetails }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_closes_reader(bool async) { using var context = CreateContext(); @@ -107,23 +95,20 @@ public virtual async Task Include_closes_reader(bool async) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_when_result_operator(bool async) => AssertAny( async, ss => ss.Set().Include(c => c.Orders)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")).Include(c => c.Orders), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_then_reference(bool async) => AssertQuery( async, @@ -133,47 +118,41 @@ public virtual Task Include_collection_then_reference(bool async) new ExpectedInclude(p => p.OrderDetails), new ExpectedInclude(od => od.Order, "OrderDetails"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_last(bool async) => AssertLast( async, ss => ss.Set().Include(c => c.Orders).OrderBy(c => c.CompanyName), asserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_last_no_orderby(bool async) => AssertLast( async, ss => ss.Set().Include(c => c.Orders)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_skip_no_order_by(bool async) => AssertQuery( async, ss => ss.Set().Skip(10).Include(c => c.Orders), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_take_no_order_by(bool async) => AssertQuery( async, ss => ss.Set().Take(10).Include(c => c.Orders), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_skip_take_no_order_by(bool async) => AssertQuery( async, ss => ss.Set().Skip(10).Take(5).Include(c => c.Orders), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_list(bool async) => AssertQuery( async, @@ -184,16 +163,14 @@ public virtual Task Include_list(bool async) new ExpectedInclude(p => p.OrderDetails), new ExpectedInclude(od => od.Order, "OrderDetails"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_alias_generation(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.CustomerID.StartsWith("F")).Include(o => o.OrderDetails), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.OrderDetails))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_and_reference(bool async) => AssertQuery( async, @@ -202,16 +179,14 @@ public virtual Task Include_collection_and_reference(bool async) e, a, new ExpectedInclude(o => o.OrderDetails), new ExpectedInclude(o => o.Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_orderby_take(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(5).Include(c => c.Orders), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_collection_dependent_already_tracked(bool async) { using var context = CreateContext(); @@ -233,8 +208,7 @@ var customer Assert.Equal(6 + 1, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_on_additional_from_clause(bool async) => AssertQuery( async, @@ -243,8 +217,7 @@ from c2 in ss.Set().Where(c2 => c2.CustomerID.StartsWith("F")).Include select c2, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_on_additional_from_clause_with_filter(bool async) => AssertQuery( async, @@ -253,8 +226,7 @@ from c2 in ss.Set().Include(c => c.Orders).Where(c => c.CustomerID == select c2, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_on_additional_from_clause2(bool async) => AssertQuery( async, @@ -262,8 +234,7 @@ public virtual Task Include_collection_on_additional_from_clause2(bool async) from c2 in ss.Set().Include(c2 => c2.Orders) select c1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_where_skip_take_projection(bool async) => AssertQuery( async, @@ -276,8 +247,7 @@ public virtual Task Include_where_skip_take_projection(bool async) .Take(2) .Select(od => new { od.Order.CustomerID })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_join_clause_with_filter(bool async) => AssertQuery( async, @@ -287,8 +257,7 @@ where c.CustomerID.StartsWith("F") select c, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_left_join_clause_with_filter(bool async) => AssertQuery( async, @@ -299,8 +268,7 @@ where c.CustomerID.StartsWith("F") select c, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_right_join_clause_with_filter(bool async) => AssertQuery( async, @@ -311,8 +279,7 @@ public virtual Task Include_collection_with_right_join_clause_with_filter(bool a .Select(t => t.c), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_cross_join_clause_with_filter(bool async) => AssertQuery( async, @@ -322,8 +289,7 @@ where c.CustomerID.StartsWith("F") select c, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_cross_apply_with_filter(bool async) => AssertQuery( async, @@ -333,8 +299,7 @@ where c.CustomerID.StartsWith("F") select c, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_outer_apply_with_filter(bool async) => AssertQuery( async, @@ -345,8 +310,7 @@ where c.CustomerID.StartsWith("F") select c, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_outer_apply_with_filter_non_equality(bool async) => AssertQuery( async, @@ -357,8 +321,7 @@ where c.CustomerID.StartsWith("F") select c, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_on_join_clause_with_order_by_and_filter(bool async) => AssertQuery( async, @@ -370,8 +333,7 @@ orderby c.City elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_order_by_collection_column(bool async) => AssertFirstOrDefault( async, @@ -381,8 +343,7 @@ public virtual Task Include_collection_order_by_collection_column(bool async) .OrderByDescending(c => c.Orders.OrderByDescending(oo => oo.OrderDate).FirstOrDefault().OrderDate), asserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_order_by_key(bool async) => AssertQuery( async, @@ -390,8 +351,7 @@ public virtual Task Include_collection_order_by_key(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_order_by_non_key(bool async) => AssertQuery( async, @@ -399,16 +359,14 @@ public virtual Task Include_collection_order_by_non_key(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_order_by_non_key_with_take(bool async) => AssertQuery( async, ss => ss.Set().Include(c => c.Orders).OrderBy(c => c.ContactTitle).Take(10), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_order_by_non_key_with_skip(bool async) => AssertQuery( async, @@ -416,16 +374,14 @@ public virtual Task Include_collection_order_by_non_key_with_skip(bool async) .Skip(2), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_order_by_non_key_with_first_or_default(bool async) => AssertFirstOrDefault( async, ss => ss.Set().Include(c => c.Orders).OrderByDescending(c => c.CompanyName), asserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_order_by_subquery(bool async) => AssertFirstOrDefault( async, @@ -435,8 +391,7 @@ public virtual Task Include_collection_order_by_subquery(bool async) .OrderBy(c => c.Orders.OrderBy(o => o.EmployeeID).Select(o => o.OrderDate).FirstOrDefault()), asserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_collection_principal_already_tracked(bool async) { using var context = CreateContext(); @@ -458,39 +413,34 @@ var customer2 Assert.Equal(7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_single_or_default_no_result(bool async) => AssertSingleOrDefault( async, ss => ss.Set().Include(c => c.Orders), c => c.CustomerID == "ALFKI ?"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_when_projection(bool async) => AssertQuery( async, ss => ss.Set().Include("Orders").Select(c => c.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_filter(bool async) => AssertQuery( async, ss => ss.Set().Include(c => c.Orders).Where(c => c.CustomerID == "ALFKI"), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_filter_reordered(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID == "ALFKI").Include(c => c.Orders), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_duplicate_collection(bool async) => AssertQuery( async, @@ -504,8 +454,7 @@ from c2 in ss.Set().Include(c => c.Orders).OrderBy(c => c.CustomerID). AssertInclude(e.c2, a.c2, new ExpectedInclude(c => c.Orders)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_duplicate_collection_result_operator(bool async) => AssertQuery( async, @@ -519,8 +468,7 @@ from c2 in ss.Set().Include(c => c.Orders).OrderBy(c => c.CustomerID). AssertInclude(e.c2, a.c2, new ExpectedInclude(c => c.Orders)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_duplicate_collection_result_operator2(bool async) => AssertQuery( async, @@ -534,8 +482,7 @@ from c2 in ss.Set().OrderBy(c => c.CustomerID).Skip(2).Take(2) AssertEqual(e.c2, a.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_duplicate_reference(bool async) => AssertQuery( async, @@ -549,8 +496,7 @@ from o2 in ss.Set().Include(o => o.Customer).OrderBy(o => o.CustomerID).T AssertInclude(e.o2, a.o2, new ExpectedInclude(c => c.Customer)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_duplicate_reference2(bool async) => AssertQuery( async, @@ -564,8 +510,7 @@ from o2 in ss.Set().OrderBy(o => o.OrderID).Skip(2).Take(2) AssertEqual(e.o2, a.o2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_duplicate_reference3(bool async) => AssertQuery( async, @@ -579,21 +524,18 @@ from o2 in ss.Set().OrderBy(o => o.OrderID).Include(o => o.Customer).Skip AssertInclude(e.o2, a.o2, new ExpectedInclude(c => c.Customer)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_collection_with_client_filter(bool async) => Assert.Contains( CoreStrings.TranslationFailedWithDetails( "", CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer)))[21..], - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(c => c.Orders).Where(c => c.IsLondon)))) + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(c => c.Orders).Where(c => c.IsLondon)))) .Message.Replace("\r", "").Replace("\n", "")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multi_level_reference_and_collection_predicate(bool async) => AssertSingle( async, @@ -604,8 +546,7 @@ public virtual Task Include_multi_level_reference_and_collection_predicate(bool new ExpectedInclude(o => o.Customer), new ExpectedInclude(c => c.Orders, "Customer"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multi_level_collection_and_then_include_reference_predicate(bool async) => AssertSingle( async, @@ -616,8 +557,7 @@ public virtual Task Include_multi_level_collection_and_then_include_reference_pr new ExpectedInclude(o => o.OrderDetails), new ExpectedInclude(od => od.Product, "OrderDetails"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_references(bool async) => AssertQuery( async, @@ -627,8 +567,7 @@ public virtual Task Include_multiple_references(bool async) new ExpectedInclude(od => od.Order), new ExpectedInclude(od => od.Product))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_references_and_collection_multi_level(bool async) => AssertQuery( async, @@ -641,8 +580,7 @@ public virtual Task Include_multiple_references_and_collection_multi_level(bool new ExpectedInclude(c => c.Orders, "Order.Customer"), new ExpectedInclude(od => od.Product))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_references_and_collection_multi_level_reverse(bool async) => AssertQuery( async, @@ -655,8 +593,7 @@ public virtual Task Include_multiple_references_and_collection_multi_level_rever new ExpectedInclude(c => c.Orders, "Order.Customer"), new ExpectedInclude(od => od.Product))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_references_multi_level(bool async) => AssertQuery( async, @@ -667,8 +604,7 @@ public virtual Task Include_multiple_references_multi_level(bool async) new ExpectedInclude(o => o.Customer, "Order"), new ExpectedInclude(od => od.Product))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_references_multi_level_reverse(bool async) => AssertQuery( async, @@ -679,24 +615,21 @@ public virtual Task Include_multiple_references_multi_level_reverse(bool async) new ExpectedInclude(o => o.Customer, "Order"), new ExpectedInclude(od => od.Product))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.CustomerID.StartsWith("F")).Include(o => o.Customer), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_reference_alias_generation(bool async) => await AssertQuery( async, ss => ss.Set().Where(od => od.OrderID % 23 == 13).Include(o => o.Order), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(od => od.Order))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_and_collection(bool async) => AssertQuery( async, @@ -706,8 +639,7 @@ public virtual Task Include_reference_and_collection(bool async) new ExpectedInclude(o => o.Customer), new ExpectedInclude(o => o.OrderDetails))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_force_alias_uniquefication(bool async) => AssertQuery( async, @@ -716,8 +648,7 @@ public virtual Task Include_collection_force_alias_uniquefication(bool async) select o, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.OrderDetails))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_reference_dependent_already_tracked(bool async) { using var context = CreateContext(); @@ -734,8 +665,7 @@ var orders Assert.Equal(7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_single_or_default_when_no_result(bool async) => AssertSingleOrDefault( async, @@ -743,15 +673,13 @@ public virtual Task Include_reference_single_or_default_when_no_result(bool asyn o => o.OrderID == -1, asserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_when_projection(bool async) => AssertQuery( async, ss => ss.Set().Include(o => o.Customer).Select(o => o.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_when_entity_in_projection(bool async) => AssertQuery( async, @@ -764,24 +692,21 @@ public virtual Task Include_reference_when_entity_in_projection(bool async) AssertEqual(e.CustomerID, a.CustomerID); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_filter(bool async) => AssertQuery( async, ss => ss.Set().Include(o => o.Customer).Where(o => o.CustomerID == "ALFKI"), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_with_filter_reordered(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.CustomerID == "ALFKI").Include(o => o.Customer), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_references_and_collection_multi_level(bool async) => AssertQuery( async, @@ -792,8 +717,7 @@ public virtual Task Include_references_and_collection_multi_level(bool async) new ExpectedInclude(o => o.Customer, "Order"), new ExpectedInclude(c => c.Orders, "Order.Customer"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_then_include_collection(bool async) => AssertQuery( async, @@ -803,8 +727,7 @@ public virtual Task Include_collection_then_include_collection(bool async) new ExpectedInclude(c => c.Orders), new ExpectedInclude(o => o.OrderDetails, "Orders"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_then_include_collection_then_include_reference(bool async) => AssertQuery( async, @@ -816,8 +739,7 @@ public virtual Task Include_collection_then_include_collection_then_include_refe new ExpectedInclude(o => o.OrderDetails, "Orders"), new ExpectedInclude(od => od.Product, "Orders.OrderDetails"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_then_include_collection_predicate(bool async) => AssertSingleOrDefault( async, @@ -828,8 +750,7 @@ public virtual Task Include_collection_then_include_collection_predicate(bool as new ExpectedInclude(c => c.Orders), new ExpectedInclude(o => o.OrderDetails, "Orders"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_references_and_collection_multi_level_predicate(bool async) => AssertQuery( async, @@ -840,8 +761,7 @@ public virtual Task Include_references_and_collection_multi_level_predicate(bool new ExpectedInclude(o => o.Customer, "Order"), new ExpectedInclude(c => c.Orders, "Order.Customer"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_references_multi_level(bool async) => AssertQuery( async, @@ -851,8 +771,7 @@ public virtual Task Include_references_multi_level(bool async) new ExpectedInclude(od => od.Order), new ExpectedInclude(o => o.Customer, "Order"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multi_level_reference_then_include_collection_predicate(bool async) => AssertSingle( async, @@ -863,8 +782,7 @@ public virtual Task Include_multi_level_reference_then_include_collection_predic new ExpectedInclude(o => o.Customer), new ExpectedInclude(c => c.Orders, "Customer"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_references_then_include_collection_multi_level(bool async) => AssertQuery( async, @@ -879,8 +797,7 @@ public virtual Task Include_multiple_references_then_include_collection_multi_le new ExpectedInclude(c => c.Orders, "Order.Customer"), new ExpectedInclude(od => od.Product))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_references_then_include_collection_multi_level_reverse(bool async) => AssertQuery( async, @@ -895,8 +812,7 @@ public virtual Task Include_multiple_references_then_include_collection_multi_le new ExpectedInclude(c => c.Orders, "Order.Customer"), new ExpectedInclude(od => od.Product))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_references_then_include_multi_level(bool async) => AssertQuery( async, @@ -910,8 +826,7 @@ public virtual Task Include_multiple_references_then_include_multi_level(bool as new ExpectedInclude(o => o.Customer, "Order"), new ExpectedInclude(od => od.Product))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_multiple_references_then_include_multi_level_reverse(bool async) => AssertQuery( async, @@ -925,8 +840,7 @@ public virtual Task Include_multiple_references_then_include_multi_level_reverse new ExpectedInclude(o => o.Customer, "Order"), new ExpectedInclude(od => od.Product))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_references_then_include_collection_multi_level(bool async) => AssertQuery( async, @@ -941,8 +855,7 @@ public virtual Task Include_references_then_include_collection_multi_level(bool new ExpectedInclude(o => o.Customer, "Order"), new ExpectedInclude(c => c.Orders, "Order.Customer"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_references_then_include_collection_multi_level_predicate(bool async) => AssertQuery( async, @@ -957,8 +870,7 @@ public virtual Task Include_references_then_include_collection_multi_level_predi new ExpectedInclude(o => o.Customer, "Order"), new ExpectedInclude(c => c.Orders, "Order.Customer"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_references_then_include_multi_level(bool async) => AssertQuery( async, @@ -971,16 +883,14 @@ public virtual Task Include_references_then_include_multi_level(bool async) new ExpectedInclude(od => od.Order), new ExpectedInclude(o => o.Customer, "Order"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_complex_projection(bool async) => AssertQuery( async, ss => from o in ss.Set().Include(o => o.Customer) select new { CustomerId = new { Id = o.Customer.CustomerID } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_complex_projection_does_not_change_ordering_of_projection(bool async) => AssertQuery( async, @@ -988,24 +898,21 @@ public virtual Task Include_with_complex_projection_does_not_change_ordering_of_ select new { Id = c.CustomerID, TotalOrders = c.Orders.Count }) .Where(e => e.TotalOrders > 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_take(bool async) => AssertQuery( async, ss => ss.Set().OrderByDescending(c => c.ContactName).Include(c => c.Orders).Take(10), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_skip(bool async) => AssertQuery( async, ss => ss.Set().Include(c => c.Orders).OrderBy(c => c.ContactName).Skip(80), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_multiple_conditional_order_by(bool async) => AssertQuery( async, @@ -1016,8 +923,7 @@ public virtual Task Include_collection_with_multiple_conditional_order_by(bool a .Take(5), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.OrderDetails))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_with_conditional_order_by(bool async) => AssertQuery( async, @@ -1029,18 +935,15 @@ public virtual Task Include_collection_with_conditional_order_by(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders)), elementSorter: e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_specified_on_non_entity_not_supported(bool async) => Assert.Equal( CoreStrings.IncludeOnNonEntity("t => t.Item1.Orders"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Select(c => new Tuple(c, 5)).Include(t => t.Item1.Orders)))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Select(c => new Tuple(c, 5)).Include(t => t.Item1.Orders)))).Message); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_GroupBy_Select(bool async) => AssertQuery( async, @@ -1050,8 +953,7 @@ public virtual Task Include_collection_GroupBy_Select(bool async) .GroupBy(e => e.OrderID) .Select(e => e.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_GroupBy_Select(bool async) => AssertQuery( async, @@ -1061,8 +963,7 @@ public virtual Task Include_reference_GroupBy_Select(bool async) .GroupBy(e => e.OrderID) .Select(e => e.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_Join_GroupBy_Select(bool async) => AssertQuery( async, @@ -1077,8 +978,7 @@ public virtual Task Include_collection_Join_GroupBy_Select(bool async) .GroupBy(e => e.OrderID) .Select(e => e.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_Join_GroupBy_Select(bool async) => AssertQuery( async, @@ -1093,8 +993,7 @@ public virtual Task Include_reference_Join_GroupBy_Select(bool async) .GroupBy(e => e.OrderID) .Select(e => e.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_Include_collection_GroupBy_Select(bool async) => AssertQuery( async, @@ -1108,8 +1007,7 @@ public virtual Task Join_Include_collection_GroupBy_Select(bool async) .GroupBy(e => e.OrderID) .Select(e => e.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_Include_reference_GroupBy_Select(bool async) => AssertQuery( async, @@ -1122,8 +1020,7 @@ public virtual Task Join_Include_reference_GroupBy_Select(bool async) .GroupBy(e => e.OrderID) .Select(e => e.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_SelectMany_GroupBy_Select(bool async) => AssertQuery( async, @@ -1133,8 +1030,7 @@ from od in ss.Set() .GroupBy(e => e.OrderID) .Select(e => e.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_SelectMany_GroupBy_Select(bool async) => AssertQuery( async, @@ -1144,8 +1040,7 @@ from od in ss.Set() .GroupBy(e => e.OrderID) .Select(e => e.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Include_collection_GroupBy_Select(bool async) => AssertQuery( async, @@ -1155,8 +1050,7 @@ from o in ss.Set().Include(o => o.OrderDetails) .GroupBy(e => e.OrderID) .Select(e => e.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Include_reference_GroupBy_Select(bool async) => AssertQuery( async, @@ -1166,16 +1060,14 @@ from o in ss.Set().Include(o => o.Customer) .GroupBy(e => e.OrderID) .Select(e => e.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_reference_distinct_is_server_evaluated(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.OrderID < 10250).Include(o => o.Customer).Distinct(), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_distinct_is_server_evaluated(bool async) => AssertQuery( async, @@ -1185,8 +1077,7 @@ public virtual Task Include_collection_distinct_is_server_evaluated(bool async) .Distinct(), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_OrderBy_object(bool async) => AssertQuery( async, @@ -1197,8 +1088,7 @@ public virtual Task Include_collection_OrderBy_object(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.OrderDetails)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_OrderBy_empty_list_contains(bool async) { var list = new List(); @@ -1212,8 +1102,7 @@ public virtual Task Include_collection_OrderBy_empty_list_contains(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_OrderBy_empty_list_does_not_contains(bool async) { var list = new List(); @@ -1227,8 +1116,7 @@ public virtual Task Include_collection_OrderBy_empty_list_does_not_contains(bool elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_OrderBy_list_contains(bool async) { var list = new List { "ALFKI" }; @@ -1242,8 +1130,7 @@ public virtual Task Include_collection_OrderBy_list_contains(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection_OrderBy_list_does_not_contains(bool async) { var list = new List { "ALFKI" }; @@ -1257,8 +1144,7 @@ public virtual Task Include_collection_OrderBy_list_does_not_contains(bool async elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_empty_reference_sets_IsLoaded(bool async) => AssertFirst( async, @@ -1266,8 +1152,7 @@ public virtual Task Include_empty_reference_sets_IsLoaded(bool async) e => e.Manager == null, asserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(emp => emp.Manager))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_is_not_ignored_when_projection_contains_client_method_and_complex_expression(bool async) => AssertQuery( async, @@ -1280,8 +1165,7 @@ private static string ClientMethod(Employee e) => e.FirstName + " reports to " + e.Manager.FirstName; // Issue#18672 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multi_level_includes_are_applied_with_skip(bool async) => AssertFirst( async, @@ -1297,8 +1181,7 @@ orderby c.CustomerID elementAsserter: (eo, ao) => AssertInclude(eo, ao, new ExpectedInclude(o => o.OrderDetails))); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multi_level_includes_are_applied_with_take(bool async) => AssertFirst( async, @@ -1314,8 +1197,7 @@ orderby c.CustomerID elementAsserter: (eo, ao) => AssertInclude(eo, ao, new ExpectedInclude(o => o.OrderDetails))); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multi_level_includes_are_applied_with_skip_take(bool async) => AssertFirst( async, @@ -1331,8 +1213,7 @@ orderby c.CustomerID elementAsserter: (eo, ao) => AssertInclude(eo, ao, new ExpectedInclude(o => o.OrderDetails))); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filtered_include_with_multiple_ordering(bool async) => AssertQuery( async, @@ -1345,8 +1226,7 @@ public virtual Task Filtered_include_with_multiple_ordering(bool async) includeFilter: os => os.OrderBy(o => o.OrderID).Skip(1).OrderByDescending(o => o.OrderDate), assertOrder: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_cycle_does_not_throw_when_AsNoTrackingWithIdentityResolution(bool async) => AssertQuery( async, @@ -1355,8 +1235,7 @@ where i.OrderID < 10800 select i) .AsNoTrackingWithIdentityResolution()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_cycle_does_not_throw_when_AsTracking_NoTrackingWithIdentityResolution(bool async) => AssertQuery( async, @@ -1365,8 +1244,7 @@ where i.OrderID < 10800 select i) .AsTracking(QueryTrackingBehavior.NoTrackingWithIdentityResolution)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Outer_identifier_correctly_determined_when_doing_include_on_right_side_of_left_join(bool async) => AssertQuery( async, @@ -1383,8 +1261,7 @@ from order in group1.DefaultIfEmpty() AssertInclude(e.order, a.order, new ExpectedInclude(e => e.OrderDetails)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_in_let_followed_by_FirstOrDefault(bool async) => AssertQuery( async, @@ -1398,8 +1275,7 @@ where c.CustomerID.StartsWith("F") elementSorter: e => e.CustomerID, elementAsserter: (e, a) => AssertEqual(e.Order, a.Order)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Repro9735(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/NorthwindJoinQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindJoinQueryTestBase.cs index 7cac68eb4b8..dd967822128 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindJoinQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindJoinQueryTestBase.cs @@ -18,8 +18,7 @@ protected virtual void ClearLog() { } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_customers_orders_projection(bool async) => AssertQuery( async, @@ -29,8 +28,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID select new { c.ContactName, o.OrderID }, e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_customers_orders_entities(bool async) => AssertQuery( async, @@ -40,8 +38,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID select new { c, o }, e => (e.c.CustomerID, e.o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_customers_orders_entities_same_entity_twice(bool async) => AssertQuery( async, @@ -51,40 +48,41 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID select new { A = c, B = c }, e => (e.A.CustomerID, e.B.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_select_many(bool async) => AssertQuery( async, ss => from c in ss.Set().Where(c => c.CustomerID.StartsWith("F")) join o in ss.Set() on c.CustomerID equals o.CustomerID from e in ss.Set() - select new { c, o, e }, + select new + { + c, + o, + e + }, e => (e.c.CustomerID, e.o.OrderID, e.e.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_Join_select_many(bool async) // Translation failed message. Issue #17328. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from e1 in ss.Set().OrderBy(e => e.EmployeeID).Take(2) - join e2 in ss.Set().OrderBy(e => e.EmployeeID).Take(2) on e1.EmployeeID equals GetEmployeeID(e2) - from e3 in ss.Set().OrderBy(e => e.EmployeeID).Skip(6).Take(2) - select new - { - e1, - e2, - e3 - }, - e => (e.e1.EmployeeID, e.e2.EmployeeID, e.e3.EmployeeID))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from e1 in ss.Set().OrderBy(e => e.EmployeeID).Take(2) + join e2 in ss.Set().OrderBy(e => e.EmployeeID).Take(2) on e1.EmployeeID equals GetEmployeeID(e2) + from e3 in ss.Set().OrderBy(e => e.EmployeeID).Skip(6).Take(2) + select new + { + e1, + e2, + e3 + }, + e => (e.e1.EmployeeID, e.e2.EmployeeID, e.e3.EmployeeID))); private static uint GetEmployeeID(Employee employee) => employee.EmployeeID; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_customers_orders_select(bool async) => AssertQuery( async, @@ -96,8 +94,7 @@ into p select p, e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_customers_orders_with_subquery(bool async) => AssertQuery( async, @@ -109,8 +106,7 @@ join o1 in select new { c.ContactName, o1.OrderID }, e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_customers_orders_with_subquery_with_take(bool async) => AssertQuery( async, @@ -122,8 +118,7 @@ join o1 in select new { c.ContactName, o1.OrderID }, e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_customers_orders_with_subquery_anonymous_property_method(bool async) => AssertQuery( async, @@ -142,8 +137,7 @@ where EF.Property(o1.o2, "CustomerID") == "ALFKI" }, e => e.o1.o2.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_customers_orders_with_subquery_anonymous_property_method_with_take(bool async) => AssertQuery( async, @@ -162,8 +156,7 @@ where EF.Property(o1.o2, "CustomerID") == "HANAR" }, e => e.o1.o2.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_customers_orders_with_subquery_predicate(bool async) => AssertQuery( async, @@ -175,8 +168,7 @@ join o1 in select new { c.ContactName, o1.OrderID }, e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_customers_orders_with_subquery_predicate_with_take(bool async) => AssertQuery( async, @@ -189,8 +181,7 @@ join o1 in select new { c.ContactName, o1.OrderID }, e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_composite_key(bool async) => AssertQuery( async, @@ -201,8 +192,7 @@ from c in ss.Set().Where(c => c.CustomerID.StartsWith("F")) select new { c, o }, e => e.o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_complex_condition(bool async) => AssertQuery( async, @@ -211,8 +201,7 @@ from c in ss.Set().Where(c => c.CustomerID == "ALFKI") join o in ss.Set().Where(o => o.OrderID < 10250) on true equals true select c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Join_local_collection_int_closure_is_cached_correctly(bool async) { var ids = new uint[] { 1, 2 }; @@ -230,51 +219,44 @@ join id in ids on e.EmployeeID equals id select e.EmployeeID); } - [ConditionalTheory(Skip = "#30677")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "#30677"), MemberData(nameof(IsAsyncData))] public virtual async Task Join_local_string_closure_is_cached_correctly(bool async) { var ids = "12"; - await AssertTranslationFailed( - () => AssertQueryScalar( - async, - ss => from e in ss.Set() - join id in ids on e.EmployeeID equals id - select e.EmployeeID)); + await AssertTranslationFailed(() => AssertQueryScalar( + async, + ss => from e in ss.Set() + join id in ids on e.EmployeeID equals id + select e.EmployeeID)); ids = "3"; - await AssertTranslationFailed( - () => AssertQueryScalar( - async, - ss => from e in ss.Set() - join id in ids on e.EmployeeID equals id - select e.EmployeeID)); + await AssertTranslationFailed(() => AssertQueryScalar( + async, + ss => from e in ss.Set() + join id in ids on e.EmployeeID equals id + select e.EmployeeID)); } - [ConditionalTheory(Skip = "#30677")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "#30677"), MemberData(nameof(IsAsyncData))] public virtual async Task Join_local_bytes_closure_is_cached_correctly(bool async) { var ids = new byte[] { 1, 2 }; - await AssertTranslationFailed( - () => AssertQueryScalar( - async, - ss => from e in ss.Set() - join id in ids on e.EmployeeID equals id - select e.EmployeeID)); + await AssertTranslationFailed(() => AssertQueryScalar( + async, + ss => from e in ss.Set() + join id in ids on e.EmployeeID equals id + select e.EmployeeID)); ids = [3]; - await AssertTranslationFailed( - () => AssertQueryScalar( - async, - ss => from e in ss.Set() - join id in ids on e.EmployeeID equals id - select e.EmployeeID)); + await AssertTranslationFailed(() => AssertQueryScalar( + async, + ss => from e in ss.Set() + join id in ids on e.EmployeeID equals id + select e.EmployeeID)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_same_collection_multiple(bool async) => AssertQuery( async, @@ -282,8 +264,7 @@ public virtual Task Join_same_collection_multiple(bool async) ss.Set(), o => o.CustomerID, i => i.CustomerID, (c1, c2) => new { c1, c2 }).Join( ss.Set(), o => o.c1.CustomerID, i => i.CustomerID, (c12, c3) => c3)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_same_collection_force_alias_uniquefication(bool async) => AssertQuery( async, @@ -292,8 +273,7 @@ public virtual Task Join_same_collection_force_alias_uniquefication(bool async) ss.Set(), o => o.CustomerID, i => i.CustomerID, (_, o) => new { _, o }), e => (e._.OrderID, e.o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LeftJoin(bool async) => AssertQuery( async, @@ -305,8 +285,7 @@ public virtual Task LeftJoin(bool async) (c, o) => new { c, o }), e => (e.c.CustomerID, e.o?.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task RightJoin(bool async) => AssertQuery( async, @@ -318,8 +297,7 @@ public virtual Task RightJoin(bool async) (c, o) => new { c, o }), e => (e.c.CustomerID, e.o?.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_customers_employees_shadow(bool async) => AssertQuery( async, @@ -331,8 +309,7 @@ join e in ss.Set() on c.City equals e.City into employees .Select(e => new { Title = EF.Property(e, "Title"), Id = e.EmployeeID }), e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_customers_employees_subquery_shadow(bool async) => AssertQuery( async, @@ -344,8 +321,7 @@ join e in ss.Set().OrderBy(e => e.City) on c.City equals e.City into e .Select(e => new { Title = EF.Property(e, "Title"), Id = e.EmployeeID }), e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_customers_employees_subquery_shadow_take(bool async) => AssertQuery( async, @@ -357,8 +333,7 @@ join e in ss.Set().OrderBy(e => e.City).Take(5) on c.City equals e.Cit .Select(e => new { Title = EF.Property(e, "Title"), Id = e.EmployeeID }), e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_simple(bool async) => AssertQuery( async, @@ -368,8 +343,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID into orders from o in orders select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_simple2(bool async) => AssertQuery( async, @@ -379,8 +353,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID into orders from o in orders select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_simple3(bool async) => AssertQuery( async, @@ -391,8 +364,7 @@ from o in orders select new { o.OrderID }, e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_simple_ordering(bool async) => AssertQuery( async, @@ -402,8 +374,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID into orders from o in orders select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_simple_subquery(bool async) => AssertQuery( async, @@ -413,8 +384,7 @@ join o in ss.Set().OrderBy(o => o.OrderID).Take(4) on c.CustomerID equals from o in orders select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_projection(bool async) => AssertQuery( async, @@ -425,8 +395,7 @@ from o in orders select new { c, o }, e => (e.c.CustomerID, e.o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_subquery_projection_outer_mixed(bool async) => AssertQuery( async, @@ -443,8 +412,7 @@ from o2 in orders }, e => (e.A, e.B, e.C)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_as_final_operator(bool async) => AssertQuery( async, @@ -459,8 +427,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID into orders AssertCollection(e.orders, a.orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Unflattened_GroupJoin_composed(bool async) => AssertQuery( async, @@ -477,8 +444,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID into orders AssertCollection(e.orders, a.orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Unflattened_GroupJoin_composed_2(bool async) => AssertQuery( async, @@ -496,8 +462,7 @@ join c2 in ss.Set().Where(n => n.City == "Lisboa") on i.c.CustomerID e AssertCollection(e.i.orders, a.i.orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -508,8 +473,7 @@ from o in orders.DefaultIfEmpty() select new { c, o }, e => (e.c.CustomerID, e.o?.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_DefaultIfEmpty_multiple(bool async) => AssertQuery( async, @@ -527,8 +491,7 @@ from o2 in orders2.DefaultIfEmpty() }, e => (e.c.CustomerID, e.o1?.OrderID, e.o2?.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_DefaultIfEmpty2(bool async) => AssertQuery( async, @@ -539,8 +502,7 @@ from o in orders.DefaultIfEmpty() select new { e, o }, e => (e.e.EmployeeID, e.o?.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_DefaultIfEmpty3(bool async) => AssertQuery( async, @@ -550,8 +512,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID into orders from o in orders.DefaultIfEmpty() select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_Where(bool async) => AssertQuery( async, @@ -562,8 +523,7 @@ from o in orders where o.CustomerID == "ALFKI" select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_Where_OrderBy(bool async) => AssertQuery( async, @@ -575,8 +535,7 @@ from o in orders orderby c.City select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_DefaultIfEmpty_Where(bool async) { return AssertQuery( @@ -591,8 +550,7 @@ from o in orders.DefaultIfEmpty() select o); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_GroupJoin_DefaultIfEmpty_Where(bool async) => AssertQuery( async, @@ -606,8 +564,7 @@ from o3 in orders.DefaultIfEmpty() #pragma warning restore RCS1146 // Use conditional access. select o3); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_DefaultIfEmpty_Project(bool async) => AssertQuery( async, @@ -617,8 +574,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID into orders from o in orders.DefaultIfEmpty() select o != null ? (object)o.OrderID : null); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_SelectMany_subquery_with_filter(bool async) => AssertQuery( async, @@ -629,8 +585,7 @@ from o in lo.Where(x => x.OrderID > 5) select new { c.ContactName, o.OrderID }, e => (e.ContactName, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_SelectMany_subquery_with_filter_orderby(bool async) => AssertQuery( async, @@ -641,8 +596,7 @@ from o in lo.Where(x => x.OrderID > 5).OrderBy(x => x.OrderDate) select new { c.ContactName, o.OrderID }, e => (e.ContactName, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_SelectMany_subquery_with_filter_and_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -653,8 +607,7 @@ from o in lo.Where(x => x.OrderID > 5).DefaultIfEmpty() select new { c.ContactName, o }, e => (e.ContactName, e.o?.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_SelectMany_subquery_with_filter_orderby_and_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -665,8 +618,7 @@ from o in lo.Where(x => x.OrderID > 5).OrderBy(x => x.OrderDate).DefaultIfEmpty( select new { c.ContactName, o }, e => (e.ContactName, e.o?.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_Subquery_with_Take_Then_SelectMany_Where(bool async) => AssertQuery( async, @@ -675,8 +627,7 @@ join o in ss.Set().OrderBy(o => o.OrderID).Take(100) on c.CustomerID equa from o in lo.Where(x => x.CustomerID.StartsWith("A")) select new { c.CustomerID, o.OrderID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_aggregate_anonymous_key_selectors(bool async) => AssertQuery( async, @@ -687,8 +638,7 @@ public virtual Task GroupJoin_aggregate_anonymous_key_selectors(bool async) (c, g) => new { c.CustomerID, Sum = g.Sum(x => x.CustomerID.Length) }), elementSorter: e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_aggregate_anonymous_key_selectors2(bool async) => AssertQuery( async, @@ -699,8 +649,7 @@ public virtual Task GroupJoin_aggregate_anonymous_key_selectors2(bool async) (c, g) => new { c.CustomerID, Sum = g.Sum(x => x.CustomerID.Length) }), elementSorter: e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_aggregate_anonymous_key_selectors_one_argument(bool async) => AssertQuery( async, @@ -711,21 +660,18 @@ public virtual Task GroupJoin_aggregate_anonymous_key_selectors_one_argument(boo (c, g) => new { c.CustomerID, Sum = g.Sum(x => x.CustomerID.Length) }), elementSorter: e => e.CustomerID); - [ConditionalTheory(Skip = "issue 35028")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue 35028"), MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_aggregate_nested_anonymous_key_selectors(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().GroupJoin( - ss.Set(), - x => new { x.CustomerID, Nested = new { x.City, Year = 1996 } }, - x => new { x.CustomerID, Nested = new { City = "London", x.OrderDate.Value.Year } }, - (c, g) => new { c.CustomerID, Sum = g.Sum(int (x) => x.CustomerID.Length) }), - elementSorter: e => e.CustomerID)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().GroupJoin( + ss.Set(), + x => new { x.CustomerID, Nested = new { x.City, Year = 1996 } }, + x => new { x.CustomerID, Nested = new { City = "London", x.OrderDate.Value.Year } }, + (c, g) => new { c.CustomerID, Sum = g.Sum(int (x) => x.CustomerID.Length) }), + elementSorter: e => e.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Inner_join_with_tautology_predicate_converts_to_cross_join(bool async) => AssertQuery( async, @@ -733,8 +679,7 @@ public virtual Task Inner_join_with_tautology_predicate_converts_to_cross_join(b join o in ss.Set().OrderBy(o => o.OrderID).Take(10) on 1 equals 1 select new { c.CustomerID, o.OrderID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_with_tautology_predicate_doesnt_convert_to_cross_join(bool async) => AssertQuery( async, @@ -743,8 +688,7 @@ join o in ss.Set().OrderBy(o => o.OrderID).Take(10) on c.CustomerID != nu from o in grouping.DefaultIfEmpty() select new { c.CustomerID, o.OrderID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_client_eval(bool async) => AssertQuery( async, @@ -752,20 +696,17 @@ public virtual Task SelectMany_with_client_eval(bool async) .SelectMany(c => c.Orders.Select(o => new { OrderProperty = ClientMethod(o), CustomerProperty = c.ContactName })), elementSorter: e => e.OrderProperty); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_client_eval_with_collection_shaper(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")) - .SelectMany( - c => c.Orders.Select( - o => new - { - OrderProperty = ClientMethod(o), - o.OrderDetails, - CustomerProperty = c.ContactName - })), + .SelectMany(c => c.Orders.Select(o => new + { + OrderProperty = ClientMethod(o), + o.OrderDetails, + CustomerProperty = c.ContactName + })), elementSorter: e => e.OrderProperty, elementAsserter: (e, a) => { @@ -774,43 +715,37 @@ public virtual Task SelectMany_with_client_eval_with_collection_shaper(bool asyn AssertCollection(e.OrderDetails, a.OrderDetails); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_client_eval_with_collection_shaper_ignored(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")) - .SelectMany( - c => c.Orders.Select( - o => new - { - OrderProperty = ClientMethod(o), - o.OrderDetails, - CustomerProperty = c.ContactName - })) + .SelectMany(c => c.Orders.Select(o => new + { + OrderProperty = ClientMethod(o), + o.OrderDetails, + CustomerProperty = c.ContactName + })) .Select(e => new { e.OrderProperty, e.CustomerProperty }), elementSorter: e => e.OrderProperty); private static int ClientMethod(Order order) => order.OrderID; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_client_eval_with_constructor(bool async) => AssertQuery( async, ss => ss.Set() .Where(c => c.CustomerID.StartsWith("A")) .OrderBy(c => c.CustomerID) - .Select( - c => new CustomerViewModel( - c.CustomerID, - c.City, - c.Orders.SelectMany( - o => o.OrderDetails - .Where(od => od.OrderID < 11000) - .Select(od => new OrderDetailViewModel(od.OrderID, od.ProductID))) - .ToArray())), + .Select(c => new CustomerViewModel( + c.CustomerID, + c.City, + c.Orders.SelectMany(o => o.OrderDetails + .Where(od => od.OrderID < 11000) + .Select(od => new OrderDetailViewModel(od.OrderID, od.ProductID))) + .ToArray())), assertOrder: true, elementAsserter: (e, a) => { @@ -873,16 +808,14 @@ public override int GetHashCode() => HashCode.Combine(OrderID, ProductID); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_selecting_outer_entity(bool async) => AssertQuery( async, ss => ss.Set() .SelectMany(c => c.Orders.Select(o => c))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_selecting_outer_element(bool async) => AssertQuery( async, @@ -890,8 +823,7 @@ public virtual Task SelectMany_with_selecting_outer_element(bool async) .Select(e => new { e, Complex = e.CustomerID + e.City }) .SelectMany(c => c.e.Orders.Select(o => c.Complex))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_selecting_outer_entity_column_and_inner_column(bool async) => AssertQuery( async, @@ -900,48 +832,41 @@ public virtual Task SelectMany_with_selecting_outer_entity_column_and_inner_colu .SelectMany(c => c.Orders.OrderBy(o => o.OrderID).Skip(0).Select(o => new { c.City, o.OrderDate })), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_subquery_take(bool async) => AssertQuery( async, ss => ss.Set() .Select(c => new { c.CustomerID }) - .SelectMany( - c => ss.Set() - .Where(i => i.CustomerID == c.CustomerID) - .OrderBy(i => i.CustomerID + i.City) - .Take(2))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .SelectMany(c => ss.Set() + .Where(i => i.CustomerID == c.CustomerID) + .OrderBy(i => i.CustomerID + i.City) + .Take(2))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_SelectMany_correlated_subquery_take(bool async) => AssertQuery( async, ss => ss.Set() .Select(c => new { c.CustomerID }) .Distinct() - .SelectMany( - c => ss.Set() - .Where(i => i.CustomerID == c.CustomerID) - .OrderBy(i => i.CustomerID + i.City) - .Take(2))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .SelectMany(c => ss.Set() + .Where(i => i.CustomerID == c.CustomerID) + .OrderBy(i => i.CustomerID + i.City) + .Take(2))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_SelectMany_correlated_subquery_take_2(bool async) => AssertQuery( async, ss => ss.Set() .Distinct() - .SelectMany( - c => ss.Set() - .Where(i => i.CustomerID == c.CustomerID) - .OrderBy(i => i.CustomerID + i.City) - .Take(2))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .SelectMany(c => ss.Set() + .Where(i => i.CustomerID == c.CustomerID) + .OrderBy(i => i.CustomerID + i.City) + .Take(2))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_SelectMany_correlated_subquery_take(bool async) => AssertQuery( async, @@ -949,28 +874,24 @@ public virtual Task Take_SelectMany_correlated_subquery_take(bool async) .Select(c => new { c.CustomerID }) .OrderBy(c => c.CustomerID) .Take(2) - .SelectMany( - c => ss.Set() - .Where(i => i.CustomerID == c.CustomerID) - .OrderBy(i => i.CustomerID + i.City) - .Take(2))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .SelectMany(c => ss.Set() + .Where(i => i.CustomerID == c.CustomerID) + .OrderBy(i => i.CustomerID + i.City) + .Take(2))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_in_collection_projection_with_FirstOrDefault_on_top_level(bool async) => AssertFirstOrDefault( async, ss => ss.Set() - .Select( - c => new - { - Orders = c.Orders.OrderBy(e => e.OrderDate).Take(1) - .Select(o => new { Title = o.CustomerID == o.Customer.City ? "A" : "B" }).ToList() - }), + .Select(c => new + { + Orders = c.Orders.OrderBy(e => e.OrderDate).Take(1) + .Select(o => new { Title = o.CustomerID == o.Customer.City ? "A" : "B" }).ToList() + }), asserter: (e, a) => AssertCollection(e.Orders, a.Orders, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Condition_on_entity_with_include(bool async) => AssertQuery( async, @@ -980,8 +901,7 @@ on c.CustomerID equals o.CustomerID into g from o in g.DefaultIfEmpty() select new { a = o != null ? o.OrderID : -1 }); - [ConditionalTheory(Skip = "issue #35028")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #35028"), MemberData(nameof(IsAsyncData))] public virtual Task Join_with_key_selectors_being_nested_anonymous_objects(bool async) => AssertQuery( async, @@ -990,7 +910,7 @@ public virtual Task Join_with_key_selectors_being_nested_anonymous_objects(bool x => new { x.CustomerID, Nested = new { x.City, Year = 1996 } }, x => new { x.CustomerID, Nested = new { City = "London", x.OrderDate.Value.Year } }, (c, o) => new { c, o }), - elementSorter: e => (e.c.CustomerID, e.o.OrderID ), + elementSorter: e => (e.c.CustomerID, e.o.OrderID), elementAsserter: (e, a) => { AssertEqual(e.c, a.c); diff --git a/test/EFCore.Specification.Tests/Query/NorthwindKeylessEntitiesQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindKeylessEntitiesQueryTestBase.cs index d15ad1bb959..f43d0830deb 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindKeylessEntitiesQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindKeylessEntitiesQueryTestBase.cs @@ -16,50 +16,43 @@ protected virtual void ClearLog() { } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_simple(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_where_simple(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.City == "London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_by_database_view(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Auto_initialized_view_set(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_with_nav_defining_query(bool async) => AssertQuery( async, ss => ss.Set().Where(cq => cq.OrderCount > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_with_defining_query(bool async) => AssertQuery( async, ss => ss.Set().Where(ov => ov.CustomerID == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_with_defining_query_and_correlated_collection(bool async) => AssertQuery( async, @@ -69,8 +62,7 @@ public virtual Task KeylessEntity_with_defining_query_and_correlated_collection( assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_with_mixed_tracking(bool async) => AssertQuery( async, @@ -79,8 +71,7 @@ from o in ss.Set().Where(ov => ov.CustomerID == c.CustomerID) select new { c, o }, e => e.c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_with_included_nav(bool async) => AssertQuery( async, @@ -89,8 +80,7 @@ public virtual Task KeylessEntity_with_included_nav(bool async) select ov, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(ov => ov.Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_with_included_navs_multi_level(bool async) => AssertQuery( async, @@ -102,8 +92,7 @@ public virtual Task KeylessEntity_with_included_navs_multi_level(bool async) new ExpectedInclude(ov => ov.Customer), new ExpectedInclude(c => c.Orders, "Customer"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_select_where_navigation(bool async) => AssertQuery( async, @@ -111,8 +100,7 @@ public virtual Task KeylessEntity_select_where_navigation(bool async) where ov.Customer.City == "Seattle" select ov); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_select_where_navigation_multi_level(bool async) => AssertQuery( async, @@ -120,24 +108,21 @@ public virtual Task KeylessEntity_select_where_navigation_multi_level(bool async where ov.Customer.Orders.Any() select ov); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task KeylessEntity_groupby(bool async) => AssertQuery( async, ss => ss.Set() .GroupBy(cv => cv.City) - .Select( - g => new - { - g.Key, - Count = g.Count(), - Sum = g.Sum(e => e.Address.Length) - }), + .Select(g => new + { + g.Key, + Count = g.Count(), + Sum = g.Sum(e => e.Address.Length) + }), elementSorter: e => (e.Key, e.Count, e.Sum)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_mapped_to_view_on_right_side_of_join(bool async) => AssertQuery( async, @@ -147,8 +132,7 @@ from pv in grouping.DefaultIfEmpty() select new { Order = o, ProductView = pv }, elementSorter: e => (e.Order.OrderID, e.ProductView?.ProductID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_correlated_with_keyless_entity_in_predicate_works(bool async) => AssertQuery( async, @@ -158,22 +142,19 @@ public virtual Task Collection_correlated_with_keyless_entity_in_predicate_works .OrderBy(x => x.ContactName) .Take(2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_over_keyless_entity(bool async) => AssertCount( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_over_keyless_entity_with_pushdown(bool async) => AssertCount( async, ss => ss.Set().OrderBy(x => x.ContactTitle).Take(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_over_keyless_entity_with_pushdown_empty_projection(bool async) => AssertCount( async, diff --git a/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs index 98605695814..f3b61956d22 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs @@ -20,48 +20,41 @@ protected virtual void ClearLog() { } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Multiple_context_instances(bool async) { using var context1 = CreateContext(); using var context2 = CreateContext(); var message = async - ? (await Assert.ThrowsAsync( - () => (from c in context1.Customers - from o in context2.Orders - select c).FirstAsync())).Message - : Assert.Throws( - () => (from c in context1.Customers - from o in context2.Orders - select c).First()).Message; + ? (await Assert.ThrowsAsync(() => (from c in context1.Customers + from o in context2.Orders + select c).FirstAsync())).Message + : Assert.Throws(() => (from c in context1.Customers + from o in context2.Orders + select c).First()).Message; Assert.Equal(CoreStrings.ErrorInvalidQueryable, message); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Multiple_context_instances_2(bool async) { using var context1 = CreateContext(); using var context2 = CreateContext(); var message = async - ? (await Assert.ThrowsAsync( - () => (from c in context1.Customers - from o in context2.Set() - select c).FirstAsync())).Message - : Assert.Throws( - () => (from c in context1.Customers - from o in context2.Set() - select c).First()).Message; + ? (await Assert.ThrowsAsync(() => (from c in context1.Customers + from o in context2.Set() + select c).FirstAsync())).Message + : Assert.Throws(() => (from c in context1.Customers + from o in context2.Set() + select c).First()).Message; Assert.Equal(CoreStrings.ErrorInvalidQueryable, message); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Multiple_context_instances_set(bool async) { using var context1 = CreateContext(); @@ -69,30 +62,25 @@ public virtual async Task Multiple_context_instances_set(bool async) var set = context2.Orders; var message = async - ? (await Assert.ThrowsAsync( - () => (from c in context1.Customers - from o in set - select c).FirstAsync())).Message - : Assert.Throws( - () => (from c in context1.Customers - from o in set - select c).First()).Message; + ? (await Assert.ThrowsAsync(() => (from c in context1.Customers + from o in set + select c).FirstAsync())).Message + : Assert.Throws(() => (from c in context1.Customers + from o in set + select c).First()).Message; Assert.Equal(CoreStrings.ErrorInvalidQueryable, message); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Multiple_context_instances_parameter(bool async) { using var context1 = CreateContext(); using var context2 = CreateContext(); var message = async - ? (await Assert.ThrowsAsync( - () => queryAsync(context2))).Message - : Assert.Throws( - () => query(context2)).Message; + ? (await Assert.ThrowsAsync(() => queryAsync(context2))).Message + : Assert.Throws(() => query(context2)).Message; Assert.Equal(CoreStrings.ErrorInvalidQueryable, message); @@ -107,8 +95,7 @@ from o in c2.Orders select c).FirstAsync(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Query_when_evaluatable_queryable_method_call_with_repository(bool async) { using var context = CreateContext(); @@ -153,8 +140,7 @@ public IQueryable Find() => _context.Set(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Lifting_when_subquery_nested_order_by_simple(bool async) => AssertQuery( async, @@ -172,8 +158,7 @@ on EF.Property(c1_Orders, "CustomerID") equals _c1 orderby _c1 select c1_Orders); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Lifting_when_subquery_nested_order_by_anonymous(bool async) => AssertQuery( async, @@ -196,8 +181,7 @@ private class Context public readonly Dictionary Arguments = new(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Local_dictionary(bool async) { var context = new Context(); @@ -228,8 +212,7 @@ var results Assert.Single(results); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Shaper_command_caching_when_parameter_names_different(bool async) { using var context = CreateContext(); @@ -256,8 +239,7 @@ public virtual async Task Shaper_command_caching_when_parameter_names_different( } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Can_convert_manually_build_expression_with_default(bool async) { var parameter = Expression.Parameter(typeof(Customer)); @@ -280,8 +262,7 @@ public static bool Check(string input1, string input2) => false; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_self(bool async) { return AssertQuery( @@ -293,8 +274,7 @@ public virtual Task Entity_equality_self(bool async) select c.CustomerID); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_local(bool async) { var local = new Customer { CustomerID = "ANATR" }; @@ -306,8 +286,7 @@ public virtual Task Entity_equality_local(bool async) select c.CustomerID); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_local_composite_key(bool async) { var local = new OrderDetail { OrderID = 10248, ProductID = 11 }; @@ -319,8 +298,7 @@ where od.Equals(local) select od); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_local_double_check(bool async) { var local = new Customer { CustomerID = "ANATR" }; @@ -332,8 +310,7 @@ public virtual Task Entity_equality_local_double_check(bool async) select c.CustomerID); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_entity_equality_local_on_both_sources(bool async) { var local = new Customer { CustomerID = "ANATR" }; @@ -349,8 +326,7 @@ from c2 in ss.Set() select c2, o => o, i => i, (o, i) => o).Select(e => e.CustomerID)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_local_inline(bool async) => AssertQuery( async, @@ -358,8 +334,7 @@ public virtual Task Entity_equality_local_inline(bool async) where c == new Customer { CustomerID = "ANATR" } select c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_local_inline_composite_key(bool async) => AssertQuery( async, @@ -367,8 +342,7 @@ public virtual Task Entity_equality_local_inline_composite_key(bool async) where od.Equals(new OrderDetail { OrderID = 10248, ProductID = 11 }) select od); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_null(bool async) => AssertQuery( async, @@ -377,8 +351,7 @@ public virtual Task Entity_equality_null(bool async) select c.CustomerID, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_null_composite_key(bool async) => AssertQuery( async, @@ -387,8 +360,7 @@ public virtual Task Entity_equality_null_composite_key(bool async) select od, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_not_null(bool async) => AssertQuery( async, @@ -396,8 +368,7 @@ public virtual Task Entity_equality_not_null(bool async) where c != null select c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_not_null_composite_key(bool async) => AssertQuery( async, @@ -405,8 +376,7 @@ public virtual Task Entity_equality_not_null_composite_key(bool async) where od != null select od); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_through_nested_anonymous_type_projection(bool async) => AssertQuery( async, @@ -414,8 +384,7 @@ public virtual Task Entity_equality_through_nested_anonymous_type_projection(boo .Select(x => new { CustomerInfo = new { x.Customer } }) .Where(x => x.CustomerInfo.Customer != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_through_DTO_projection(bool async) => AssertQuery( async, @@ -434,8 +403,7 @@ public override int GetHashCode() => Customer.GetHashCode(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_through_subquery(bool async) => AssertQuery( async, @@ -443,16 +411,14 @@ public virtual Task Entity_equality_through_subquery(bool async) where c.Orders.FirstOrDefault() != null select c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_through_subquery_composite_key(bool async) => AssertQuery( async, ss => ss.Set() .Where(o => o.OrderDetails.FirstOrDefault() == new OrderDetail { OrderID = 10248, ProductID = 11 })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_through_include(bool async) => AssertQuery( async, @@ -461,24 +427,21 @@ public virtual Task Entity_equality_through_include(bool async) select c.CustomerID, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_orderby(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_orderby_descending_composite_key(bool async) => AssertQuery( async, ss => ss.Set().OrderByDescending(o => o), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_orderby_subquery(bool async) => AssertQuery( async, @@ -486,45 +449,39 @@ public virtual Task Entity_equality_orderby_subquery(bool async) ss => ss.Set().OrderBy(c => c.Orders.FirstOrDefault() == null ? (int?)null : c.Orders.FirstOrDefault().OrderID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_orderby_descending_subquery_composite_key(bool async) => AssertQuery( async, ss => ss.Set().OrderByDescending(o => o.OrderDetails.FirstOrDefault()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Queryable_simple(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Queryable_simple_anonymous(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { c }), e => e.c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Queryable_simple_anonymous_projection_subquery(bool async) => AssertQuery( async, ss => ss.Set().Take(91).Select(c => new { c }).Select(a => a.c.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Queryable_simple_anonymous_subquery(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { c }).Take(91).Select(a => a.c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Queryable_reprojection(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -533,23 +490,20 @@ public virtual Task Queryable_reprojection(bool async) .Select(c => new Customer { CustomerID = "Foo", City = c.City })), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Queryable_nested_simple(bool async) => AssertQuery( async, ss => from c1 in (from c2 in (from c3 in ss.Set() select c3) select c2) select c1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_simple(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(10), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_simple_parameterized(bool async) { var take = 10; @@ -560,24 +514,21 @@ public virtual Task Take_simple_parameterized(bool async) assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_simple_projection(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Select(c => c.City).Take(10), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_subquery_projection(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(2).Select(c => c.City), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip(bool async) => AssertQuery( async, @@ -585,8 +536,7 @@ public virtual Task Skip(bool async) ss => ss.Set().OrderBy(c => c.CustomerID, StringComparer.Ordinal).Skip(5), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_no_orderby(bool async) => AssertQuery( async, @@ -596,8 +546,7 @@ public virtual Task Skip_no_orderby(bool async) /* non-deterministic */ }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_orderby_const(bool async) => AssertQuery( async, @@ -607,16 +556,14 @@ public virtual Task Skip_orderby_const(bool async) /* non-deterministic */ }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_Skip(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.ContactName).Take(10).Skip(5), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_Skip(bool async) => AssertQuery( async, @@ -624,16 +571,14 @@ public virtual Task Distinct_Skip(bool async) ss => ss.Set().Distinct().OrderBy(c => c.CustomerID, StringComparer.Ordinal).Skip(5), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.ContactName).Skip(5).Take(10), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_Customers_Orders_Skip_Take(bool async) => AssertQuery( async, @@ -644,8 +589,7 @@ orderby o.OrderID select new { c.ContactName, o.OrderID }).Skip(10).Take(5), e => e.ContactName); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_Customers_Orders_Skip_Take_followed_by_constant_projection(bool async) => AssertQuery( async, @@ -655,8 +599,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID orderby o.OrderID select new { c.ContactName, o.OrderID }).Skip(10).Take(5).Select(e => "Foo")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_Customers_Orders_Projection_With_String_Concat_Skip_Take(bool async) => AssertQuery( async, @@ -667,8 +610,7 @@ orderby o.OrderID select new { Contact = c.ContactName + " " + c.ContactTitle, o.OrderID }).Skip(10).Take(5), e => e.Contact); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_Customers_Orders_Orders_Skip_Take_Same_Properties(bool async) => AssertQuery( async, @@ -687,8 +629,7 @@ orderby o.OrderID }).Skip(10).Take(5), e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Ternary_should_not_evaluate_both_sides(bool async) { Customer customer = null; @@ -696,35 +637,31 @@ public virtual Task Ternary_should_not_evaluate_both_sides(bool async) return AssertQuery( async, - ss => ss.Set().Select( - c => new - { - c.CustomerID, - Data1 = hasData ? customer.CustomerID : "none", - Data2 = customer != null ? customer.CustomerID : "none", - Data3 = !hasData ? "none" : customer.CustomerID - })); + ss => ss.Set().Select(c => new + { + c.CustomerID, + Data1 = hasData ? customer.CustomerID : "none", + Data2 = customer != null ? customer.CustomerID : "none", + Data3 = !hasData ? "none" : customer.CustomerID + })); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Ternary_should_not_evaluate_both_sides_with_parameter(bool async) { DateTime? param = null; return AssertQuery( async, - ss => ss.Set().Select( - o => new - { - // ReSharper disable SimplifyConditionalTernaryExpression - Data1 = param != null ? o.OrderDate == param.Value : true, Data2 = param == null ? true : o.OrderDate == param.Value - // ReSharper restore SimplifyConditionalTernaryExpression - })); + ss => ss.Set().Select(o => new + { + // ReSharper disable SimplifyConditionalTernaryExpression + Data1 = param != null ? o.OrderDate == param.Value : true, Data2 = param == null ? true : o.OrderDate == param.Value + // ReSharper restore SimplifyConditionalTernaryExpression + })); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Coalesce_Correct_Multiple_Same_TypeMapping(bool async) => AssertQuery( async, @@ -732,24 +669,21 @@ public virtual Task Coalesce_Correct_Multiple_Same_TypeMapping(bool async) .Select(e => (e.ReportsTo + 1L) ?? (e.ReportsTo + 2L) ?? (e.ReportsTo + 3L)), assertOrder: true); - [ConditionalTheory(Skip = "issue #15586")] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory(Skip = "issue #15586"), MemberData(nameof(IsAsyncData))] public virtual Task Coalesce_Correct_TypeMapping_Double(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(e => e.EmployeeID).Select(e => e.ReportsTo ?? 2.25), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Coalesce_Correct_TypeMapping_String(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Select(c => c.Region ?? "no region specified"), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_Coalesce_Short_Circuit(bool async) { List values = null; @@ -760,8 +694,7 @@ public virtual Task Null_Coalesce_Short_Circuit(bool async) ss => ss.Set().Distinct().Select(c => new { Customer = c, Test = test ?? values.Contains(1) })); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Null_Coalesce_Short_Circuit_with_server_correlated_leftover(bool async) { List values = null; @@ -772,76 +705,66 @@ public virtual Task Null_Coalesce_Short_Circuit_with_server_correlated_leftover( ss => ss.Set().Select(c => new { Result = test ?? values.Select(c2 => c2.CustomerID).Contains(c.CustomerID) })); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_Skip_Take(bool async) => AssertQuery( async, ss => ss.Set().Distinct().OrderBy(c => c.ContactName).Skip(5).Take(10), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Distinct(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.ContactName).Skip(5).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_Distinct(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.ContactName).Skip(5).Take(10).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_Any(bool async) => AssertAny( async, ss => ss.Set().OrderBy(c => c.ContactName).Skip(5).Take(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_All(bool async) => AssertAll( async, ss => ss.Set().OrderBy(c => c.CustomerID).Skip(4).Take(7), predicate: p => p.CustomerID.StartsWith("B")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_All(bool async) => AssertAll( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(4), predicate: p => p.CustomerID.StartsWith("A")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_Any_with_predicate(bool async) => AssertAny( async, ss => ss.Set().OrderBy(c => c.CustomerID).Skip(5).Take(7), predicate: p => p.CustomerID.StartsWith("C")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_Any_with_predicate(bool async) => AssertAny( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(5), predicate: p => p.CustomerID.StartsWith("B")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_Skip_Distinct(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.ContactName).Take(10).Skip(5).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Take_Skip_Distinct_Caching(bool async) { await AssertQuery( @@ -853,222 +776,187 @@ await AssertQuery( ss => ss.Set().OrderBy(c => c.ContactName).Take(15).Skip(10).Distinct()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_Distinct(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(o => o.OrderID).Take(5).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_Take(bool async) => AssertQuery( async, ss => ss.Set().Distinct().OrderBy(o => o.OrderID).Take(5), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_Take_Count(bool async) => AssertCount( async, ss => ss.Set().Distinct().Take(5)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_Distinct_Count(bool async) => AssertCount( async, ss => ss.Set().Take(5).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_Where_Distinct_Count(bool async) => AssertCount( async, ss => ss.Set().Where(o => o.CustomerID == "FRANK").Take(5).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_simple(bool async) => AssertAny( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Take_Count(bool async) => AssertCount( async, ss => ss.Set().OrderBy(o => o.OrderID).Take(5)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_OrderBy_Count(bool async) => AssertCount( async, ss => ss.Set().Take(5).OrderBy(o => o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_predicate(bool async) => AssertAny( async, ss => ss.Set(), predicate: c => c.ContactName.StartsWith("A")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_nested_negated(bool async) => AssertQuery( async, ss => ss.Set().Where(c => !ss.Set().Any(o => o.CustomerID.StartsWith("A"))), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_nested_negated2(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => c.City != "London" - && !ss.Set().Any(o => o.CustomerID.StartsWith("ABC")))); + ss => ss.Set().Where(c => c.City != "London" + && !ss.Set().Any(o => o.CustomerID.StartsWith("ABC")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_nested_negated3(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => !ss.Set().Any(o => o.CustomerID.StartsWith("ABC")) - && c.City != "London")); + ss => ss.Set().Where(c => !ss.Set().Any(o => o.CustomerID.StartsWith("ABC")) + && c.City != "London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_nested(bool async) => AssertQuery( async, ss => ss.Set().Where(c => ss.Set().Any(o => o.CustomerID.StartsWith("A")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_nested2(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.City != "London" && ss.Set().Any(o => o.CustomerID.StartsWith("A")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_nested3(bool async) => AssertQuery( async, ss => ss.Set().Where(c => ss.Set().Any(o => o.CustomerID.StartsWith("A")) && c.City != "London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_with_multiple_conditions_still_uses_exists(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.City == "London" && c.Orders.Any(o => o.EmployeeID == 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_on_distinct(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => o.EmployeeID).Distinct().Any(id => id != 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_on_distinct(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => o.EmployeeID).Distinct().Contains(1u))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_on_distinct(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => o.EmployeeID).Distinct().All(id => id != 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_top_level(bool async) => AssertAll( async, ss => ss.Set(), predicate: c => c.ContactName.StartsWith("A")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_top_level_column(bool async) => AssertAll( async, ss => ss.Set(), predicate: c => c.ContactName.StartsWith(c.ContactName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_top_level_subquery(bool async) => AssertSingleResult( async, - syncQuery: ss => ss.Set().All( - c1 => ss.Set().Any(c2 => ss.Set().Any(c3 => c1.CustomerID == c3.CustomerID))), + syncQuery: ss => ss.Set() + .All(c1 => ss.Set().Any(c2 => ss.Set().Any(c3 => c1.CustomerID == c3.CustomerID))), asyncQuery: ss => ss.Set().AllAsync( c1 => ss.Set().Any(c2 => ss.Set().Any(c3 => c1.CustomerID == c3.CustomerID)), default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_top_level_subquery_ef_property(bool async) => AssertSingleResult( async, - syncQuery: ss => ss.Set().All( - c1 => ss.Set().Any( - c2 => ss.Set().Any(c3 => EF.Property(c1, "CustomerID") == c3.CustomerID))), + syncQuery: ss => ss.Set().All(c1 + => ss.Set().Any(c2 => ss.Set().Any(c3 => EF.Property(c1, "CustomerID") == c3.CustomerID))), asyncQuery: ss => ss.Set().AllAsync( - c1 => ss.Set().Any( - c2 => ss.Set().Any(c3 => EF.Property(c1, "CustomerID") == c3.CustomerID)), + c1 => ss.Set().Any(c2 => ss.Set().Any(c3 => EF.Property(c1, "CustomerID") == c3.CustomerID)), default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_client(bool async) - => AssertTranslationFailed( - () => AssertAll( - async, - ss => ss.Set(), - predicate: c => c.IsLondon)); + => AssertTranslationFailed(() => AssertAll( + async, + ss => ss.Set(), + predicate: c => c.IsLondon)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_client_and_server_top_level(bool async) - => AssertTranslationFailed( - () => AssertAll( - async, - ss => ss.Set(), - predicate: c => c.CustomerID != "Foo" && c.IsLondon)); + => AssertTranslationFailed(() => AssertAll( + async, + ss => ss.Set(), + predicate: c => c.CustomerID != "Foo" && c.IsLondon)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task All_client_or_server_top_level(bool async) - => AssertTranslationFailed( - () => AssertAll( - async, - ss => ss.Set(), - predicate: c => c.CustomerID != "Foo" || c.IsLondon)); + => AssertTranslationFailed(() => AssertAll( + async, + ss => ss.Set(), + predicate: c => c.CustomerID != "Foo" || c.IsLondon)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_with_single(bool async) => AssertSingle( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_with_single_select_many(bool async) => AssertSingle( async, @@ -1079,15 +967,13 @@ from o in ss.Set() .Take(1) .Cast()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_results_to_object(bool async) => AssertQuery( async, ss => from c in ss.Set().Cast() select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task First_client_predicate(bool async) => AssertTranslationFailedWithDetails( () => AssertFirst( @@ -1096,8 +982,7 @@ public virtual Task First_client_predicate(bool async) predicate: c => c.IsLondon), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_select_many_or(bool async) => AssertQuery( async, @@ -1109,8 +994,7 @@ from e in ss.Set() select new { c, e }, e => (e.c.CustomerID, +e.e.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_select_many_or2(bool async) => AssertQuery( async, @@ -1122,8 +1006,7 @@ from e in ss.Set() select new { c, e }, e => (e.c.CustomerID, e.e.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_select_many_or3(bool async) => AssertQuery( async, @@ -1136,8 +1019,7 @@ from e in ss.Set() select new { c, e }, e => (e.c.CustomerID, e.e.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_select_many_or4(bool async) => AssertQuery( async, @@ -1151,8 +1033,7 @@ from e in ss.Set() select new { c, e }, e => (e.c.CustomerID, e.e.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_select_many_or_with_parameter(bool async) { var london = "London"; @@ -1171,33 +1052,27 @@ from e in ss.Set() e => (e.c.CustomerID, e.e.EmployeeID)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_anon(bool async) => AssertQuery( async, ss => - from e in ss.Set().OrderBy(ee => ee.EmployeeID).Take(3).Select( - e => new { e }) - from o in ss.Set().OrderBy(oo => oo.OrderID).Take(5).Select( - o => new { o }) + from e in ss.Set().OrderBy(ee => ee.EmployeeID).Take(3).Select(e => new { e }) + from o in ss.Set().OrderBy(oo => oo.OrderID).Take(5).Select(o => new { o }) where e.e.EmployeeID == o.o.EmployeeID select new { e, o }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_anon_nested(bool async) => AssertQuery( async, ss => from t in ( - from e in ss.Set().OrderBy(ee => ee.EmployeeID).Take(3).Select( - e => new { e }).Where(e => e.e.City == "Seattle") - from o in ss.Set().OrderBy(oo => oo.OrderID).Take(5).Select( - o => new { o }) + from e in ss.Set().OrderBy(ee => ee.EmployeeID).Take(3).Select(e => new { e }) + .Where(e => e.e.City == "Seattle") + from o in ss.Set().OrderBy(oo => oo.OrderID).Take(5).Select(o => new { o }) select new { e, o }) - from c in ss.Set().OrderBy(cc => cc.CustomerID).Take(2).Select( - c => new { c }) + from c in ss.Set().OrderBy(cc => cc.CustomerID).Take(2).Select(c => new { c }) select new { t.e, @@ -1205,8 +1080,7 @@ from c in ss.Set().OrderBy(cc => cc.CustomerID).Take(2).Select( c }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_expression(bool async) => AssertQuery( async, @@ -1217,8 +1091,7 @@ public virtual Task Where_subquery_expression(bool async) return ss.Set().Where(x => ss.Set().Where(expr).Any()); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_expression_same_parametername(bool async) => AssertQuery( async, @@ -1229,8 +1102,7 @@ public virtual Task Where_subquery_expression_same_parametername(bool async) return ss.Set().Where(x => ss.Set().Where(expr).Where(o => o.CustomerID == x.CustomerID).Any()); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_DTO_distinct_translated_to_server(bool async) => AssertQuery( async, @@ -1245,8 +1117,7 @@ public virtual Task Select_DTO_distinct_translated_to_server(bool async) Assert.Equal(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_DTO_constructor_distinct_translated_to_server(bool async) => AssertQuery( async, @@ -1261,8 +1132,7 @@ public virtual Task Select_DTO_constructor_distinct_translated_to_server(bool as Assert.Equal(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_DTO_constructor_distinct_with_navigation_translated_to_server(bool async) => AssertQuery( async, @@ -1277,8 +1147,7 @@ public virtual Task Select_DTO_constructor_distinct_with_navigation_translated_t Assert.Equal(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_DTO_constructor_distinct_with_collection_projection_translated_to_server(bool async) => AssertQuery( async, @@ -1294,8 +1163,7 @@ public virtual Task Select_DTO_constructor_distinct_with_collection_projection_t AssertCollection(e.Orders, a.Orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Select_DTO_constructor_distinct_with_collection_projection_translated_to_server_with_binding_after_client_eval(bool async) { @@ -1325,8 +1193,7 @@ public virtual async Task } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_DTO_with_member_init_distinct_translated_to_server(bool async) => AssertQuery( async, @@ -1341,8 +1208,7 @@ public virtual Task Select_DTO_with_member_init_distinct_translated_to_server(bo Assert.Equal(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_count_using_DTO(bool async) => AssertQuery( async, @@ -1356,34 +1222,29 @@ public virtual Task Select_nested_collection_count_using_DTO(bool async) Assert.Equal(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_DTO_with_member_init_distinct_in_subquery_translated_to_server(bool async) => AssertQuery( async, ss => from o in ss.Set().Where(o => o.OrderID < 10300) - .Select( - o => new OrderCountDTO { Id = o.CustomerID, Count = o.OrderID }) + .Select(o => new OrderCountDTO { Id = o.CustomerID, Count = o.OrderID }) .Distinct() from c in ss.Set().Where(c => c.CustomerID == o.Id) select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_DTO_with_member_init_distinct_in_subquery_translated_to_server_2(bool async) => AssertQuery( async, ss => from o in ss.Set().Where(o => o.OrderID < 10300) - .Select( - o => new OrderCountDTO { Id = o.CustomerID, Count = o.OrderID }) + .Select(o => new OrderCountDTO { Id = o.CustomerID, Count = o.OrderID }) .Distinct() from c in ss.Set().Where(c => o.Id == c.CustomerID) select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_DTO_with_member_init_distinct_in_subquery_used_in_projection_translated_to_server(bool async) => AssertQuery( async, @@ -1433,8 +1294,7 @@ public override int GetHashCode() => HashCode.Combine(Id, Count); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_subquery_filtered_returning_queryable_throws(bool async) => AssertInvalidMaterializationType( () => AssertQuery( @@ -1448,8 +1308,7 @@ select ss.Set().Where(o => o.CustomerID == c.CustomerID), elementAsserter: (e, a) => AssertCollection(e, a)), typeof(IQueryable).ShortDisplayName()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_subquery_ordered_returning_queryable_throws(bool async) => AssertInvalidMaterializationType( () => AssertQuery( @@ -1461,8 +1320,7 @@ select ss.Set().OrderBy(o => o.OrderID).ThenBy(o => c.CustomerID).Skip(10 elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)), typeof(IQueryable).ShortDisplayName()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_subquery_ordered_returning_queryable_in_DTO_throws(bool async) => AssertInvalidMaterializationType( () => AssertQuery( @@ -1480,8 +1338,7 @@ private class QueryableDto public IQueryable Orders { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_subquery_filtered(bool async) => AssertQuery( async, @@ -1493,8 +1350,7 @@ select ss.Set().Where(o => o.CustomerID == c.CustomerID).ToList(), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_correlated_subquery_ordered(bool async) => AssertQuery( async, @@ -1504,8 +1360,7 @@ select ss.Set().OrderBy(o => o.OrderID).ThenBy(o => c.CustomerID).Skip(10 elementSorter: e => e.Count(), elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_in_anonymous_type_returning_ordered_queryable(bool async) => AssertInvalidMaterializationType( () => AssertQuery( @@ -1517,9 +1372,8 @@ from c in ss.Set() { CustomerId = c.CustomerID, OrderIds - = ss.Set().Where( - o => o.CustomerID == c.CustomerID - && o.OrderDate.Value.Year == 1997) + = ss.Set().Where(o => o.CustomerID == c.CustomerID + && o.OrderDate.Value.Year == 1997) .Select(o => o.OrderID) .OrderBy(o => o), Customer = c @@ -1532,8 +1386,7 @@ from c in ss.Set() }), typeof(IOrderedQueryable).ShortDisplayName()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_recursive_trivial_returning_queryable(bool async) => AssertInvalidMaterializationType( () => AssertQuery( @@ -1551,8 +1404,7 @@ orderby e3.EmployeeID elementAsserter: (ee, aa) => AssertCollection(ee, aa, ordered: true))), typeof(IQueryable>).ShortDisplayName()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_in_anonymous_type(bool async) => AssertQuery( async, @@ -1563,9 +1415,8 @@ from c in ss.Set() { CustomerId = c.CustomerID, OrderIds - = ss.Set().Where( - o => o.CustomerID == c.CustomerID - && o.OrderDate.Value.Year == 1997) + = ss.Set().Where(o => o.CustomerID == c.CustomerID + && o.OrderDate.Value.Year == 1997) .Select(o => o.OrderID) .OrderBy(o => o) .ToArray(), @@ -1578,8 +1429,7 @@ from c in ss.Set() AssertEqual(e.Customer, a.Customer); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_subquery_recursive_trivial(bool async) => AssertQuery( async, @@ -1595,8 +1445,7 @@ orderby e3.EmployeeID elementSorter: ee => ee.Count(), elementAsserter: (ee, aa) => AssertCollection(ee, aa, ordered: true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_on_bool(bool async) => AssertQuery( async, @@ -1605,19 +1454,16 @@ from p in ss.Set() where ss.Set().Select(p2 => p2.ProductName).Contains("Chai") select p); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_on_collection(bool async) => AssertQuery( async, ss => - ss.Set().Where( - p => ss.Set() - .Where(o => o.ProductID == p.ProductID) - .Select(od => od.Quantity).Contains(5))); + ss.Set().Where(p => ss.Set() + .Where(o => o.ProductID == p.ProductID) + .Select(od => od.Quantity).Contains(5))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition(bool async) => AssertQuery( async, @@ -1625,8 +1471,7 @@ public virtual Task Where_query_composition(bool async) where e1.FirstName == ss.Set().OrderBy(e => e.EmployeeID).FirstOrDefault().FirstName select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_is_null(bool async) => AssertQuery( async, @@ -1634,8 +1479,7 @@ public virtual Task Where_query_composition_is_null(bool async) where ss.Set().SingleOrDefault(e2 => e2.EmployeeID == e1.ReportsTo) == null select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_is_not_null(bool async) => AssertQuery( async, @@ -1643,8 +1487,7 @@ public virtual Task Where_query_composition_is_not_null(bool async) where ss.Set().SingleOrDefault(e2 => e2.EmployeeID == e1.ReportsTo) != null select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_one_element_SingleOrDefault(bool async) => AssertQuery( async, @@ -1656,8 +1499,7 @@ public virtual Task Where_query_composition_entity_equality_one_element_SingleOr select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_one_element_Single(bool async) => AssertQuery( async, @@ -1669,8 +1511,7 @@ public virtual Task Where_query_composition_entity_equality_one_element_Single(b select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_one_element_FirstOrDefault(bool async) => AssertQuery( async, @@ -1679,8 +1520,7 @@ public virtual Task Where_query_composition_entity_equality_one_element_FirstOrD select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_one_element_First(bool async) => AssertQuery( async, @@ -1692,8 +1532,7 @@ public virtual Task Where_query_composition_entity_equality_one_element_First(bo select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_no_elements_SingleOrDefault(bool async) => AssertQuery( async, @@ -1705,8 +1544,7 @@ public virtual Task Where_query_composition_entity_equality_no_elements_SingleOr select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_no_elements_Single(bool async) => AssertQuery( async, @@ -1718,8 +1556,7 @@ public virtual Task Where_query_composition_entity_equality_no_elements_Single(b select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_no_elements_FirstOrDefault(bool async) => AssertQuery( async, @@ -1728,8 +1565,7 @@ public virtual Task Where_query_composition_entity_equality_no_elements_FirstOrD select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_no_elements_First(bool async) => AssertQuery( async, @@ -1741,8 +1577,7 @@ public virtual Task Where_query_composition_entity_equality_no_elements_First(bo select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_multiple_elements_SingleOrDefault(bool async) => AssertQuery( async, @@ -1754,8 +1589,7 @@ where ss.Set().OrderBy(e2 => e2.EmployeeID).SingleOrDefault(e2 => e2.E where ss.Set().OrderBy(e2 => e2.EmployeeID).FirstOrDefault(e2 => e2.EmployeeID != e1.ReportsTo).EmployeeID == 1 select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_multiple_elements_Single(bool async) => AssertQuery( async, @@ -1767,8 +1601,7 @@ public virtual Task Where_query_composition_entity_equality_multiple_elements_Si select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_multiple_elements_FirstOrDefault(bool async) => AssertQuery( async, @@ -1777,8 +1610,7 @@ public virtual Task Where_query_composition_entity_equality_multiple_elements_Fi select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition_entity_equality_multiple_elements_First(bool async) => AssertQuery( async, @@ -1790,8 +1622,7 @@ public virtual Task Where_query_composition_entity_equality_multiple_elements_Fi select e1, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition2(bool async) => AssertQuery( async, @@ -1801,8 +1632,7 @@ where e1.FirstName select new { Foo = e2 }).First().Foo.FirstName select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition2_FirstOrDefault(bool async) => AssertQuery( async, @@ -1812,8 +1642,7 @@ where e1.FirstName select e2).FirstOrDefault().FirstName select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition2_FirstOrDefault_with_anonymous(bool async) => AssertQuery( async, @@ -1823,33 +1652,28 @@ where e1.FirstName select new { Foo = e2 }).FirstOrDefault().Foo.FirstName select e1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition3(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from c1 in ss.Set() - where c1.City == ss.Set().OrderBy(c => c.CustomerID).First(c => c.IsLondon).City - select c1)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from c1 in ss.Set() + where c1.City == ss.Set().OrderBy(c => c.CustomerID).First(c => c.IsLondon).City + select c1)); #pragma warning disable CS9236 // Compiling requires binding the lambda expression at least 200 times - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition4(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from c1 in ss.Set().OrderBy(c => c.CustomerID).Take(2) - where c1.City - == (from c2 in ss.Set().OrderBy(c => c.CustomerID) - from c3 in ss.Set().OrderBy(bool (Customer c) => c.IsLondon).ThenBy(string (Customer c) => c.CustomerID) - select new { c3 }).First().c3.City - select c1)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from c1 in ss.Set().OrderBy(c => c.CustomerID).Take(2) + where c1.City + == (from c2 in ss.Set().OrderBy(c => c.CustomerID) + from c3 in ss.Set().OrderBy(bool (c) => c.IsLondon).ThenBy(string (c) => c.CustomerID) + select new { c3 }).First().c3.City + select c1)); #pragma warning restore CS9236 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition5(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -1859,8 +1683,7 @@ public virtual Task Where_query_composition5(bool async) select c1), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_query_composition6(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -1873,8 +1696,7 @@ where c1.IsLondon select c1), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_recursive_trivial(bool async) => AssertQuery( async, @@ -1888,33 +1710,29 @@ orderby e1.EmployeeID select e1, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_scalar_primitive(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => e.EmployeeID).OrderBy(i => i), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_mixed(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from e1 in ss.Set().OrderBy(e => e.EmployeeID).Take(2) - from s in new[] { "a", "b" } - from c in ss.Set().OrderBy(c => c.CustomerID).Take(2) - select new - { - e1, - s, - c - }, - e => (e.e1.EmployeeID, e.c.CustomerID))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from e1 in ss.Set().OrderBy(e => e.EmployeeID).Take(2) + from s in new[] { "a", "b" } + from c in ss.Set().OrderBy(c => c.CustomerID).Take(2) + select new + { + e1, + s, + c + }, + e => (e.e1.EmployeeID, e.c.CustomerID))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_simple1(bool async) => AssertQuery( async, @@ -1924,8 +1742,7 @@ from c in ss.Set() select new { c, e }, e => (e.c.CustomerID, e.e.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_simple_subquery(bool async) => AssertQuery( async, @@ -1935,8 +1752,7 @@ from c in ss.Set() select new { c, e }, e => (e.c.CustomerID, e.e.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_simple2(bool async) => AssertQuery( async, @@ -1952,8 +1768,7 @@ from e2 in ss.Set() }, e => (e.e1.EmployeeID, e.c.CustomerID, e.FirstName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_entity_deep(bool async) => AssertQuery( async, @@ -1970,8 +1785,7 @@ from e4 in ss.Set() }, e => (e.e2.EmployeeID, e.e3.EmployeeID, e.e1.EmployeeID, e.e4.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_projection1(bool async) => AssertQuery( async, @@ -1980,8 +1794,7 @@ from e2 in ss.Set() select new { e1.City, e2.Country }, e => (e.City, e.Country)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_projection2(bool async) => AssertQuery( async, @@ -1996,8 +1809,7 @@ from e3 in ss.Set() }, e => (e.City, e.Country, e.FirstName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_nested_simple(bool async) => AssertQuery( async, @@ -2013,8 +1825,7 @@ orderby c1.CustomerID .Select(t => t.c1), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_simple(bool async) => AssertQuery( async, @@ -2026,8 +1837,7 @@ from e in ss.Set() select new { c, e }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_subquery_simple(bool async) => AssertQuery( async, @@ -2038,8 +1848,7 @@ from e in ss.Set().Where(e => e.City == c.City) select new { c, e }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_subquery_hard(bool async) => AssertQuery( async, @@ -2055,8 +1864,7 @@ from e2 in select new { c1, e1 }, e => (e.c1, e.e1.City, e.e1.c1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_cartesian_product_with_ordering(bool async) => AssertQuery( async, @@ -2068,8 +1876,7 @@ from e in ss.Set() select new { c, e.City }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_primitive(bool async) => AssertQueryScalar( async, @@ -2077,8 +1884,7 @@ public virtual Task SelectMany_primitive(bool async) from i in ss.Set().Select(e2 => e2.EmployeeID) select i); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_primitive_select_subquery(bool async) => AssertQueryScalar( async, @@ -2086,8 +1892,7 @@ public virtual Task SelectMany_primitive_select_subquery(bool async) from i in ss.Set().Select(e2 => e2.EmployeeID) select ss.Set().Any()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_Where_Count(bool async) => AssertCount( async, @@ -2096,54 +1901,44 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID where c.CustomerID == "ALFKI" select c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Join_Any(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => c.CustomerID.StartsWith("A") && c.Orders.Any(o => o.OrderDate == new DateTime(1998, 1, 15)))); + ss => ss.Set() + .Where(c => c.CustomerID.StartsWith("A") && c.Orders.Any(o => o.OrderDate == new DateTime(1998, 1, 15)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Join_Exists(bool async) // Translate List.Exists. Issue #17762. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().Where( - c => c.CustomerID == "ALFKI" && c.Orders.Exists(o => o.OrderDate == new DateTime(2008, 10, 24))))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set() + .Where(c => c.CustomerID == "ALFKI" && c.Orders.Exists(o => o.OrderDate == new DateTime(2008, 10, 24))))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Join_Exists_Inequality(bool async) // Translate List.Exists. Issue #17762. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().Where( - c => c.CustomerID == "ALFKI" && c.Orders.Exists(o => o.OrderDate != new DateTime(2008, 10, 24))))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set() + .Where(c => c.CustomerID == "ALFKI" && c.Orders.Exists(o => o.OrderDate != new DateTime(2008, 10, 24))))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Join_Exists_Constant(bool async) // Translate List.Exists. Issue #17762. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().Where(c => c.CustomerID == "ALFKI" && c.Orders.Exists(o => false)))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().Where(c => c.CustomerID == "ALFKI" && c.Orders.Exists(o => false)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Join_Not_Exists(bool async) // Translate List.Exists. Issue #17762. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().Where(c => c.CustomerID == "ALFKI" && !c.Orders.Exists(o => false)))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().Where(c => c.CustomerID == "ALFKI" && !c.Orders.Exists(o => false)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_joins_Where_Order_Any(bool async) => AssertAny( async, @@ -2157,8 +1952,7 @@ public virtual Task Multiple_joins_Where_Order_Any(bool async) }) .Where(r => r.cr.City == "London").OrderBy(r => r.cr.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_OrderBy_Count(bool async) => AssertCount( async, @@ -2167,8 +1961,7 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID orderby c.CustomerID select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_join_select(bool async) => AssertQuery( async, @@ -2178,8 +1971,7 @@ public virtual Task Where_join_select(bool async) join o in ss.Set() on c.CustomerID equals o.CustomerID select c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_orderby_join_select(bool async) => AssertQuery( async, @@ -2190,8 +1982,7 @@ orderby c.CustomerID join o in ss.Set() on c.CustomerID equals o.CustomerID select c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_join_orderby_join_select(bool async) => AssertQuery( async, @@ -2202,8 +1993,7 @@ orderby c.CustomerID join od in ss.Set() on o.OrderID equals od.OrderID select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_select_many(bool async) => AssertQuery( async, @@ -2213,8 +2003,7 @@ public virtual Task Where_select_many(bool async) from o in ss.Set() select c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_orderby_select_many(bool async) => AssertQuery( async, @@ -2232,15 +2021,13 @@ protected class Foo protected const uint NonExistentID = uint.MaxValue; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_top_level(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.EmployeeID == NonExistentID).DefaultIfEmpty()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_DefaultIfEmpty_on_both_sources(bool async) => AssertQuery( async, @@ -2254,56 +2041,47 @@ public virtual Task Join_with_DefaultIfEmpty_on_both_sources(bool async) o => o, i => i, (o, i) => o), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_top_level_followed_by_constant_Select(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.EmployeeID == NonExistentID).DefaultIfEmpty().Select(_ => "Foo")); - [ConditionalTheory] // #36208 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #36208 public virtual Task DefaultIfEmpty_top_level_preceded_by_constant_Select(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.EmployeeID == NonExistentID).Select(_ => "Foo").DefaultIfEmpty()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_top_level_arg(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().Where(c => c.EmployeeID == NonExistentID).DefaultIfEmpty(new Employee()))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().Where(c => c.EmployeeID == NonExistentID).DefaultIfEmpty(new Employee()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_top_level_arg_followed_by_projecting_constant(bool async) - => AssertTranslationFailed( - () => AssertQueryScalar( - async, - ss => ss.Set() - .Where(c => c.EmployeeID == NonExistentID) - .DefaultIfEmpty(new Employee()) - .Select(_ => 42))); + => AssertTranslationFailed(() => AssertQueryScalar( + async, + ss => ss.Set() + .Where(c => c.EmployeeID == NonExistentID) + .DefaultIfEmpty(new Employee()) + .Select(_ => 42))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_top_level_positive(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.EmployeeID > 0).DefaultIfEmpty()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_top_level_projection(bool async) => AssertQueryScalar( async, ss => from e in ss.Set().Where(e => e.EmployeeID == NonExistentID).Select(e => e.EmployeeID).DefaultIfEmpty() select e); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_customer_orders(bool async) => AssertQuery( async, @@ -2314,8 +2092,7 @@ from o in ss.Set() select new { c.ContactName, o.OrderID }, e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Count(bool async) => AssertCount( async, @@ -2323,8 +2100,7 @@ public virtual Task SelectMany_Count(bool async) from o in ss.Set() select c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_LongCount(bool async) => AssertLongCount( async, @@ -2332,8 +2108,7 @@ public virtual Task SelectMany_LongCount(bool async) from o in ss.Set() select c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_OrderBy_ThenBy_Any(bool async) => AssertAny( async, @@ -2342,8 +2117,7 @@ from o in ss.Set() orderby c.CustomerID, c.City select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy(bool async) => AssertQuery( async, @@ -2351,22 +2125,19 @@ public virtual Task OrderBy(bool async) ss => ss.Set().OrderBy(c => c.CustomerID, StringComparer.Ordinal), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_true(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => true).Select(c => c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_integer(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => 3).Select(c => c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_parameter(bool async) { var param = 5; @@ -2375,30 +2146,23 @@ public virtual Task OrderBy_parameter(bool async) ss => ss.Set().OrderBy(c => param).Select(c => c)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_anon(bool async) => AssertQuery( async, - ss => ss.Set().Select( - c => new { c.CustomerID }).OrderBy(a => a.CustomerID), - ss => ss.Set().Select( - c => new { c.CustomerID }).OrderBy(a => a.CustomerID, StringComparer.Ordinal), + ss => ss.Set().Select(c => new { c.CustomerID }).OrderBy(a => a.CustomerID), + ss => ss.Set().Select(c => new { c.CustomerID }).OrderBy(a => a.CustomerID, StringComparer.Ordinal), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_anon2(bool async) => AssertQuery( async, - ss => ss.Set().Select( - c => new { c }).OrderBy(a => a.c.CustomerID), - ss => ss.Set().Select( - c => new { c }).OrderBy(a => a.c.CustomerID, StringComparer.Ordinal), + ss => ss.Set().Select(c => new { c }).OrderBy(a => a.c.CustomerID), + ss => ss.Set().Select(c => new { c }).OrderBy(a => a.c.CustomerID, StringComparer.Ordinal), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_client_mixed(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -2407,27 +2171,23 @@ public virtual Task OrderBy_client_mixed(bool async) assertOrder: true), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_multiple_queries(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from c in ss.Set() - join o in ss.Set() on new Foo { Bar = c.CustomerID } equals new Foo { Bar = o.CustomerID } - orderby c.IsLondon, o.OrderDate - select new { c, o })); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from c in ss.Set() + join o in ss.Set() on new Foo { Bar = c.CustomerID } equals new Foo { Bar = o.CustomerID } + orderby c.IsLondon, o.OrderDate + select new { c, o })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_shadow(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(e => EF.Property(e, "Title")).ThenBy(e => e.EmployeeID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_ThenBy_predicate(bool async) => AssertQuery( async, @@ -2436,8 +2196,7 @@ public virtual Task OrderBy_ThenBy_predicate(bool async) .ThenBy(c => c.CustomerID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_correlated_subquery1(bool async) => AssertQuery( async, @@ -2447,21 +2206,16 @@ orderby ss.Set().Any(c2 => c2.CustomerID == c.CustomerID), c.CustomerI select c, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_correlated_subquery2(bool async) => AssertQuery( async, - ss => ss.Set().Where( - o => o.OrderID <= 10250 - && ss.Set().OrderBy( - c => ss.Set().Any( - c2 => c2.CustomerID == "ALFKI")) - .FirstOrDefault().City - != "Nowhere")); + ss => ss.Set().Where(o => o.OrderID <= 10250 + && ss.Set().OrderBy(c => ss.Set().Any(c2 => c2.CustomerID == "ALFKI")) + .FirstOrDefault().City + != "Nowhere")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Select(bool async) => AssertQuery( async, @@ -2471,8 +2225,7 @@ public virtual Task OrderBy_Select(bool async) .Select(c => c.ContactName), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_multiple(bool async) => AssertQuery( async, @@ -2483,8 +2236,7 @@ public virtual Task OrderBy_multiple(bool async) .Select(c => c.City), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_ThenBy(bool async) => AssertQuery( async, @@ -2496,8 +2248,7 @@ public virtual Task OrderBy_ThenBy(bool async) .Select(c => c.City), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderByDescending(bool async) => AssertQuery( async, @@ -2505,8 +2256,7 @@ public virtual Task OrderByDescending(bool async) ss => ss.Set().OrderByDescending(c => c.CustomerID, StringComparer.Ordinal).Select(c => c.City), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderByDescending_ThenBy(bool async) => AssertQuery( async, @@ -2518,8 +2268,7 @@ public virtual Task OrderByDescending_ThenBy(bool async) .Select(c => c.City), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderByDescending_ThenByDescending(bool async) => AssertQuery( async, @@ -2531,8 +2280,7 @@ public virtual Task OrderByDescending_ThenByDescending(bool async) .Select(c => c.City), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Order(bool async) => AssertQuery( async, @@ -2540,8 +2288,7 @@ public virtual Task Select_Order(bool async) ss => ss.Set().Select(c => c.CustomerID).Order(StringComparer.Ordinal), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_OrderDescending(bool async) => AssertQuery( async, @@ -2549,8 +2296,7 @@ public virtual Task Select_OrderDescending(bool async) ss => ss.Set().Select(c => c.CustomerID).OrderDescending(StringComparer.Ordinal), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Order_First(bool async) => AssertQuery( async, @@ -2558,15 +2304,13 @@ public virtual Task Where_Order_First(bool async) ss => ss.Set().AsEnumerable().Where(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault()?.OrderID == 10248) .Select(c => c.CustomerID).AsQueryable()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_ThenBy_Any(bool async) => AssertAny( async, ss => ss.Set().OrderBy(c => c.CustomerID).ThenBy(c => c.ContactName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Join(bool async) => AssertQuery( async, @@ -2575,8 +2319,7 @@ from c in ss.Set().OrderBy(c => c.CustomerID) join o in ss.Set().OrderBy(o => o.OrderID) on c.CustomerID equals o.CustomerID select new { c.CustomerID, o.OrderID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_SelectMany(bool async) => AssertQuery( async, @@ -2590,12 +2333,10 @@ from o in ss.Set().OrderBy(o => o.OrderID).Take(3) .SelectMany( _ => ss.Set().OrderBy(o => o.OrderID).Take(3), (c, o) => new { c, o }).Where(t => t.c.CustomerID == t.o.CustomerID) - .Select( - t => new { t.c.ContactName, t.o.OrderID }), + .Select(t => new { t.c.ContactName, t.o.OrderID }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Let_any_subquery_anonymous(bool async) => AssertQuery( async, @@ -2607,39 +2348,34 @@ orderby c.CustomerID select new { c, hasOrders }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_arithmetic(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(e => e.EmployeeID - e.EmployeeID).Select(e => e)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_condition_comparison(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(p => p.UnitsInStock > 0).ThenBy(p => p.ProductID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_ternary_conditions(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(p => p.UnitsInStock > 10 ? p.ProductID > 40 : p.ProductID <= 40).ThenBy(p => p.ProductID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_any(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(p => p.Orders.Any(o => o.OrderID > 11000)).ThenBy(p => p.CustomerID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Joined(bool async) => AssertQuery( async, @@ -2649,8 +2385,7 @@ from o in ss.Set().Where(o => o.CustomerID == c.CustomerID) select new { c.ContactName, o.OrderDate }, e => (e.ContactName, e.OrderDate)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Joined_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -2660,8 +2395,7 @@ from o in ss.Set().Where(o => o.CustomerID == c.CustomerID).DefaultIfEmpt select new { c.ContactName, o }, e => (e.ContactName, e.o?.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Joined_Take(bool async) => AssertQuery( async, @@ -2671,8 +2405,7 @@ from o in ss.Set().Where(o => o.CustomerID == c.CustomerID).Take(4) select new { c.ContactName, o }, e => e.o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Joined_DefaultIfEmpty2(bool async) => AssertQuery( async, @@ -2681,8 +2414,7 @@ from c in ss.Set() from o in ss.Set().Where(o => o.CustomerID == c.CustomerID).DefaultIfEmpty() select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_Joined_DefaultIfEmpty3(bool async) => AssertQuery( async, @@ -2691,40 +2423,35 @@ from c in ss.Set() from o in ss.Set().Where(o => o.CustomerID == c.CustomerID).Where(o => o.OrderDetails.Any()).DefaultIfEmpty() select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_many_cross_join_same_collection(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(c => ss.Set())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_null_coalesce_operator(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.Region ?? "ZZ").ThenBy(c => c.CustomerID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_null_coalesce_operator(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - c.CustomerID, - c.CompanyName, - Region = c.Region ?? "ZZ" - }) + .Select(c => new + { + c.CustomerID, + c.CompanyName, + Region = c.Region ?? "ZZ" + }) .OrderBy(o => o.Region) .ThenBy(o => o.CustomerID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_conditional_operator(bool async) { return AssertQuery( @@ -2736,8 +2463,7 @@ public virtual Task OrderBy_conditional_operator(bool async) assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_conditional_operator_where_condition_false(bool async) { var fakeCustomer = new Customer(); @@ -2748,113 +2474,99 @@ public virtual Task OrderBy_conditional_operator_where_condition_false(bool asyn .Select(c => c)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_comparison_operator(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(c => c.Region == "ASK").Select(c => c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_null_coalesce_operator(bool async) => AssertQuery( async, - ss => ss.Set().Select( - c => new - { - c.CustomerID, - c.CompanyName, - Region = c.Region ?? "ZZ" - }), + ss => ss.Set().Select(c => new + { + c.CustomerID, + c.CompanyName, + Region = c.Region ?? "ZZ" + }), e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_coalesce_operator(bool async) => AssertQuery( async, ss => ss.Set() .Where(c => (c.ContactName ?? c.CompanyName) == "Liz Nixon")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_skip_null_coalesce_operator(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.Region ?? "ZZ").Take(10).Skip(5).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_take_null_coalesce_operator(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - c.CustomerID, - c.CompanyName, - Region = c.Region ?? "ZZ" - }) + .Select(c => new + { + c.CustomerID, + c.CompanyName, + Region = c.Region ?? "ZZ" + }) .OrderBy(c => c.Region) .Take(5), e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_take_skip_null_coalesce_operator(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - c.CustomerID, - c.CompanyName, - Region = c.Region ?? "ZZ" - }) + .Select(c => new + { + c.CustomerID, + c.CompanyName, + Region = c.Region ?? "ZZ" + }) .OrderBy(c => c.Region) .Take(10) .Skip(5), e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_take_skip_null_coalesce_operator2(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - c.CustomerID, - c.CompanyName, - c.Region - }) + .Select(c => new + { + c.CustomerID, + c.CompanyName, + c.Region + }) .OrderBy(c => c.Region ?? "ZZ") .Take(10) .Skip(5), e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_take_skip_null_coalesce_operator3(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.Region ?? "ZZ").Take(10).Skip(5)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Property_when_non_shadow(bool async) => AssertQueryScalar( async, ss => from o in ss.Set() select EF.Property(o, "OrderID")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Property_when_non_shadow(bool async) => AssertQuery( async, @@ -2862,16 +2574,14 @@ public virtual Task Where_Property_when_non_shadow(bool async) where EF.Property(o, "OrderID") == 10248 select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Property_when_shadow(bool async) => AssertQuery( async, ss => from e in ss.Set() select EF.Property(e, "Title")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Property_when_shadow(bool async) => AssertQuery( async, @@ -2879,15 +2589,13 @@ public virtual Task Where_Property_when_shadow(bool async) where EF.Property(e, "Title") == "Sales Representative" select e); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Property_when_shadow_unconstrained_generic_method(bool async) => AssertQuery( async, ss => ShadowPropertySelect(ss.Set(), "Title")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Property_when_shadow_unconstrained_generic_method(bool async) => AssertQuery( async, @@ -2899,8 +2607,7 @@ protected IQueryable ShadowPropertySelect(IQueryable sourc protected IQueryable ShadowPropertyWhere(IQueryable source, object column, string value) => source.Where(e => EF.Property(e, (string)column) == value); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_Property_shadow_closure(bool async) { var propertyName = "Title"; @@ -2918,8 +2625,7 @@ await AssertQuery( ss => ss.Set().Where(e => EF.Property(e, propertyName) == value)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Selected_column_can_coalesce(bool async) => AssertQuery( async, @@ -2947,8 +2653,7 @@ public virtual async Task IQueryable_captured_variable() _ = await context.Customers.CountAsync(c => nestedOrdersQuery.Count() == 2); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Subquery_Single(bool async) => AssertQuery( async, @@ -2959,8 +2664,7 @@ public virtual Task Select_Subquery_Single(bool async) orderby o.OrderID select o).First()).Take(2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Subquery_Deep_Single(bool async) => AssertQuery( async, @@ -2979,8 +2683,7 @@ select c select od) .Take(2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Subquery_Deep_First(bool async) => AssertQuery( async, @@ -2999,8 +2702,7 @@ select c select od) .Take(2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Subquery_Equality(bool async) => AssertQuery( async, @@ -3023,8 +2725,7 @@ orderby o.OrderID select o, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Throws_on_concurrent_query_list(bool async) { using var context = CreateContext(); @@ -3032,30 +2733,27 @@ public virtual async Task Throws_on_concurrent_query_list(bool async) using var synchronizationEvent = new ManualResetEventSlim(false); using var blockingSemaphore = new SemaphoreSlim(0); - var blockingTask = Task.Run( - async () => + var blockingTask = Task.Run(async () => + { + try { - try - { - await context.Customers.Select( - c => Process(c, synchronizationEvent, blockingSemaphore)).ToListAsync(); - } - finally - { - synchronizationEvent.Set(); - } - }); - - var throwingTask = Task.Run( - async () => + await context.Customers.Select(c => Process(c, synchronizationEvent, blockingSemaphore)).ToListAsync(); + } + finally { - synchronizationEvent.Wait(TimeSpan.FromMinutes(5)); - Assert.Equal( - CoreStrings.ConcurrentMethodInvocation, - (async - ? await Assert.ThrowsAsync(() => context.Customers.ToListAsync()) - : Assert.Throws(() => context.Customers.ToList())).Message); - }); + synchronizationEvent.Set(); + } + }); + + var throwingTask = Task.Run(async () => + { + synchronizationEvent.Wait(TimeSpan.FromMinutes(5)); + Assert.Equal( + CoreStrings.ConcurrentMethodInvocation, + (async + ? await Assert.ThrowsAsync(() => context.Customers.ToListAsync()) + : Assert.Throws(() => context.Customers.ToList())).Message); + }); await throwingTask; @@ -3064,8 +2762,7 @@ await context.Customers.Select( await blockingTask; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Throws_on_concurrent_query_first(bool async) { using var context = CreateContext(); @@ -3073,30 +2770,27 @@ public virtual async Task Throws_on_concurrent_query_first(bool async) using var synchronizationEvent = new ManualResetEventSlim(false); using var blockingSemaphore = new SemaphoreSlim(0); - var blockingTask = Task.Run( - async () => + var blockingTask = Task.Run(async () => + { + try { - try - { - await context.Customers.Select( - c => Process(c, synchronizationEvent, blockingSemaphore)).ToListAsync(); - } - finally - { - synchronizationEvent.Set(); - } - }); - - var throwingTask = Task.Run( - async () => + await context.Customers.Select(c => Process(c, synchronizationEvent, blockingSemaphore)).ToListAsync(); + } + finally { - synchronizationEvent.Wait(TimeSpan.FromMinutes(5)); - Assert.Equal( - CoreStrings.ConcurrentMethodInvocation, - (async - ? await Assert.ThrowsAsync(() => context.Customers.FirstAsync()) - : Assert.Throws(() => context.Customers.First())).Message); - }); + synchronizationEvent.Set(); + } + }); + + var throwingTask = Task.Run(async () => + { + synchronizationEvent.Wait(TimeSpan.FromMinutes(5)); + Assert.Equal( + CoreStrings.ConcurrentMethodInvocation, + (async + ? await Assert.ThrowsAsync(() => context.Customers.FirstAsync()) + : Assert.Throws(() => context.Customers.First())).Message); + }); await throwingTask; @@ -3113,30 +2807,26 @@ private static Customer Process(Customer c, ManualResetEventSlim e, SemaphoreSli return c; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Environment_newline_is_funcletized(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID.Contains(Environment.NewLine)), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_string_int(bool isAsync) => AssertQuery( isAsync, ss => ss.Set().Select(o => o.OrderID + o.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_int_string(bool isAsync) => AssertQuery( isAsync, ss => ss.Set().Select(o => o.CustomerID + o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_parameter_string_int(bool isAsync) { var parameter = "-"; @@ -3145,29 +2835,25 @@ public virtual Task Concat_parameter_string_int(bool isAsync) ss => ss.Set().Select(o => parameter + o.OrderID)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_constant_string_int(bool isAsync) => AssertQuery( isAsync, ss => ss.Set().Select(o => "-" + o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_concat_with_navigation1(bool async) => AssertQuery( async, ss => ss.Set().Select(o => o.CustomerID + " " + o.Customer.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_concat_with_navigation2(bool async) => AssertQuery( async, ss => ss.Set().Select(o => o.Customer.City + " " + o.Customer.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Handle_materialization_properly_when_more_than_two_query_sources_are_involved(bool async) => AssertFirstOrDefault( async, @@ -3176,8 +2862,7 @@ from o in ss.Set() from e in ss.Set() select new { c }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Parameter_extraction_short_circuits_1(bool async) { DateTime? dateFilter = new DateTime(1996, 7, 15); @@ -3185,143 +2870,125 @@ public virtual async Task Parameter_extraction_short_circuits_1(bool async) await AssertQuery( async, ss => - ss.Set().Where( - o => (o.OrderID < 10400) - && ((dateFilter == null) - || (o.OrderDate.HasValue - && o.OrderDate.Value.Month == dateFilter.Value.Month - && o.OrderDate.Value.Year == dateFilter.Value.Year)))); + ss.Set().Where(o => (o.OrderID < 10400) + && ((dateFilter == null) + || (o.OrderDate.HasValue + && o.OrderDate.Value.Month == dateFilter.Value.Month + && o.OrderDate.Value.Year == dateFilter.Value.Year)))); dateFilter = null; await AssertQuery( async, ss => - ss.Set().Where( - o => (o.OrderID < 10400) - && ((dateFilter == null) - || (o.OrderDate.HasValue - && o.OrderDate.Value.Month == dateFilter.Value.Month - && o.OrderDate.Value.Year == dateFilter.Value.Year)))); + ss.Set().Where(o => (o.OrderID < 10400) + && ((dateFilter == null) + || (o.OrderDate.HasValue + && o.OrderDate.Value.Month == dateFilter.Value.Month + && o.OrderDate.Value.Year == dateFilter.Value.Year)))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Parameter_extraction_short_circuits_2(bool async) { DateTime? dateFilter = new DateTime(1996, 7, 15); await AssertQuery( async, - ss => ss.Set().Where( - o => (o.OrderID < 10400) - && (dateFilter.HasValue) - && (o.OrderDate.HasValue - && o.OrderDate.Value.Month == dateFilter.Value.Month - && o.OrderDate.Value.Year == dateFilter.Value.Year))); + ss => ss.Set().Where(o => (o.OrderID < 10400) + && (dateFilter.HasValue) + && (o.OrderDate.HasValue + && o.OrderDate.Value.Month == dateFilter.Value.Month + && o.OrderDate.Value.Year == dateFilter.Value.Year))); dateFilter = null; await AssertQuery( async, - ss => ss.Set().Where( - o => (o.OrderID < 10400) - && (dateFilter.HasValue) - && (o.OrderDate.HasValue - && o.OrderDate.Value.Month == dateFilter.Value.Month - && o.OrderDate.Value.Year == dateFilter.Value.Year)), + ss => ss.Set().Where(o => (o.OrderID < 10400) + && (dateFilter.HasValue) + && (o.OrderDate.HasValue + && o.OrderDate.Value.Month == dateFilter.Value.Month + && o.OrderDate.Value.Year == dateFilter.Value.Year)), assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Parameter_extraction_short_circuits_3(bool async) { DateTime? dateFilter = new DateTime(1996, 7, 15); await AssertQuery( async, - ss => ss.Set().Where( - o => (o.OrderID < 10400) - || (dateFilter == null) - || (o.OrderDate.HasValue - && o.OrderDate.Value.Month == dateFilter.Value.Month - && o.OrderDate.Value.Year == dateFilter.Value.Year))); + ss => ss.Set().Where(o => (o.OrderID < 10400) + || (dateFilter == null) + || (o.OrderDate.HasValue + && o.OrderDate.Value.Month == dateFilter.Value.Month + && o.OrderDate.Value.Year == dateFilter.Value.Year))); dateFilter = null; await AssertQuery( async, - ss => ss.Set().Where( - o => (o.OrderID < 10400) - || (dateFilter == null) - || (o.OrderDate.HasValue - && o.OrderDate.Value.Month == dateFilter.Value.Month - && o.OrderDate.Value.Year == dateFilter.Value.Year))); + ss => ss.Set().Where(o => (o.OrderID < 10400) + || (dateFilter == null) + || (o.OrderDate.HasValue + && o.OrderDate.Value.Month == dateFilter.Value.Month + && o.OrderDate.Value.Year == dateFilter.Value.Year))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Parameter_extraction_can_throw_exception_from_user_code(bool async) { var customer = new Customer(); - return Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Where(c => Equals(c.Orders.First(), customer.Orders.First())))); + return Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Where(c => Equals(c.Orders.First(), customer.Orders.First())))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Parameter_extraction_can_throw_exception_from_user_code_2(bool async) { DateTime? dateFilter = null; - return Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Where( - o => (o.OrderID < 10400) - && o.OrderDate.HasValue - && o.OrderDate.Value.Month == dateFilter.Value.Month - && o.OrderDate.Value.Year == dateFilter.Value.Year))); + return Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Where(o => (o.OrderID < 10400) + && o.OrderDate.HasValue + && o.OrderDate.Value.Month == dateFilter.Value.Month + && o.OrderDate.Value.Year == dateFilter.Value.Year))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_member_pushdown_does_not_change_original_subquery_model(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(o => o.OrderID) .Take(3) - .Select( - o => new { OrderId = o.OrderID, ss.Set().SingleOrDefault(c => c.CustomerID == o.CustomerID).City }) + .Select(o => new { OrderId = o.OrderID, ss.Set().SingleOrDefault(c => c.CustomerID == o.CustomerID).City }) .OrderBy(o => o.City), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_member_pushdown_does_not_change_original_subquery_model2(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(o => o.OrderID) .Take(3) - .Select( - o => new - { - OrderId = o.OrderID, - City = EF.Property( - ss.Set().SingleOrDefault(c => c.CustomerID == o.CustomerID), "City") - }) + .Select(o => new + { + OrderId = o.OrderID, + City = EF.Property( + ss.Set().SingleOrDefault(c => c.CustomerID == o.CustomerID), "City") + }) .OrderBy(o => o.City), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_expression_with_to_string_and_contains(bool async) => AssertQuery( async, @@ -3329,8 +2996,7 @@ public virtual Task Query_expression_with_to_string_and_contains(bool async) .Select(o => new Order { CustomerID = o.CustomerID }), elementSorter: e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_other_to_string(bool async) => AssertQuery( async, @@ -3338,8 +3004,7 @@ public virtual Task Select_expression_other_to_string(bool async) .Select(o => new Order { ShipName = o.OrderDate.Value.ToString() }), e => e.ShipName); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_long_to_string(bool async) => AssertQuery( async, @@ -3347,8 +3012,7 @@ public virtual Task Select_expression_long_to_string(bool async) .Select(o => new Order { ShipName = ((long)o.OrderID).ToString() }), e => e.ShipName); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_int_to_string(bool async) => AssertQuery( async, @@ -3356,8 +3020,7 @@ public virtual Task Select_expression_int_to_string(bool async) .Select(o => new Order { ShipName = o.OrderID.ToString() }), e => e.ShipName); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task ToString_with_formatter_is_evaluated_on_the_client(bool async) { await AssertQuery( @@ -3373,8 +3036,7 @@ await AssertQuery( e => e.ShipName); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_date_add_year(bool async) => AssertQuery( async, @@ -3382,8 +3044,7 @@ public virtual Task Select_expression_date_add_year(bool async) .Select(o => new Order { OrderDate = o.OrderDate.Value.AddYears(1) }), e => e.OrderDate); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_datetime_add_month(bool async) => AssertQuery( async, @@ -3392,8 +3053,7 @@ public virtual Task Select_expression_datetime_add_month(bool async) .Select(o => new Order { OrderDate = o.OrderDate.Value.AddMonths(1) }), e => e.OrderDate); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_datetime_add_hour(bool async) => AssertQuery( async, @@ -3401,8 +3061,7 @@ public virtual Task Select_expression_datetime_add_hour(bool async) .Select(o => new Order { OrderDate = o.OrderDate.Value.AddHours(1) }), e => e.OrderDate); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_datetime_add_minute(bool async) => AssertQuery( async, @@ -3410,8 +3069,7 @@ public virtual Task Select_expression_datetime_add_minute(bool async) .Select(o => new Order { OrderDate = o.OrderDate.Value.AddMinutes(1) }), e => e.OrderDate); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_datetime_add_second(bool async) => AssertQuery( async, @@ -3419,8 +3077,7 @@ public virtual Task Select_expression_datetime_add_second(bool async) .Select(o => new Order { OrderDate = o.OrderDate.Value.AddSeconds(1) }), e => e.OrderDate); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_datetime_add_ticks(bool async) => AssertQuery( async, @@ -3428,8 +3085,7 @@ public virtual Task Select_expression_datetime_add_ticks(bool async) .Select(o => new Order { OrderDate = o.OrderDate.Value.AddTicks(TimeSpan.TicksPerMillisecond) }), e => e.OrderDate); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_date_add_milliseconds_above_the_range(bool async) => AssertQuery( async, @@ -3437,34 +3093,30 @@ public virtual Task Select_expression_date_add_milliseconds_above_the_range(bool .Select(o => new Order { OrderDate = o.OrderDate.Value.AddMilliseconds(1000000000000) }), e => e.OrderDate); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_date_add_milliseconds_below_the_range(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.OrderDate != null) .Select(o => new Order { OrderDate = o.OrderDate.Value.AddMilliseconds(-1000000000000) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_date_add_milliseconds_large_number_divided(bool async) { var millisecondsPerDay = 86400000L; return AssertQuery( async, ss => ss.Set().Where(o => o.OrderDate != null) - .Select( - o => new Order - { - OrderDate = o.OrderDate.Value - .AddDays(o.OrderDate.Value.Millisecond / millisecondsPerDay) - .AddMilliseconds(o.OrderDate.Value.Millisecond % millisecondsPerDay) - }), + .Select(o => new Order + { + OrderDate = o.OrderDate.Value + .AddDays(o.OrderDate.Value.Millisecond / millisecondsPerDay) + .AddMilliseconds(o.OrderDate.Value.Millisecond % millisecondsPerDay) + }), e => e.OrderDate); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Add_minutes_on_constant_value(bool async) => AssertQuery( async, @@ -3474,8 +3126,7 @@ public virtual Task Add_minutes_on_constant_value(bool async) assertOrder: true, elementAsserter: (e, a) => AssertEqual(e.Test, a.Test)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_expression_references_are_updated_correctly_with_subquery(bool async) { var nextYear = 2017; @@ -3488,15 +3139,13 @@ public virtual Task Select_expression_references_are_updated_correctly_with_subq .Where(x => x < nextYear)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_without_group_join(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.City == "London").DefaultIfEmpty().Where(d => d != null).Select(d => d.CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_in_subquery(bool async) => AssertQuery( async, @@ -3507,8 +3156,7 @@ from o in ss.Set().Where(o => o.CustomerID == c.CustomerID).DefaultIfEmpt select new { c.CustomerID, o.OrderID }), e => (e.CustomerID, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_in_subquery_not_correlated(bool async) => AssertQuery( async, @@ -3518,8 +3166,7 @@ from o in ss.Set().Where(o => o.OrderID > 15000).DefaultIfEmpty() select new { c.CustomerID, OrderID = o != null ? o.OrderID : (int?)null }), e => (e.CustomerID, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_in_subquery_nested(bool async) => AssertQuery( async, @@ -3537,8 +3184,7 @@ from o2 in ss.Set().Where(o => o.CustomerID == c.CustomerID).DefaultIfEmp }), e => (e.CustomerID, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_in_subquery_nested_filter_order_comparison(bool async) => AssertQuery( async, @@ -3556,8 +3202,7 @@ from o2 in ss.Set().Where(o => o.OrderID <= c.CustomerID.Length + 10250). }), e => (e.CustomerID, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_skip_take(bool async) => AssertQuery( async, @@ -3567,8 +3212,7 @@ public virtual Task OrderBy_skip_take(bool async) .Take(8), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_skip_skip_take(bool async) => AssertQuery( async, @@ -3579,8 +3223,7 @@ public virtual Task OrderBy_skip_skip_take(bool async) .Take(3), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_skip_take_take(bool async) => AssertQuery( async, @@ -3591,8 +3234,7 @@ public virtual Task OrderBy_skip_take_take(bool async) .Take(3), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_skip_take_take_take_take(bool async) => AssertQuery( async, @@ -3605,8 +3247,7 @@ public virtual Task OrderBy_skip_take_take_take_take(bool async) .Take(5), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_skip_take_skip_take_skip(bool async) => AssertQuery( async, @@ -3619,8 +3260,7 @@ public virtual Task OrderBy_skip_take_skip_take_skip(bool async) .Skip(5), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_skip_take_distinct(bool async) => AssertQuery( async, @@ -3631,8 +3271,7 @@ public virtual Task OrderBy_skip_take_distinct(bool async) .Distinct(), assertOrder: false); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_coalesce_take_distinct(bool async) => AssertQuery( async, @@ -3641,8 +3280,7 @@ public virtual Task OrderBy_coalesce_take_distinct(bool async) .Distinct(), assertOrder: false); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_coalesce_skip_take_distinct(bool async) => AssertQuery( async, @@ -3652,8 +3290,7 @@ public virtual Task OrderBy_coalesce_skip_take_distinct(bool async) .Distinct(), assertOrder: false); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_coalesce_skip_take_distinct_take(bool async) => AssertQuery( async, @@ -3667,8 +3304,7 @@ public virtual Task OrderBy_coalesce_skip_take_distinct_take(bool async) /* non-deterministic */ }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_skip_take_distinct_orderby_take(bool async) => AssertQuery( async, @@ -3681,8 +3317,7 @@ public virtual Task OrderBy_skip_take_distinct_orderby_take(bool async) .Take(8), assertOrder: false); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task No_orderby_added_for_fully_translated_manually_constructed_LOJ(bool async) => AssertQuery( async, @@ -3694,73 +3329,64 @@ from e2 in grouping.DefaultIfEmpty() #pragma warning restore IDE0031 // Use null propagation e => (e.City1, e.City2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task No_orderby_added_for_client_side_GroupJoin_dependent_to_principal_LOJ(bool async) // Translation failed message. Issue #17328. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => - from o in ss.Set() - join c in ss.Set() on o.CustomerID equals c.CustomerID into grouping - from c in ClientDefaultIfEmpty(grouping) + => AssertTranslationFailed(() => AssertQuery( + async, + ss => + from o in ss.Set() + join c in ss.Set() on o.CustomerID equals c.CustomerID into grouping + from c in ClientDefaultIfEmpty(grouping) #pragma warning disable IDE0031 // Use null propagation - select new { Id1 = o.CustomerID, Id2 = c != null ? c.CustomerID : null }, + select new { Id1 = o.CustomerID, Id2 = c != null ? c.CustomerID : null }, #pragma warning restore IDE0031 // Use null propagation - e => (e.Id1, e.Id2))); + e => (e.Id1, e.Id2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task No_orderby_added_for_client_side_GroupJoin_dependent_to_principal_LOJ_with_additional_join_condition1(bool async) // Translation failed message. Issue #17328. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => - from o in ss.Set() - join c in ss.Set() on new { o.CustomerID, o.OrderID } equals new { c.CustomerID, OrderID = 10000 } into - grouping - from c in ClientDefaultIfEmpty(grouping) + => AssertTranslationFailed(() => AssertQuery( + async, + ss => + from o in ss.Set() + join c in ss.Set() on new { o.CustomerID, o.OrderID } equals new { c.CustomerID, OrderID = 10000 } into + grouping + from c in ClientDefaultIfEmpty(grouping) #pragma warning disable IDE0031 // Use null propagation - select new { Id1 = o.CustomerID, Id2 = c != null ? c.CustomerID : null }, + select new { Id1 = o.CustomerID, Id2 = c != null ? c.CustomerID : null }, #pragma warning restore IDE0031 // Use null propagation - e => (e.Id1, e.Id2))); + e => (e.Id1, e.Id2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task No_orderby_added_for_client_side_GroupJoin_dependent_to_principal_LOJ_with_additional_join_condition2(bool async) // Translation failed message. Issue #17328. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => - from o in ss.Set() - join c in ss.Set() on new { o.OrderID, o.CustomerID } equals new { OrderID = 10000, c.CustomerID } into - grouping - from c in ClientDefaultIfEmpty(grouping) + => AssertTranslationFailed(() => AssertQuery( + async, + ss => + from o in ss.Set() + join c in ss.Set() on new { o.OrderID, o.CustomerID } equals new { OrderID = 10000, c.CustomerID } into + grouping + from c in ClientDefaultIfEmpty(grouping) #pragma warning disable IDE0031 // Use null propagation - select new { Id1 = o.CustomerID, Id2 = c != null ? c.CustomerID : null }, + select new { Id1 = o.CustomerID, Id2 = c != null ? c.CustomerID : null }, #pragma warning restore IDE0031 // Use null propagation - e => (e.Id1, e.Id2))); + e => (e.Id1, e.Id2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Orderby_added_for_client_side_GroupJoin_principal_to_dependent_LOJ(bool async) // Translation failed message. Issue #17328. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from e1 in ss.Set() - join e2 in ss.Set() on e1.EmployeeID equals e2.ReportsTo into grouping - from e2 in ClientDefaultIfEmpty(grouping) + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from e1 in ss.Set() + join e2 in ss.Set() on e1.EmployeeID equals e2.ReportsTo into grouping + from e2 in ClientDefaultIfEmpty(grouping) #pragma warning disable IDE0031 // Use null propagation - select new { City1 = e1.City, City2 = e2 != null ? e2.City : null }, + select new { City1 = e1.City, City2 = e2 != null ? e2.City : null }, #pragma warning restore IDE0031 // Use null propagation - e => (e.City1, e.City2))); + e => (e.City1, e.City2))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Contains_with_DateTime_Date(bool async) { var dates = new[] { new DateTime(1996, 07, 04), new DateTime(1996, 07, 16) }; @@ -3776,62 +3402,53 @@ await AssertQuery( ss => ss.Set().Where(e => dates.Contains(e.OrderDate.Value.Date))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_with_subquery_involving_join_binds_to_correct_table(bool async) => AssertQuery( async, ss => - ss.Set().Where( - o => o.OrderID > 11000 - && ss.Set().Where(od => od.Product.ProductName == "Chai") - .Select(od => od.OrderID) - .Contains(o.OrderID))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + ss.Set().Where(o => o.OrderID > 11000 + && ss.Set().Where(od => od.Product.ProductName == "Chai") + .Select(od => od.OrderID) + .Contains(o.OrderID))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_member_distinct_where(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { c.CustomerID }).Distinct().Where(n => n.CustomerID == "ALFKI"), e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_member_distinct_orderby(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { c.CustomerID }).Distinct().OrderBy(n => n.CustomerID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_member_distinct_result(bool async) => AssertSingleResult( async, - syncQuery: ss => ss.Set().Select( - c => new { c.CustomerID }).Distinct().Count(n => n.CustomerID.StartsWith("A")), - asyncQuery: ss => ss.Set().Select( - c => new { c.CustomerID }).Distinct().CountAsync(n => n.CustomerID.StartsWith("A"), default)); + syncQuery: ss => ss.Set().Select(c => new { c.CustomerID }).Distinct().Count(n => n.CustomerID.StartsWith("A")), + asyncQuery: ss + => ss.Set().Select(c => new { c.CustomerID }).Distinct().CountAsync(n => n.CustomerID.StartsWith("A"), default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_complex_distinct_where(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { A = c.CustomerID + c.City }).Distinct().Where(n => n.A == "ALFKIBerlin"), e => e.A); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_complex_distinct_orderby(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { A = c.CustomerID + c.City }).Distinct().OrderBy(n => n.A), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_complex_distinct_result(bool async) => AssertSingleResult( async, @@ -3841,16 +3458,14 @@ public virtual Task Anonymous_complex_distinct_result(bool async) => ss.Set().Select(c => new { A = c.CustomerID + c.City }).Distinct() .CountAsync(n => n.A.StartsWith("A"), default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_complex_orderby(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { A = c.CustomerID + c.City }).OrderBy(n => n.A), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_subquery_orderby(bool async) => AssertQuery( async, @@ -3881,8 +3496,7 @@ public override int GetHashCode() => Property.GetHashCode(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DTO_member_distinct_where(bool async) => AssertQuery( async, @@ -3891,8 +3505,7 @@ public virtual Task DTO_member_distinct_where(bool async) elementSorter: e => e.Property, elementAsserter: (e, a) => Assert.Equal(e.Property, a.Property)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DTO_member_distinct_orderby(bool async) => AssertQuery( async, @@ -3900,18 +3513,17 @@ public virtual Task DTO_member_distinct_orderby(bool async) assertOrder: true, elementAsserter: (e, a) => Assert.Equal(e.Property, a.Property)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DTO_member_distinct_result(bool async) => AssertSingleResult( async, - syncQuery: ss => ss.Set().Select( - c => new DTO { Property = c.CustomerID }).Distinct().Count(n => n.Property.StartsWith("A")), - asyncQuery: ss => ss.Set().Select( - c => new DTO { Property = c.CustomerID }).Distinct().CountAsync(n => n.Property.StartsWith("A"), default)); + syncQuery: ss => ss.Set().Select(c => new DTO { Property = c.CustomerID }).Distinct() + .Count(n => n.Property.StartsWith("A")), + asyncQuery: ss + => ss.Set().Select(c => new DTO { Property = c.CustomerID }).Distinct() + .CountAsync(n => n.Property.StartsWith("A"), default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DTO_complex_distinct_where(bool async) => AssertQuery( async, @@ -3920,8 +3532,7 @@ public virtual Task DTO_complex_distinct_where(bool async) elementSorter: e => e.Property, elementAsserter: (e, a) => Assert.Equal(e.Property, a.Property)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DTO_complex_distinct_orderby(bool async) => AssertQuery( async, @@ -3930,19 +3541,16 @@ public virtual Task DTO_complex_distinct_orderby(bool async) assertOrder: true, elementAsserter: (e, a) => Assert.Equal(e.Property, a.Property)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DTO_complex_distinct_result(bool async) => AssertSingleResult( async, - syncQuery: ss => ss.Set().Select( - c => new DTO { Property = c.CustomerID + c.City }).Distinct().Count(n => n.Property.StartsWith("A")), - asyncQuery: ss => ss.Set().Select( - c => new DTO { Property = c.CustomerID + c.City }).Distinct() + syncQuery: ss => ss.Set().Select(c => new DTO { Property = c.CustomerID + c.City }).Distinct() + .Count(n => n.Property.StartsWith("A")), + asyncQuery: ss => ss.Set().Select(c => new DTO { Property = c.CustomerID + c.City }).Distinct() .CountAsync(n => n.Property.StartsWith("A"), default)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DTO_complex_orderby(bool async) => AssertQuery( async, @@ -3950,8 +3558,7 @@ public virtual Task DTO_complex_orderby(bool async) assertOrder: true, elementAsserter: (e, a) => Assert.Equal(e.Property, a.Property)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DTO_subquery_orderby(bool async) => AssertQuery( async, @@ -3962,8 +3569,7 @@ public virtual Task DTO_subquery_orderby(bool async) assertOrder: true, elementAsserter: (e, a) => Assert.Equal(e.Property, a.Property)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_orderby_skip_preserves_ordering(bool async) => AssertQuery( async, @@ -3976,42 +3582,37 @@ public virtual Task Include_with_orderby_skip_preserves_ordering(bool async) assertOrder: true); private static IEnumerable ClientDefaultIfEmpty(IEnumerable source) - => source?.Count() == 0 ? new[] { default(TElement) } : source; + => source?.Count() == 0 ? [default(TElement)] : source; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_repeated_query_model_compiles_correctly(bool async) => AssertQuery( async, ss => ss.Set() .Where(outer => outer.CustomerID == "ALFKI") - .Where( - outer => - (from c in ss.Set() - let customers = ss.Set().Select(cc => cc.CustomerID).ToList() - where customers.Any() - select customers).Any())); + .Where(outer => + (from c in ss.Set() + let customers = ss.Set().Select(cc => cc.CustomerID).ToList() + where customers.Any() + select customers).Any())); #pragma warning disable CS9236 // Compiling requires binding the lambda expression at least 200 times - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_query_with_repeated_nested_query_model_compiles_correctly(bool async) => AssertQuery( async, ss => ss.Set() .Where(outer => outer.CustomerID == "ALFKI") - .Where( - outer => - (from c in ss.Set() - let customers = ss.Set().Where( - cc => ss.Set().OrderBy(string (Customer inner) => inner.CustomerID).Take(10).Distinct().Any()) - .Select(cc => cc.CustomerID).ToList() - where customers.Any() - select customers).Any())); + .Where(outer => + (from c in ss.Set() + let customers = ss.Set().Where(cc + => ss.Set().OrderBy(string (inner) => inner.CustomerID).Take(10).Distinct().Any()) + .Select(cc => cc.CustomerID).ToList() + where customers.Any() + select customers).Any())); #pragma warning restore CS9236 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Int16_parameter_can_be_used_for_int_column(bool async) { const ushort parameter = 10300; @@ -4021,8 +3622,7 @@ public virtual Task Int16_parameter_can_be_used_for_int_column(bool async) ss => ss.Set().Where(o => o.OrderID == parameter)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_is_null_translated_correctly(bool async) => AssertQuery( async, @@ -4034,8 +3634,7 @@ from c in ss.Set() where lastOrder == null select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_is_not_null_translated_correctly(bool async) => AssertQuery( async, @@ -4047,162 +3646,139 @@ from c in ss.Set() where lastOrder != null select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_take_average(bool async) => AssertAverage( async, ss => ss.Set().OrderBy(o => o.OrderID).Select(o => o.OrderID).Take(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_take_count(bool async) => AssertCount( async, ss => ss.Set().Take(7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_orderBy_take_count(bool async) => AssertCount( async, ss => ss.Set().OrderBy(c => c.Country).Take(7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_take_long_count(bool async) => AssertLongCount( async, ss => ss.Set().Take(7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_orderBy_take_long_count(bool async) => AssertLongCount( async, ss => ss.Set().OrderBy(c => c.Country).Take(7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_take_max(bool async) => AssertMax( async, ss => ss.Set().OrderBy(o => o.OrderID).Select(o => o.OrderID).Take(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_take_min(bool async) => AssertMin( async, ss => ss.Set().OrderBy(o => o.OrderID).Select(o => o.OrderID).Take(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_take_sum(bool async) => AssertSum( async, ss => ss.Set().OrderBy(o => o.OrderID).Select(o => o.OrderID).Take(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_skip_average(bool async) => AssertAverage( async, ss => ss.Set().OrderBy(o => o.OrderID).Select(o => o.OrderID).Skip(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_skip_count(bool async) => AssertCount( async, ss => ss.Set().Skip(7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_orderBy_skip_count(bool async) => AssertCount( async, ss => ss.Set().OrderBy(c => c.Country).Skip(7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_skip_long_count(bool async) => AssertLongCount( async, ss => ss.Set().Skip(7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_orderBy_skip_long_count(bool async) => AssertLongCount( async, ss => ss.Set().OrderBy(c => c.Country).Skip(7)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_skip_max(bool async) => AssertMax( async, ss => ss.Set().OrderBy(o => o.OrderID).Select(o => o.OrderID).Skip(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_skip_min(bool async) => AssertMin( async, ss => ss.Set().OrderBy(o => o.OrderID).Select(o => o.OrderID).Skip(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_skip_sum(bool async) => AssertSum( async, ss => ss.Set().OrderBy(o => o.OrderID).Select(o => o.OrderID).Skip(10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_distinct_average(bool async) => AssertAverage( async, ss => ss.Set().Select(o => o.OrderID).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_distinct_count(bool async) => AssertCount( async, ss => ss.Set().Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_distinct_long_count(bool async) => AssertLongCount( async, ss => ss.Set().Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_distinct_max(bool async) => AssertMax( async, ss => ss.Set().Select(o => o.OrderID).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_distinct_min(bool async) => AssertMin( async, ss => ss.Set().Select(o => o.OrderID).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_distinct_sum(bool async) => AssertSum( async, ss => ss.Set().Select(o => o.OrderID).Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_to_fixed_string_parameter(bool async) => AssertQuery( async, @@ -4213,8 +3789,7 @@ private static IQueryable FindLike(IQueryable cs, string prefi where c.CustomerID.StartsWith(prefix) select c.CustomerID; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_entities_using_Equals(bool async) => AssertQuery( async, @@ -4225,8 +3800,7 @@ where c1.Equals(c2) orderby c1.CustomerID select new { Id1 = c1.CustomerID, Id2 = c2.CustomerID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_different_entity_types_using_Equals(bool async) => AssertQuery( async, @@ -4237,8 +3811,7 @@ where c.Equals(o) select c.CustomerID, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_entity_to_null_using_Equals(bool async) => AssertQuery( async, @@ -4248,8 +3821,7 @@ where c.CustomerID.StartsWith("A") orderby c.CustomerID select c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_navigations_using_Equals(bool async) => AssertQuery( async, @@ -4262,8 +3834,7 @@ where o1.Customer.Equals(o2.Customer) select new { Id1 = o1.OrderID, Id2 = o2.OrderID }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_navigations_using_static_Equals(bool async) => AssertQuery( async, @@ -4276,8 +3847,7 @@ where Equals(o1.Customer, o2.Customer) select new { Id1 = o1.OrderID, Id2 = o2.OrderID }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_non_matching_entities_using_Equals(bool async) => AssertQuery( async, @@ -4289,8 +3859,7 @@ where Equals(c, o) select new { Id1 = c.CustomerID, Id2 = o.OrderID }, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_non_matching_collection_navigations_using_Equals(bool async) => AssertQuery( async, @@ -4302,16 +3871,14 @@ where c.Orders.Equals(o.OrderDetails) select new { Id1 = c.CustomerID, Id2 = o.OrderID }, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_collection_navigation_to_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders == null).Select(c => c.CustomerID), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Comparing_collection_navigation_to_null_complex(bool async) => AssertQuery( async, @@ -4323,8 +3890,7 @@ public virtual Task Comparing_collection_navigation_to_null_complex(bool async) .Select(od => new { od.ProductID, od.OrderID }), e => (e.ProductID, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Compare_collection_navigation_with_itself(bool async) => AssertQuery( async, @@ -4333,8 +3899,7 @@ where c.CustomerID.StartsWith("A") where c.Orders == c.Orders select c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Compare_two_collection_navigations_with_different_query_sources(bool async) => AssertQuery( async, @@ -4346,8 +3911,7 @@ from c2 in ss.Set() select new { Id1 = c1.CustomerID, Id2 = c2.CustomerID }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Compare_two_collection_navigations_using_equals(bool async) => AssertQuery( async, @@ -4359,8 +3923,7 @@ where Equals(c1.Orders, c2.Orders) select new { Id1 = c1.CustomerID, Id2 = c2.CustomerID }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Compare_two_collection_navigations_with_different_property_chains(bool async) => AssertQuery( async, @@ -4373,8 +3936,7 @@ from o in ss.Set() select new { Id1 = c.CustomerID, Id2 = o.OrderID }, e => (e.Id1, e.Id2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_ThenBy_same_column_different_direction(bool async) => AssertQuery( async, @@ -4385,8 +3947,7 @@ public virtual Task OrderBy_ThenBy_same_column_different_direction(bool async) .Select(c => c.CustomerID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_OrderBy_same_column_different_direction(bool async) => AssertQuery( async, @@ -4397,35 +3958,29 @@ public virtual Task OrderBy_OrderBy_same_column_different_direction(bool async) .Select(c => c.CustomerID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_nested_query_doesnt_try_binding_to_grandparent_when_parent_returns_complex_result(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID == "ALFKI") - .Select( - c => new - { - c.CustomerID, - OuterOrders = c.Orders.Select( - o => new { InnerOrder = c.Orders.Count(), Id = c.CustomerID }).ToList() - }), + .Select(c => new + { + c.CustomerID, OuterOrders = c.Orders.Select(o => new { InnerOrder = c.Orders.Count(), Id = c.CustomerID }).ToList() + }), elementAsserter: (e, a) => { Assert.Equal(e.CustomerID, a.CustomerID); Assert.Equal(e.OuterOrders.Count, a.OuterOrders.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Complex_nested_query_properly_binds_to_grandparent_when_parent_returns_scalar_result(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID == "ALFKI") .Select(c => new { c.CustomerID, OuterOrders = c.Orders.Count(o => c.Orders.Count() > 0) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Dto_projection_skip_take(bool async) => AssertQuery( async, @@ -4435,8 +3990,7 @@ public virtual Task OrderBy_Dto_projection_skip_take(bool async) .Take(10), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_take_count_works(bool async) => AssertCount( async, @@ -4446,8 +4000,7 @@ on o.CustomerID equals c.CustomerID select o) .Take(5)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_empty_list_contains(bool async) { var list = new List(); @@ -4457,8 +4010,7 @@ public virtual Task OrderBy_empty_list_contains(bool async) ss => ss.Set().OrderBy(c => list.Contains(c.CustomerID)).Select(c => c)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_empty_list_does_not_contains(bool async) { var list = new List(); @@ -4468,8 +4020,7 @@ public virtual Task OrderBy_empty_list_does_not_contains(bool async) ss => ss.Set().OrderBy(c => !list.Contains(c.CustomerID)).Select(c => c)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Manual_expression_tree_typed_null_equality(bool async) { using var context = CreateContext(); @@ -4495,8 +4046,7 @@ public virtual Task Manual_expression_tree_typed_null_equality(bool async) .Select(selector)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Let_subquery_with_multiple_occurrences(bool async) => AssertQuery( async, @@ -4508,8 +4058,7 @@ select od.Quantity where details.Any() select new { Count = details.Count() }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Let_entity_equality_to_null(bool async) => AssertQuery( async, @@ -4518,8 +4067,7 @@ public virtual Task Let_entity_equality_to_null(bool async) where o != null select new { c.CustomerID, o.OrderDate }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Let_entity_equality_to_other_entity(bool async) { return AssertQuery( @@ -4536,34 +4084,30 @@ public virtual Task Let_entity_equality_to_other_entity(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_after_client_method(bool async) - => AssertTranslationFailed( - () => AssertQueryScalar( - async, - ss => ss.Set().OrderBy(c => ClientOrderBy(c)) - .SelectMany(c => c.Orders) - .Distinct() - .Select(o => o.OrderDate))); + => AssertTranslationFailed(() => AssertQueryScalar( + async, + ss => ss.Set().OrderBy(c => ClientOrderBy(c)) + .SelectMany(c => c.Orders) + .Distinct() + .Select(o => o.OrderDate))); private static string ClientOrderBy(Customer c) => c.CustomerID; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_OrderBy_GroupBy_Group_ordering_works(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from o in ss.Set() - orderby ClientEvalSelector(o) - group o by o.CustomerID - into g - orderby g.Key - select g.OrderByDescending(x => x.OrderID).ToList(), - assertOrder: true, - elementAsserter: (e, a) => AssertCollection(e, a, ordered: true))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from o in ss.Set() + orderby ClientEvalSelector(o) + group o by o.CustomerID + into g + orderby g.Key + select g.OrderByDescending(x => x.OrderID).ToList(), + assertOrder: true, + elementAsserter: (e, a) => AssertCollection(e, a, ordered: true))); protected static bool ClientEvalPredicate(Order order) => order.OrderID > 10000; @@ -4571,57 +4115,48 @@ protected static bool ClientEvalPredicate(Order order) protected internal uint ClientEvalSelector(Order order) => order.EmployeeID % 10 ?? 0; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_navigation_equal_to_null_for_subquery(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault().OrderDetails == null), ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Dependent_to_principal_navigation_equal_to_null_for_subquery(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault().Customer == null), ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).Select(o => o.CustomerID).FirstOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_navigation_equality_rewrite_for_subquery(bool async) // Dependency issues between visitors Issue #20445. - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().Where( - c => c.CustomerID.StartsWith("A") - && ss.Set().Where(o => o.OrderID < 10300).OrderBy(o => o.OrderID).FirstOrDefault().OrderDetails - == ss.Set().Where(o => o.OrderID > 10500).OrderBy(o => o.OrderID).FirstOrDefault().OrderDetails))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().Where(c => c.CustomerID.StartsWith("A") + && ss.Set().Where(o => o.OrderID < 10300).OrderBy(o => o.OrderID).FirstOrDefault().OrderDetails + == ss.Set().Where(o => o.OrderID > 10500).OrderBy(o => o.OrderID).FirstOrDefault().OrderDetails))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Inner_parameter_in_nested_lambdas_gets_preserved(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Where(o => c == new Customer { CustomerID = o.CustomerID }).Count() > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Convert_to_nullable_on_nullable_value_is_ignored(bool async) => AssertQuery( async, ss => ss.Set().Select(o => new Order { OrderDate = o.OrderDate.Value })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_inside_interpolated_string_is_expanded(bool async) => AssertQuery( async, ss => ss.Set().Select(o => $"CustomerCity:{o.Customer.City}")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_code_using_instance_method_throws(bool async) => AssertQuery( async, @@ -4630,8 +4165,7 @@ public virtual Task Client_code_using_instance_method_throws(bool async) private string InstanceMethod(Customer c) => c.City; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_code_using_instance_in_static_method(bool async) => AssertQuery( async, @@ -4640,15 +4174,13 @@ public virtual Task Client_code_using_instance_in_static_method(bool async) private static string StaticMethod(NorthwindMiscellaneousQueryTestBase containingClass, Customer c) => c.City; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_code_using_instance_in_anonymous_type(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { A = this })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_code_unknown_method(bool async) => AssertQuery( async, @@ -4658,8 +4190,7 @@ public virtual Task Client_code_unknown_method(bool async) public static string UnknownMethod(string foo) => foo; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Context_based_client_method(bool async) { using (var context = CreateContext()) @@ -4689,8 +4220,7 @@ public virtual async Task Context_based_client_method(bool async) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_object_type_server_evals(bool async) { Expression>[] orderingExpressions = @@ -4709,26 +4239,23 @@ public virtual Task OrderBy_object_type_server_evals(bool async) assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task AsQueryable_in_query_server_evals(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID) - .Select( - c => c.Orders.AsQueryable() - .Where(ValidYear) - .OrderBy(o => o.OrderID) - .Take(1) - .Select(o => new { o.OrderDate }).ToList()), + .Select(c => c.Orders.AsQueryable() + .Where(ValidYear) + .OrderBy(o => o.OrderID) + .Take(1) + .Select(o => new { o.OrderDate }).ToList()), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); private static Expression> ValidYear => a => a.OrderDate.Value.Year == 1998; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_DefaultIfEmpty_Any(bool async) => AssertAny( async, @@ -4739,8 +4266,7 @@ public virtual Task Subquery_DefaultIfEmpty_Any(bool async) select e)); // Issue#18374 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_skip_collection_projection(bool async) => AssertQuery( async, @@ -4757,8 +4283,7 @@ public virtual Task Projection_skip_collection_projection(bool async) AssertCollection(e.ProductIds, a.ProductIds, ordered: true, elementAsserter: (ie, ia) => Assert.Equal(ie, ia)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_take_collection_projection(bool async) => AssertQuery( async, @@ -4775,8 +4300,7 @@ public virtual Task Projection_take_collection_projection(bool async) AssertCollection(e.ProductIds, a.ProductIds, ordered: true, elementAsserter: (ie, ia) => Assert.Equal(ie, ia)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_skip_take_collection_projection(bool async) => AssertQuery( async, @@ -4794,8 +4318,7 @@ public virtual Task Projection_skip_take_collection_projection(bool async) AssertCollection(e.ProductIds, a.ProductIds, ordered: true, elementAsserter: (ie, ia) => Assert.Equal(ie, ia)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_skip_projection(bool async) => AssertQuery( async, @@ -4806,8 +4329,7 @@ public virtual Task Projection_skip_projection(bool async) .Skip(5) .Select(e => new { e.Item.Customer.City })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_take_projection(bool async) => AssertQuery( async, @@ -4818,8 +4340,7 @@ public virtual Task Projection_take_projection(bool async) .Take(10) .Select(e => new { e.Item.Customer.City })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_skip_take_projection(bool async) => AssertQuery( async, @@ -4832,8 +4353,7 @@ public virtual Task Projection_skip_take_projection(bool async) .Select(e => new { e.Item.Customer.City })); // Issue#19207 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_skip(bool async) => AssertQuery( async, @@ -4849,8 +4369,7 @@ public virtual Task Collection_projection_skip(bool async) AssertCollection(e.OrderDetails, a.OrderDetails); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_take(bool async) => AssertQuery( async, @@ -4866,8 +4385,7 @@ public virtual Task Collection_projection_take(bool async) AssertCollection(e.OrderDetails, a.OrderDetails); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_skip_take(bool async) => AssertQuery( async, @@ -4884,8 +4402,7 @@ public virtual Task Collection_projection_skip_take(bool async) AssertCollection(e.OrderDetails, a.OrderDetails); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_projection_skip_empty_collection_FirstOrDefault(bool async) => AssertQuery( async, @@ -4895,8 +4412,7 @@ public virtual Task Anonymous_projection_skip_empty_collection_FirstOrDefault(bo .Skip(0) .Select(e => e.Customer.Orders.FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_projection_take_empty_collection_FirstOrDefault(bool async) => AssertQuery( async, @@ -4906,8 +4422,7 @@ public virtual Task Anonymous_projection_take_empty_collection_FirstOrDefault(bo .Take(1) .Select(e => e.Customer.Orders.FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_projection_skip_take_empty_collection_FirstOrDefault(bool async) => AssertQuery( async, @@ -4918,8 +4433,7 @@ public virtual Task Anonymous_projection_skip_take_empty_collection_FirstOrDefau .Take(1) .Select(e => e.Customer.Orders.FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Checked_context_with_arithmetic_does_not_fail(bool isAsync) { checked @@ -4934,8 +4448,7 @@ public virtual Task Checked_context_with_arithmetic_does_not_fail(bool isAsync) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Checked_context_with_case_to_same_nullable_type_does_not_fail(bool isAsync) => AssertMax( isAsync, @@ -4945,8 +4458,7 @@ public virtual Task Checked_context_with_case_to_same_nullable_type_does_not_fai detail => (short?)detail.Quantity ); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_with_null_coalesce_client_side(bool async) { var a = new Customer { CustomerID = "ALFKI" }; @@ -4957,8 +4469,7 @@ public virtual Task Entity_equality_with_null_coalesce_client_side(bool async) ss => ss.Set().Where(c => c == (a ?? b))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_contains_with_list_of_null(bool async) { var customers = new List { null, new() { CustomerID = "ALFKI" } }; @@ -4968,8 +4479,7 @@ public virtual Task Entity_equality_contains_with_list_of_null(bool async) ss => ss.Set().Where(c => customers.Contains(c))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task MemberInitExpression_NewExpression_is_funcletized_even_when_bindings_are_not_evaluatable(bool async) { var randomString = "random"; @@ -4988,8 +4498,7 @@ private class Dto(string value) public Dto NestedDto { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Funcletize_conditional_with_evaluatable_test(bool async) => AssertQuery( async, @@ -4998,8 +4507,7 @@ public virtual Task Funcletize_conditional_with_evaluatable_test(bool async) private static bool AlwaysFalse() => false; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Null_parameter_name_works(bool async) { using var context = CreateContext(); @@ -5021,23 +4529,17 @@ public virtual async Task Null_parameter_name_works(bool async) Assert.Empty(result); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task String_include_on_incorrect_property_throws(bool async) - => Assert.ThrowsAsync( - async () => await AssertQuery(async, ss => ss.Set().Include("OrderDetails"))); + => Assert.ThrowsAsync(async () => await AssertQuery( + async, ss => ss.Set().Include("OrderDetails"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EF_Property_include_on_incorrect_property_throws(bool async) - => Assert.ThrowsAsync( - async () => await AssertQuery(async, ss => ss.Set().Include(c => EF.Property(c, "OrderDetails")))); - - [ConditionalTheory] - [InlineData(false, false)] - [InlineData(false, true)] - [InlineData(true, false)] - [InlineData(true, true)] + => Assert.ThrowsAsync(async () => await AssertQuery( + async, ss => ss.Set().Include(c => EF.Property(c, "OrderDetails")))); + + [ConditionalTheory, InlineData(false, false), InlineData(false, true), InlineData(true, false), InlineData(true, true)] public virtual async Task Perform_identity_resolution_reuses_same_instances(bool async, bool useAsTracking) { using var context = CreateContext(); @@ -5061,11 +4563,7 @@ public virtual async Task Perform_identity_resolution_reuses_same_instances(bool Assert.Empty(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(false, false)] - [InlineData(false, true)] - [InlineData(true, false)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(false, true), InlineData(true, false), InlineData(true, true)] public virtual async Task Perform_identity_resolution_reuses_same_instances_across_joins(bool async, bool useAsTracking) { using var context = CreateContext(); @@ -5092,37 +4590,32 @@ on c.CustomerID equals o.CustomerID Assert.Empty(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Using_string_Equals_with_StringComparison_throws_informative_error(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID.Equals("ALFKI", StringComparison.InvariantCulture))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Using_static_string_Equals_with_StringComparison_throws_informative_error(bool async) => AssertQuery( async, ss => ss.Set().Where(c => string.Equals(c.CustomerID, "ALFKI", StringComparison.InvariantCulture))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Single_non_scalar_projection_after_skip_uses_join(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.Orders.OrderBy(o => o.OrderDate).ThenBy(o => o.OrderID).Skip(2).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_distinct_Select_with_client_bindings(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.OrderID < 20000).Select(o => o.OrderDate.Value.Year).Distinct() .Select(e => new DTO { Property = ClientMethod(e) })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToList_over_string(bool async) => AssertQuery( async, @@ -5130,8 +4623,7 @@ public virtual Task ToList_over_string(bool async) assertOrder: true, elementAsserter: (e, a) => Assert.True(e.Property.SequenceEqual(a.Property))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToArray_over_string(bool async) => AssertQuery( async, @@ -5139,8 +4631,7 @@ public virtual Task ToArray_over_string(bool async) assertOrder: true, elementAsserter: (e, a) => Assert.True(e.Property.SequenceEqual(a.Property))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task AsEnumerable_over_string(bool async) => AssertQuery( async, @@ -5151,18 +4642,15 @@ public virtual Task AsEnumerable_over_string(bool async) private static int ClientMethod(int s) => s; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Non_nullable_property_through_optional_navigation(bool async) => Assert.Equal( "Nullable object must have a value.", - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Select(e => new { e.Region.Length })))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Select(e => new { e.Region.Length })))).Message); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Max_on_empty_sequence_throws(bool async) { using var context = CreateContext(); @@ -5171,8 +4659,7 @@ public virtual async Task Max_on_empty_sequence_throws(bool async) _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Pending_selector_in_cardinality_reducing_method_is_applied_before_expanding_collection_navigation_member( bool async) => AssertQuery( @@ -5180,26 +4667,23 @@ public virtual Task Pending_selector_in_cardinality_reducing_method_is_applied_b ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) .OrderBy(c => c.CustomerID) - .Select( - c => new - { - Complex = (bool?)c.Orders.OrderBy(e => e.OrderDate).FirstOrDefault().Customer.Orders - .Any(e => e.OrderID < 11000) - }), + .Select(c => new + { + Complex = (bool?)c.Orders.OrderBy(e => e.OrderDate).FirstOrDefault().Customer.Orders + .Any(e => e.OrderID < 11000) + }), ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) .OrderBy(c => c.CustomerID) - .Select( - c => new - { - Complex = c.Orders.OrderBy(e => e.OrderDate).FirstOrDefault() != null - ? c.Orders.OrderBy(e => e.OrderDate).FirstOrDefault().Customer.Orders.Any(e => e.OrderID < 11000) - : (bool?)false - }), + .Select(c => new + { + Complex = c.Orders.OrderBy(e => e.OrderDate).FirstOrDefault() != null + ? c.Orders.OrderBy(e => e.OrderDate).FirstOrDefault().Customer.Orders.Any(e => e.OrderID < 11000) + : (bool?)false + }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_followed_by_ordering_on_condition(bool async) { var searchTerm = "c"; @@ -5215,8 +4699,7 @@ public virtual Task Distinct_followed_by_ordering_on_condition(bool async) assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_Sum_over_collection_navigation(bool async) => AssertQuery( async, @@ -5224,45 +4707,40 @@ public virtual Task DefaultIfEmpty_Sum_over_collection_navigation(bool async) .Select(c => new { c.CustomerID, Sum = c.Orders.Select(o => o.OrderID).DefaultIfEmpty().Sum() }), elementSorter: c => c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_on_subquery_with_null_check(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - c.CustomerID, - Order = (c.Orders.Any() ? c.Orders.FirstOrDefault() : null) == null - ? null - : new { c.Orders.OrderBy(o => o.OrderID).FirstOrDefault().OrderDate } - }), + .Select(c => new + { + c.CustomerID, + Order = (c.Orders.Any() ? c.Orders.FirstOrDefault() : null) == null + ? null + : new { c.Orders.OrderBy(o => o.OrderID).FirstOrDefault().OrderDate } + }), elementSorter: c => c.CustomerID, elementAsserter: (e, a) => AssertEqual(e.Order, a.Order)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task DefaultIfEmpty_over_empty_collection_followed_by_projecting_constant(bool async) => AssertFirstOrDefault( async, ss => ss.Set().Where(c => false).DefaultIfEmpty().Select(c => "520")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_with_predicate_nested(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")).OrderBy(c => c.CustomerID).Select(TestDto.Projection), ss => ss.Set().Where(c => c.CustomerID.StartsWith("F")).OrderBy(c => c.CustomerID) - .Select( - x => new TestDto - { - CustomerID = x.CustomerID, - OrderDate = x.Orders - .FirstOrDefault(t => t.OrderID == t.OrderID) - .MaybeScalar(e => e.OrderDate) - }), + .Select(x => new TestDto + { + CustomerID = x.CustomerID, + OrderDate = x.Orders + .FirstOrDefault(t => t.OrderID == t.OrderID) + .MaybeScalar(e => e.OrderDate) + }), assertOrder: true, elementAsserter: (e, a) => { @@ -5284,8 +4762,7 @@ public class TestDto }; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task First_on_collection_in_projection(bool async) => AssertQuery( async, @@ -5298,16 +4775,13 @@ public virtual Task First_on_collection_in_projection(bool async) Assert.Equal(e.OrderDate, a.OrderDate); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SkipWhile_throws_meaningful_exception(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set().OrderBy(c => c.CustomerID).SkipWhile(c => c.CustomerID != "Foo").Skip(1))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set().OrderBy(c => c.CustomerID).SkipWhile(c => c.CustomerID != "Foo").Skip(1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Skip_0_Take_0_works_when_parameter(bool async) { await AssertQuery( @@ -5320,8 +4794,7 @@ await AssertQuery( ss => ss.Set().OrderBy(c => c.CustomerID).Skip(1).Take(1)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_0_Take_0_works_when_constant(bool async) => AssertQueryScalar( async, @@ -5330,8 +4803,7 @@ public virtual Task Skip_0_Take_0_works_when_constant(bool async) .Select(e => e.Orders.OrderBy(o => o.OrderID).Skip(0).Take(0).Any()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_1_Take_0_works_when_constant(bool async) => AssertQueryScalar( async, @@ -5340,8 +4812,7 @@ public virtual Task Skip_1_Take_0_works_when_constant(bool async) .Select(e => e.Orders.OrderBy(o => o.OrderID).Skip(1).Take(0).Any()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_0_works_when_constant(bool async) => AssertQueryScalar( async, @@ -5401,25 +4872,22 @@ public virtual async Task Mixed_sync_async_query() using var context = CreateContext(); // Bad test. Issue 17019. - await Assert.ThrowsAsync( - async () => - { - var results - = (await context.Customers - .Select( - c => new { c.CustomerID, Orders = context.Orders.Where(o => o.Customer.CustomerID == c.CustomerID) }) - .ToListAsync()) - .Select( - x => new - { - Orders = x.Orders - .GroupJoin( - new[] { "ALFKI" }, y => x.CustomerID, y => y, (h, id) => new { h.Customer }) - }) - .ToList(); + await Assert.ThrowsAsync(async () => + { + var results + = (await context.Customers + .Select(c => new { c.CustomerID, Orders = context.Orders.Where(o => o.Customer.CustomerID == c.CustomerID) }) + .ToListAsync()) + .Select(x => new + { + Orders = x.Orders + .GroupJoin( + ["ALFKI"], y => x.CustomerID, y => y, (h, id) => new { h.Customer }) + }) + .ToList(); - Assert.Equal(830, results.SelectMany(r => r.Orders).ToList().Count); - }); + Assert.Equal(830, results.SelectMany(r => r.Orders).ToList().Count); + }); } protected virtual async Task Single_Predicate_Cancellation_test(CancellationToken cancellationToken) @@ -5438,8 +4906,7 @@ public virtual async Task Mixed_sync_async_in_query_cache() Assert.Equal(91, (await context.Customers.AsNoTracking().ToListAsync()).Count); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Load_should_track_results(bool async) { using var context = CreateContext(); @@ -5455,20 +4922,18 @@ public virtual async Task Load_should_track_results(bool async) Assert.Equal(91, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_distinct_without_default_identifiers_projecting_columns(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - Key = c.CustomerID, - Subquery = c.Orders - .Select(o => new { First = o.OrderID, Second = o.OrderDate }) - .Distinct().ToList() - }), + .Select(c => new + { + Key = c.CustomerID, + Subquery = c.Orders + .Select(o => new { First = o.OrderID, Second = o.OrderDate }) + .Distinct().ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -5484,26 +4949,23 @@ public virtual Task Correlated_collection_with_distinct_without_default_identifi }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_with_distinct_without_default_identifiers_projecting_columns_with_navigation(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - Key = c.CustomerID, - Subquery = c.Orders - .Select( - o => new - { - First = o.OrderID, - Second = o.OrderDate, - Third = o.Customer.City - }) - .Distinct().ToList() - }), + .Select(c => new + { + Key = c.CustomerID, + Subquery = c.Orders + .Select(o => new + { + First = o.OrderID, + Second = o.OrderDate, + Third = o.Customer.City + }) + .Distinct().ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -5520,23 +4982,20 @@ public virtual Task Correlated_collection_with_distinct_without_default_identifi }); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_with_distinct(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(c => c.CustomerID) .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => c.Orders.Any() - ? c.Orders.Select(o => o.CustomerID).Distinct().ToArray() - : Array.Empty()), + .Select(c => c.Orders.Any() + ? c.Orders.Select(o => o.CustomerID).Distinct().ToArray() + : Array.Empty()), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_after_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -5546,24 +5005,21 @@ public virtual Task Collection_projection_after_DefaultIfEmpty(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.Orders, a.Orders)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_navigation_equal_to_null_for_subquery_using_ElementAtOrDefault_constant_zero(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).ElementAtOrDefault(0).OrderDetails == null), ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).ElementAtOrDefault(0) == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_navigation_equal_to_null_for_subquery_using_ElementAtOrDefault_constant_one(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).ElementAtOrDefault(1).OrderDetails == null), ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).ElementAtOrDefault(1) == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_navigation_equal_to_null_for_subquery_using_ElementAtOrDefault_parameter(bool async) { var prm = 2; @@ -5574,15 +5030,13 @@ public virtual Task Collection_navigation_equal_to_null_for_subquery_using_Eleme ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).ElementAtOrDefault(prm) == null)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Subquery_with_navigation_inside_inline_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(c => new[] { 100, c.Orders.Count }.Sum() > 101)); - [ConditionalTheory] // #32234 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #32234 public virtual async Task Parameter_collection_Contains_with_projection_and_ordering(bool async) { var ids = new[] { 10248, 10249 }; @@ -5597,8 +5051,7 @@ await AssertQuery( .Select(x => x)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_concatenated_columns_with_different_sizes(bool async) { var data = new[] { "ALFKI" + "Alfreds Futterkiste", "ANATR" + "Ana Trujillo Emparedados y helados" }; @@ -5608,8 +5061,7 @@ public virtual Task Contains_over_concatenated_columns_with_different_sizes(bool ss => ss.Set().Where(c => data.Contains(c.CustomerID + c.CompanyName))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_concatenated_column_and_constant(bool async) { var data = new[] { "ALFKI" + "SomeConstant", "ANATR" + "SomeConstant", "ALFKI" + "X" }; @@ -5619,8 +5071,7 @@ public virtual Task Contains_over_concatenated_column_and_constant(bool async) ss => ss.Set().Where(c => data.Contains(c.CustomerID + "SomeConstant"))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_concatenated_column_and_parameter(bool async) { var data = new[] { "ALFKI" + "SomeVariable", "ANATR" + "SomeVariable", "ALFKI" + "X" }; @@ -5631,8 +5082,7 @@ public virtual Task Contains_over_concatenated_column_and_parameter(bool async) ss => ss.Set().Where(c => data.Contains(c.CustomerID + someVariable))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_concatenated_parameter_and_constant(bool async) { var data = new[] { "ALFKI" + "SomeConstant", "ANATR" + "SomeConstant" }; @@ -5643,8 +5093,7 @@ public virtual Task Contains_over_concatenated_parameter_and_constant(bool async ss => ss.Set().Where(c => data.Contains(someVariable + "SomeConstant"))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_concatenated_columns_both_fixed_length(bool async) { var data = new[] { "ALFKIALFKI", "ALFKI", "ANATR" + "Ana Trujillo Emparedados y helados", "ANATR" + "ANATR" }; @@ -5654,8 +5103,7 @@ public virtual Task Contains_over_concatenated_columns_both_fixed_length(bool as ss => ss.Set().Where(o => data.Contains(o.CustomerID + o.Customer.CustomerID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Compiler_generated_local_closure_produces_valid_parameter_name(bool async) => Run_compiler_generated_local_closure_produces_valid_parameter_name( async, @@ -5678,8 +5126,7 @@ private class MyCustomerDetails public string City { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Static_member_access_gets_parameterized_within_larger_evaluatable(bool async) => AssertQuery( async, @@ -5688,8 +5135,7 @@ public virtual Task Static_member_access_gets_parameterized_within_larger_evalua private static string StaticProperty => "ALF"; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_nanosecond_and_microsecond_component(bool async) => AssertQuery( async, @@ -5697,47 +5143,41 @@ public virtual Task Where_nanosecond_and_microsecond_component(bool async) ss => ss.Set().Where(o => o.OrderDate.Value.Nanosecond != 0 && o.OrderDate.Value.Microsecond != 0), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Ternary_Not_Null_Contains(bool async) => AssertFirstOrDefault( async, ss => ss.Set().OrderBy(x => x.OrderID).Select(x => x != null ? x.OrderID + "" : null), x => x.Contains("1")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Ternary_Not_Null_endsWith_Non_Numeric_First_Part(bool async) => AssertFirstOrDefault( async, ss => ss.Set().OrderBy(x => x.OrderID).Select(x => x != null ? "" + x.OrderID + "" : null), x => x.EndsWith("1")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Ternary_Null_Equals_Non_Numeric_First_Part(bool async) - => AssertFirstOrDefault( - async, - ss => ss.Set().OrderBy(x => x.OrderID).Select(x => x == null ? null : "" + x.OrderID + ""), - x => x == "1"); + => AssertFirstOrDefault( + async, + ss => ss.Set().OrderBy(x => x.OrderID).Select(x => x == null ? null : "" + x.OrderID + ""), + x => x == "1"); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Ternary_Null_StartsWith(bool async) => AssertFirstOrDefault( async, ss => ss.Set().OrderBy(x => x.OrderID).Select(x => x == null ? null : x.OrderID + ""), x => x.StartsWith("1")); - [ConditionalTheory] // #35118 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #35118 public virtual Task Column_access_inside_subquery_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(c => ss.Set().Where(o => c.CustomerID == "ALFKI").Any())); - [ConditionalTheory] // #35152 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #35152 public virtual Task Cast_to_object_over_parameter_directly_in_lambda(bool async) { var i = 8; @@ -5747,18 +5187,16 @@ public virtual Task Cast_to_object_over_parameter_directly_in_lambda(bool async) ss => ss.Set().OrderBy(o => (object)i).Select(o => o)); } - [ConditionalTheory] // #35507 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #35507 public virtual Task Late_subquery_pushdown(bool async) => AssertQuery( async, ss => ss.Set() .Select(o => o.CustomerID) - .Where( - a => ss - .Set() - .Select(o => o.CustomerID) - .Order() - .Take(100) - .Contains(a))); + .Where(a => ss + .Set() + .Select(o => o.CustomerID) + .Order() + .Take(100) + .Contains(a))); } diff --git a/test/EFCore.Specification.Tests/Query/NorthwindNavigationsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindNavigationsQueryTestBase.cs index d23184ec337..4a7abd58df4 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindNavigationsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindNavigationsQueryTestBase.cs @@ -19,38 +19,32 @@ protected virtual void ClearLog() { } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_nav_projected_in_subquery_when_client_eval(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from c in ss.Set() - join o in ss.Set().Select(o => ClientProjection(o, o.Customer)) on c.CustomerID equals o.CustomerID - join od in ss.Set().Select(od => ClientProjection(od, od.Product)) on o.OrderID equals od.OrderID - select c)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from c in ss.Set() + join o in ss.Set().Select(o => ClientProjection(o, o.Customer)) on c.CustomerID equals o.CustomerID + join od in ss.Set().Select(od => ClientProjection(od, od.Product)) on o.OrderID equals od.OrderID + select c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_nav_in_predicate_in_subquery_when_client_eval(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from c in ss.Set() - join o in ss.Set().Where(o => ClientPredicate(o, o.Customer)) on c.CustomerID equals o.CustomerID - join od in ss.Set().Where(od => ClientPredicate(od, od.Product)) on o.OrderID equals od.OrderID - select c)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from c in ss.Set() + join o in ss.Set().Where(o => ClientPredicate(o, o.Customer)) on c.CustomerID equals o.CustomerID + join od in ss.Set().Where(od => ClientPredicate(od, od.Product)) on o.OrderID equals od.OrderID + select c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Join_with_nav_in_orderby_in_subquery_when_client_eval(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => from c in ss.Set() - join o in ss.Set().OrderBy(o => ClientOrderBy(o, o.Customer)) on c.CustomerID equals o.CustomerID - join od in ss.Set().OrderBy(od => ClientOrderBy(od, od.Product)) on o.OrderID equals od.OrderID - select c)); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => from c in ss.Set() + join o in ss.Set().OrderBy(o => ClientOrderBy(o, o.Customer)) on c.CustomerID equals o.CustomerID + join od in ss.Set().OrderBy(od => ClientOrderBy(od, od.Product)) on o.OrderID equals od.OrderID + select c)); private static readonly Random _randomGenerator = new(); @@ -63,8 +57,7 @@ private static bool ClientPredicate(T t, object _) private static int ClientOrderBy(T t, object _) => _randomGenerator.Next(0, 20); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation(bool async) => AssertQuery( async, @@ -72,8 +65,7 @@ public virtual Task Select_Where_Navigation(bool async) where o.Customer.City == "Seattle" select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Contains(bool async) => AssertQuery( async, @@ -81,8 +73,7 @@ public virtual Task Select_Where_Navigation_Contains(bool async) where o.Customer.City.Contains("Sea") select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar(bool async) => AssertQuery( async, @@ -97,8 +88,7 @@ from o2 in ss.Set().Where(o => o.OrderID < 10400) AssertEqual(e.o2, a.o2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(bool async) => AssertQuery( async, @@ -108,8 +98,7 @@ from o2 in ss.Set().Where(o => o.OrderID < 10400) select new { o1.CustomerID, C2 = o2.CustomerID }, elementSorter: e => e.CustomerID + " " + e.C2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Client(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -119,8 +108,7 @@ where o.Customer.IsLondon select o), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Deep(bool async) => AssertQuery( async, @@ -129,62 +117,54 @@ public virtual Task Select_Where_Navigation_Deep(bool async) orderby od.OrderID, od.ProductID select od).Take(1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_Select_Navigation(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(2) .Select(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_FirstOrDefault_project_single_column1(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(2) .Select(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault().CustomerID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_FirstOrDefault_project_single_column2(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(2) .Select(c => c.Orders.OrderBy(o => o.OrderID).Select(o => o.CustomerID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_FirstOrDefault_project_anonymous_type(bool async) => AssertQuery( async, - ss => ss.Set().Where(e => e.CustomerID.StartsWith("F")).OrderBy(c => c.CustomerID).Take(2).Select( - c => c.Orders.OrderBy(o => o.OrderID).Select( - o => new { o.CustomerID, o.OrderID }).FirstOrDefault()), + ss => ss.Set().Where(e => e.CustomerID.StartsWith("F")).OrderBy(c => c.CustomerID).Take(2).Select(c + => c.Orders.OrderBy(o => o.OrderID).Select(o => new { o.CustomerID, o.OrderID }).FirstOrDefault()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_FirstOrDefault_project_anonymous_type_client_eval(bool async) => AssertQuery( async, - ss => ss.Set().Where(e => e.CustomerID.StartsWith("F")).OrderBy(c => c.CustomerID).Take(2).Select( - c => c.Orders.OrderBy(o => o.OrderID).Select( - o => new { o.CustomerID, OrderID = ClientFunction(o.OrderID, 5) }).FirstOrDefault()), + ss => ss.Set().Where(e => e.CustomerID.StartsWith("F")).OrderBy(c => c.CustomerID).Take(2).Select(c + => c.Orders.OrderBy(o => o.OrderID).Select(o => new { o.CustomerID, OrderID = ClientFunction(o.OrderID, 5) }) + .FirstOrDefault()), assertOrder: true); private static int ClientFunction(int a, int b) => a + b + 1; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_FirstOrDefault_project_entity(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Take(2).Select(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Select_Navigation(bool async) => AssertQuery( async, @@ -193,8 +173,7 @@ public virtual Task Skip_Select_Navigation(bool async) .Select(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Null(bool async) => AssertQuery( async, @@ -202,8 +181,7 @@ public virtual Task Select_Where_Navigation_Null(bool async) where e.Manager == null select e); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Null_Reverse(bool async) => AssertQuery( async, @@ -211,8 +189,7 @@ public virtual Task Select_Where_Navigation_Null_Reverse(bool async) where null == e.Manager select e); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Null_Deep(bool async) => AssertQuery( async, @@ -220,8 +197,7 @@ public virtual Task Select_Where_Navigation_Null_Deep(bool async) where e.Manager.Manager == null select e); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Equals_Navigation(bool async) => AssertQuery( async, @@ -233,8 +209,7 @@ where o2.CustomerID.StartsWith("A") select new { o1, o2 }, elementSorter: e => e.o1.OrderID + " " + e.o2.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Included(bool async) => AssertQuery( async, @@ -243,8 +218,7 @@ public virtual Task Select_Where_Navigation_Included(bool async) select o, elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(o => o.Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_with_multiple_optional_navigations(bool async) { var expectedIncludes = new IExpectedInclude[] @@ -260,17 +234,14 @@ public virtual Task Include_with_multiple_optional_navigations(bool async) elementAsserter: (e, a) => AssertInclude(e, a, expectedIncludes)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_count_plus_sum(bool async) => AssertQuery( async, - ss => ss.Set().Select( - o => new { Total = o.OrderDetails.Sum(od => od.Quantity) + o.OrderDetails.Count() }), + ss => ss.Set().Select(o => new { Total = o.OrderDetails.Sum(od => od.Quantity) + o.OrderDetails.Count() }), elementSorter: e => e.Total); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Singleton_Navigation_With_Member_Access(bool async) => AssertQuery( async, @@ -280,8 +251,7 @@ public virtual Task Singleton_Navigation_With_Member_Access(bool async) select new { B = o.Customer.City }, elementSorter: e => e.B); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Singleton_Navigation_With_Member_Access(bool async) => AssertQuery( async, @@ -291,8 +261,7 @@ public virtual Task Select_Singleton_Navigation_With_Member_Access(bool async) select new { A = o.Customer, B = o.Customer.City }, elementSorter: e => e.A + " " + e.B); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Where_Navigation_Multiple_Access(bool async) => AssertQuery( async, @@ -301,16 +270,14 @@ public virtual Task Select_Where_Navigation_Multiple_Access(bool async) && o.Customer.Phone != "555 555 5555" select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Navigation(bool async) => AssertQuery( async, ss => from o in ss.Set() select o.Customer); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Navigations(bool async) => AssertQuery( async, @@ -323,8 +290,7 @@ public virtual Task Select_Navigations(bool async) AssertEqual(e.B, a.B); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Navigations_Where_Navigations(bool async) => AssertQuery( async, @@ -339,8 +305,7 @@ public virtual Task Select_Navigations_Where_Navigations(bool async) AssertEqual(e.B, a.B); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_navigation_simple(bool async) => AssertQuery( async, @@ -355,8 +320,7 @@ orderby c.CustomerID AssertCollection(e.Orders, a.Orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_navigation_simple2(bool async) => AssertQuery( async, @@ -371,8 +335,7 @@ orderby c.CustomerID Assert.Equal(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_navigation_simple_followed_by_ordering_by_scalar(bool async) => AssertQuery( async, @@ -387,8 +350,7 @@ orderby c.CustomerID }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_navigation_multi_part(bool async) => AssertQuery( async, @@ -402,8 +364,7 @@ public virtual Task Select_collection_navigation_multi_part(bool async) AssertCollection(e.Orders, a.Orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_collection_navigation_multi_part2(bool async) => AssertQuery( async, @@ -414,8 +375,7 @@ public virtual Task Select_collection_navigation_multi_part2(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.Orders, a.Orders)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_any(bool async) => AssertQuery( async, @@ -425,16 +385,14 @@ public virtual Task Collection_select_nav_prop_any(bool async) select new { Any = (c.Orders ?? new List()).Any() }, elementSorter: e => e.Any); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_predicate(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.Orders.Count > 0), ss => ss.Set().Select(c => (c.Orders ?? new List()).Count > 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_where_nav_prop_any(bool async) => AssertQuery( async, @@ -445,8 +403,7 @@ where c.Orders.Any() where (c.Orders ?? new List()).Any() select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_where_nav_prop_any_predicate(bool async) => AssertQuery( async, @@ -457,8 +414,7 @@ where c.Orders.Any(o => o.OrderID > 0) where (c.Orders ?? new List()).Any(o => o.OrderID > 0) select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_all(bool async) => AssertQuery( async, @@ -468,8 +424,7 @@ public virtual Task Collection_select_nav_prop_all(bool async) select new { All = (c.Orders ?? new List()).All(o => o.CustomerID == "ALFKI") }, elementSorter: e => e.All); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_all_client(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -483,8 +438,7 @@ orderby c.CustomerID assertOrder: true), CoreStrings.QueryUnableToTranslateMember(nameof(Order.ShipCity), nameof(Order))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_where_nav_prop_all(bool async) => AssertQuery( async, @@ -495,8 +449,7 @@ where c.Orders.All(o => o.CustomerID == "ALFKI") where (c.Orders ?? new List()).All(o => o.CustomerID == "ALFKI") select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_where_nav_prop_all_client(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -507,8 +460,7 @@ where c.Orders.All(o => o.ShipCity == "London") select c), CoreStrings.QueryUnableToTranslateMember(nameof(Order.ShipCity), nameof(Order))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_count(bool async) => AssertQuery( async, @@ -518,8 +470,7 @@ public virtual Task Collection_select_nav_prop_count(bool async) select new { (c.Orders ?? new List()).Count }, elementSorter: e => e.Count); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_where_nav_prop_count(bool async) => AssertQuery( async, @@ -530,8 +481,7 @@ where c.Orders.Count() > 5 where (c.Orders ?? new List()).Count() > 5 select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_where_nav_prop_count_reverse(bool async) => AssertQuery( async, @@ -542,8 +492,7 @@ public virtual Task Collection_where_nav_prop_count_reverse(bool async) where 5 < (c.Orders ?? new List()).Count() select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_orderby_nav_prop_count(bool async) => AssertQuery( async, @@ -555,8 +504,7 @@ orderby c.Orders.Count(), c.CustomerID select c, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_long_count(bool async) => AssertQuery( async, @@ -566,8 +514,7 @@ public virtual Task Collection_select_nav_prop_long_count(bool async) select new { C = (c.Orders ?? new List()).LongCount() }, elementSorter: e => e.C); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_multiple_complex_projections(bool async) => AssertQuery( async, @@ -585,8 +532,7 @@ where o.CustomerID.StartsWith("A") }, elementSorter: e => e.scalar2); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_sum(bool async) => AssertQuery( async, @@ -596,8 +542,7 @@ public virtual Task Collection_select_nav_prop_sum(bool async) select new { Sum = (c.Orders ?? new List()).Sum(o => o.OrderID) }, elementSorter: e => e.Sum); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_sum_plus_one(bool async) => AssertQuery( async, @@ -607,8 +552,7 @@ public virtual Task Collection_select_nav_prop_sum_plus_one(bool async) select new { Sum = (c.Orders ?? new List()).Sum(o => o.OrderID) + 1 }, elementSorter: e => e.Sum); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_where_nav_prop_sum(bool async) => AssertQuery( async, @@ -619,8 +563,7 @@ where c.Orders.Sum(o => o.OrderID) > 1000 where (c.Orders ?? new List()).Sum(o => o.OrderID) > 1000 select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_first_or_default(bool async) => AssertQuery( async, @@ -632,8 +575,7 @@ orderby c.CustomerID select new { First = (c.Orders ?? new List()).FirstOrDefault() }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_first_or_default_then_nav_prop(bool async) { var orderIds = new[] { 10643, 10692, 10702, 10835, 10952, 11011 }; @@ -657,51 +599,44 @@ orderby c.CustomerID elementAsserter: (e, a) => AssertEqual(e.Customer, a.Customer)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_first_or_default_then_nav_prop_nested(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.CustomerID.StartsWith("A")) .Select(c => ss.Set().FirstOrDefault(o => o.CustomerID == "ALFKI").Customer.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_single_or_default_then_nav_prop_nested(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.CustomerID.StartsWith("A")) .Select(c => ss.Set().SingleOrDefault(o => o.OrderID == 10643).Customer.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_first_or_default_then_nav_prop_nested_using_property_method(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.CustomerID.StartsWith("A")) - .Select( - c => EF.Property( - EF.Property( - ss.Set().FirstOrDefault(oo => oo.CustomerID == "ALFKI"), - "Customer"), - "City")), + .Select(c => EF.Property( + EF.Property( + ss.Set().FirstOrDefault(oo => oo.CustomerID == "ALFKI"), + "Customer"), + "City")), ss => ss.Set().Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => Queryable.FirstOrDefault(ss.Set(), o => o.CustomerID == "ALFKI").Customer != null - ? ss.Set().FirstOrDefault(o => o.CustomerID == "ALFKI").Customer.City - : null) + .Select(c => ss.Set().FirstOrDefault(o => o.CustomerID == "ALFKI").Customer != null + ? ss.Set().FirstOrDefault(o => o.CustomerID == "ALFKI").Customer.City + : null) ); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_select_nav_prop_first_or_default_then_nav_prop_nested_with_orderby(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.CustomerID.StartsWith("A")) .Select(c => ss.Set().OrderBy(o => o.CustomerID).FirstOrDefault(o => o.CustomerID == "ALFKI").Customer.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_fk_based_inside_contains(bool async) => AssertQuery( async, @@ -709,8 +644,7 @@ public virtual Task Navigation_fk_based_inside_contains(bool async) where new[] { "ALFKI" }.Contains(o.Customer.CustomerID) select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_inside_contains(bool async) => AssertQuery( async, @@ -718,8 +652,7 @@ public virtual Task Navigation_inside_contains(bool async) where new[] { "Novigrad", "Seattle" }.Contains(o.Customer.City) select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_inside_contains_nested(bool async) => AssertQuery( async, @@ -727,8 +660,7 @@ public virtual Task Navigation_inside_contains_nested(bool async) where new[] { "Novigrad", "Seattle" }.Contains(od.Order.Customer.City) select od); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_from_join_clause_inside_contains(bool async) => AssertQuery( async, @@ -737,37 +669,32 @@ join o in ss.Set() on od.OrderID equals o.OrderID where new[] { "USA", "Redania" }.Contains(o.Customer.Country) select od); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_subquery_on_navigation(bool async) // Complex entity equality. Issue #15260. => Assert.Equal( CoreStrings.EntityEqualityOnCompositeKeyEntitySubqueryNotSupported("Equals", nameof(OrderDetail)), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => from p in ss.Set() - where p.OrderDetails.Contains( - ss.Set().OrderByDescending(o => o.OrderID).ThenBy(o => o.ProductID) - .FirstOrDefault(orderDetail => orderDetail.Quantity == 1)) - select p))).Message); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => from p in ss.Set() + where p.OrderDetails.Contains( + ss.Set().OrderByDescending(o => o.OrderID).ThenBy(o => o.ProductID) + .FirstOrDefault(orderDetail => orderDetail.Quantity == 1)) + select p))).Message); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_subquery_on_navigation2(bool async) // Complex entity equality. Issue #15260. => Assert.Equal( CoreStrings.EntityEqualityOnCompositeKeyEntitySubqueryNotSupported("Equals", nameof(OrderDetail)), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => from p in ss.Set() - where p.OrderDetails.Contains( - ss.Set().OrderByDescending(o => o.OrderID).ThenBy(o => o.ProductID).FirstOrDefault()) - select p))).Message); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => from p in ss.Set() + where p.OrderDetails.Contains( + ss.Set().OrderByDescending(o => o.OrderID).ThenBy(o => o.ProductID).FirstOrDefault()) + select p))).Message); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_on_navigation_client_eval(bool async) => AssertQuery( async, @@ -781,8 +708,7 @@ where c.Orders.Select(o => o.OrderID).Contains( private static int ClientMethod(int argument) => argument; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_in_subquery_referencing_outer_query(bool async) => AssertQuery( async, @@ -795,8 +721,7 @@ public virtual Task Navigation_in_subquery_referencing_outer_query(bool async) where o.OrderID == 10643 || o.OrderID == 10692 select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_in_subquery_referencing_outer_query_with_client_side_result_operator_and_count(bool async) => AssertQuery( async, @@ -809,8 +734,7 @@ public virtual Task Navigation_in_subquery_referencing_outer_query_with_client_s > 0 select o); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_scalar_value_subquery_is_properly_inlined(bool async) => AssertQuery( async, @@ -820,8 +744,7 @@ public virtual Task Project_single_scalar_value_subquery_is_properly_inlined(boo select new { c.CustomerID, OrderId = c.Orders.OrderBy(o => o.OrderID).Select(o => (int?)o.OrderID).FirstOrDefault() }, elementSorter: e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_entity_value_subquery_works(bool async) => AssertQuery( async, @@ -831,8 +754,7 @@ orderby c.CustomerID select new { c.CustomerID, Order = c.Orders.OrderBy(o => o.OrderID).FirstOrDefault() }, assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_scalar_value_subquery_in_query_with_optional_navigation_works(bool async) => AssertQuery( async, @@ -847,8 +769,7 @@ orderby o.OrderID }).Take(3), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_with_complex_subquery_and_LOJ_gets_flattened(bool async) => AssertQuery( async, @@ -862,8 +783,7 @@ on c.CustomerID equals subquery.CustomerID into result from subquery in result.DefaultIfEmpty() select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupJoin_with_complex_subquery_and_LOJ_gets_flattened2(bool async) => AssertQuery( async, @@ -877,15 +797,13 @@ on c.CustomerID equals subquery.CustomerID into result from subquery in result.DefaultIfEmpty() select c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_with_collection_with_nullable_type_key(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.Customer.Orders.Count(oo => oo.OrderID > 10260) > 30)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_include_with_multiple_optional_navigations(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/NorthwindQueryFiltersQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindQueryFiltersQueryTestBase.cs index e925662ae87..f9134ce2c3f 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindQueryFiltersQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindQueryFiltersQueryTestBase.cs @@ -13,8 +13,7 @@ namespace Microsoft.EntityFrameworkCore.Query; public abstract class NorthwindQueryFiltersQueryTestBase(TFixture fixture) : FilteredQueryTestBase(fixture) where TFixture : NorthwindQueryFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_query(bool async) { return AssertFilteredCount( @@ -22,8 +21,7 @@ public virtual Task Count_query(bool async) ss => ss.Set()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Materialized_query(bool async) { return AssertFilteredQuery( @@ -31,8 +29,7 @@ public virtual Task Materialized_query(bool async) ss => ss.Set()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Find(bool async) { using var context = Fixture.CreateContext(); @@ -46,21 +43,18 @@ public virtual async Task Find(bool async) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Client_eval(bool async) { Assert.Equal( CoreStrings.TranslationFailed("DbSet() .Where(p => NorthwindContext.ClientMethod(p))"), RemoveNewLines( - (await Assert.ThrowsAsync( - () => AssertFilteredQuery( - async, - ss => ss.Set()))).Message)); + (await Assert.ThrowsAsync(() => AssertFilteredQuery( + async, + ss => ss.Set()))).Message)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Materialized_query_parameter(bool async) { using var context = Fixture.CreateContext(); @@ -76,8 +70,7 @@ public virtual async Task Materialized_query_parameter(bool async) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Materialized_query_parameter_new_context(bool async) { using var context1 = Fixture.CreateContext(); @@ -101,8 +94,7 @@ public virtual async Task Materialized_query_parameter_new_context(bool async) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_query(bool async) { return AssertFilteredQuery( @@ -110,8 +102,7 @@ public virtual Task Projection_query(bool async) ss => ss.Set().Select(c => c.CustomerID)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Projection_query_parameter(bool async) { using var context = Fixture.CreateContext(); @@ -129,8 +120,7 @@ public virtual async Task Projection_query_parameter(bool async) } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_query(bool async) { return AssertFilteredQuery( @@ -139,8 +129,7 @@ public virtual Task Include_query(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.Orders))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_query_opt_out(bool async) { return AssertQuery( @@ -149,8 +138,7 @@ public virtual Task Include_query_opt_out(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.Orders))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Included_many_to_one_query2(bool async) { return AssertFilteredQuery( @@ -158,8 +146,7 @@ public virtual Task Included_many_to_one_query2(bool async) ss => ss.Set().Include(o => o.Customer)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Included_many_to_one_query(bool async) { return AssertFilteredQuery( @@ -168,8 +155,7 @@ public virtual Task Included_many_to_one_query(bool async) elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.Customer))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_reference_that_itself_has_query_filter_with_another_reference(bool async) { return AssertFilteredQuery( @@ -177,21 +163,18 @@ public virtual Task Project_reference_that_itself_has_query_filter_with_another_ ss => ss.Set().Select(od => od.Order)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Included_one_to_many_query_with_client_eval(bool async) { Assert.Equal( CoreStrings.TranslationFailed("DbSet() .Where(p => NorthwindContext.ClientMethod(p))"), RemoveNewLines( - (await Assert.ThrowsAsync( - () => AssertFilteredQuery( - async, - ss => ss.Set().Include(p => p.OrderDetails)))).Message)); + (await Assert.ThrowsAsync(() => AssertFilteredQuery( + async, + ss => ss.Set().Include(p => p.OrderDetails)))).Message)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navs_query(bool async) { return AssertFilteredQuery( @@ -206,9 +189,8 @@ where od.Discount < 10 [ConditionalFact] public virtual void Compiled_query() { - var query = EF.CompileQuery( - (NorthwindContext context, string customerID) - => context.Customers.Where(c => c.CustomerID == customerID)); + var query = EF.CompileQuery((NorthwindContext context, string customerID) + => context.Customers.Where(c => c.CustomerID == customerID)); using var context1 = Fixture.CreateContext(); Assert.Equal("BERGS", query(context1, "BERGS").First().CustomerID); @@ -217,8 +199,7 @@ public virtual void Compiled_query() Assert.Equal("BLAUS", query(context2, "BLAUS").First().CustomerID); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_Equality(bool async) { return AssertFilteredQuery( diff --git a/test/EFCore.Specification.Tests/Query/NorthwindQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindQueryFixtureBase.cs index a254eee36d3..cccf1f201e8 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindQueryFixtureBase.cs @@ -280,11 +280,10 @@ protected override Task SeedAsync(NorthwindContext context) => NorthwindData.SeedAsync(context); public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - c => c - .Log(CoreEventId.RowLimitingOperationWithoutOrderByWarning) - .Log(CoreEventId.FirstWithoutOrderByAndFilterWarning) - .Log(CoreEventId.DistinctAfterOrderByWithoutRowLimitingOperatorWarning) - .Log(CoreEventId.PossibleUnintendedCollectionNavigationNullComparisonWarning) - .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning)); + => base.AddOptions(builder).ConfigureWarnings(c => c + .Log(CoreEventId.RowLimitingOperationWithoutOrderByWarning) + .Log(CoreEventId.FirstWithoutOrderByAndFilterWarning) + .Log(CoreEventId.DistinctAfterOrderByWithoutRowLimitingOperatorWarning) + .Log(CoreEventId.PossibleUnintendedCollectionNavigationNullComparisonWarning) + .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning)); } diff --git a/test/EFCore.Specification.Tests/Query/NorthwindSelectQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindSelectQueryTestBase.cs index a6819afa2dc..419ea6fbeda 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindSelectQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindSelectQueryTestBase.cs @@ -20,8 +20,7 @@ protected virtual void ClearLog() { } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_into(bool async) => AssertQuery( async, @@ -31,34 +30,30 @@ into id where id == "ALFKI" select id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_when_arithmetic_expression_precedence(bool async) => AssertQuery( async, ss => ss.Set().Select(o => new { A = o.OrderID / (o.OrderID / 2), B = o.OrderID / o.OrderID / 2 }), e => (e.A, e.B)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_when_arithmetic_expressions(bool async) => AssertQuery( async, - ss => ss.Set().Select( - o => new - { - o.OrderID, - Double = o.OrderID * 2, - Add = o.OrderID + 23, - Sub = 100000 - o.OrderID, - Divide = o.OrderID / (o.OrderID / 2), - Literal = 42, - o - }), + ss => ss.Set().Select(o => new + { + o.OrderID, + Double = o.OrderID * 2, + Add = o.OrderID + 23, + Sub = 100000 - o.OrderID, + Divide = o.OrderID / (o.OrderID / 2), + Literal = 42, + o + }), elementSorter: e => e.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_when_arithmetic_mixed(bool async) => AssertQuery( async, @@ -76,16 +71,13 @@ from e in ss.Set().OrderBy(e => e.EmployeeID).Take(5) }, elementSorter: e => e.OrderID + " " + e.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_when_arithmetic_mixed_subqueries(bool async) => AssertQuery( async, ss => - from o in ss.Set().OrderBy(o => o.OrderID).Take(3).Select( - o2 => new { o2, Mod = o2.OrderID % 2 }) - from e in ss.Set().OrderBy(e => e.EmployeeID).Take(2).Select( - e2 => new { e2, Square = e2.EmployeeID ^ 2 }) + from o in ss.Set().OrderBy(o => o.OrderID).Take(3).Select(o2 => new { o2, Mod = o2.OrderID % 2 }) + from e in ss.Set().OrderBy(e => e.EmployeeID).Take(2).Select(e2 => new { e2, Square = e2.EmployeeID ^ 2 }) select new { Add = e.e2.EmployeeID + o.o2.OrderID, @@ -97,22 +89,19 @@ from e in ss.Set().OrderBy(e => e.EmployeeID).Take(2).Select( }, elementSorter: e => (e.e2.EmployeeID, e.o2.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_when_null_value(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.Region)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_when_client_evald_subquery(bool async) => AssertQuery( async, ss => ss.Set().Select(c => string.Join(", ", c.Orders.Select(o => o.CustomerID).ToList()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_to_object_array(bool async) => AssertQuery( async, @@ -120,8 +109,7 @@ public virtual Task Project_to_object_array(bool async) .Select(e => new object[] { e.EmployeeID, e.ReportsTo, EF.Property(e, "Title") }), elementAsserter: (e, a) => AssertArrays(e, a, 3)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_of_entity_type_into_object_array(bool async) => AssertQuery( async, @@ -129,8 +117,7 @@ public virtual Task Projection_of_entity_type_into_object_array(bool async) .Select(c => new object[] { c }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_of_multiple_entity_types_into_object_array(bool async) => AssertQuery( async, @@ -138,16 +125,14 @@ public virtual Task Projection_of_multiple_entity_types_into_object_array(bool a .Select(o => new object[] { o, o.Customer }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_of_entity_type_into_object_list(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.CustomerID).Select(c => new List { c }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_to_int_array(bool async) => AssertQuery( async, @@ -167,8 +152,7 @@ private static void AssertArrays(T[] expectedArray, T[] actualArray, int coun } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Select_bool_closure(bool async) { var boolean = false; @@ -186,8 +170,7 @@ await AssertQuery( e => e.f); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_bool_closure_with_order_by_property_with_cast_to_nullable(bool async) { var boolean = false; @@ -198,8 +181,7 @@ public virtual Task Select_bool_closure_with_order_by_property_with_cast_to_null assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Select_bool_closure_with_order_parameter_with_cast_to_nullable(bool async) { var boolean = false; @@ -209,129 +191,112 @@ await AssertQueryScalar( assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_scalar(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_one(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { c.City }), e => e.City); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_two(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { c.City, c.Phone }), e => e.Phone); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_three(bool async) => AssertQuery( async, - ss => ss.Set().Select( - c => new - { - c.City, - c.Phone, - c.Country - }), + ss => ss.Set().Select(c => new + { + c.City, + c.Phone, + c.Country + }), e => e.Phone); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_bool_constant_true(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { c.CustomerID, ConstantTrue = true }), e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_constant_in_expression(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { c.CustomerID, Expression = c.CustomerID.Length + 5 }), e => e.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_conditional_expression(bool async) => AssertQuery( async, ss => ss.Set().Select(p => new { p.ProductID, IsAvailable = p.UnitsInStock > 0 }), e => e.ProductID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_customer_table(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_customer_identity(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_with_object(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { c.City, c }), e => e.c.CustomerID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_nested(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { c.City, Country = new { c.Country } }), e => e.City); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_empty(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { }), e => 1); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_anonymous_literal(bool async) => AssertQuery( async, ss => ss.Set().Select(c => new { X = 10 }), e => e.X); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_constant_int(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_constant_null_string(bool async) => AssertQuery( async, ss => ss.Set().Select(c => (string)null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_local(bool async) { var x = 10; @@ -340,22 +305,19 @@ public virtual Task Select_local(bool async) ss => ss.Set().Select(c => x)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_scalar_primitive(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => e.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_scalar_primitive_after_take(bool async) => AssertQueryScalar( async, ss => ss.Set().Take(9).Select(e => e.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_project_filter(bool async) => AssertQuery( async, @@ -363,8 +325,7 @@ public virtual Task Select_project_filter(bool async) where c.City == "London" select c.CompanyName); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_project_filter2(bool async) => AssertQuery( async, @@ -372,8 +333,7 @@ public virtual Task Select_project_filter2(bool async) where c.City == "London" select c.City); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection(bool async) => AssertQuery( async, @@ -382,149 +342,132 @@ from c in ss.Set() where c.City == "London" orderby c.CustomerID select ss.Set() - .Where( - o => o.CustomerID == c.CustomerID - && o.OrderDate.Value.Year == 1997) + .Where(o => o.CustomerID == c.CustomerID + && o.OrderDate.Value.Year == 1997) .Select(o => o.OrderID) .OrderBy(o => o) .ToList(), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_multi_level(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(c => c.CustomerID) .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => new - { - OrderDates = c.Orders - .Where(o => o.OrderID < 10500) - .OrderBy(o => o.OrderID) - .Take(3) - .Select(o => new { Date = o.OrderDate }) - }), + .Select(c => new + { + OrderDates = c.Orders + .Where(o => o.OrderID < 10500) + .OrderBy(o => o.OrderID) + .Take(3) + .Select(o => new { Date = o.OrderDate }) + }), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.OrderDates, a.OrderDates, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_multi_level2(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(c => c.CustomerID) .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => new - { - OrderDates = c.Orders - .OrderBy(o => o.OrderID) - .Where(o => o.OrderID < 10500) - .Select(o => o.OrderDate) - .FirstOrDefault() - }), + .Select(c => new + { + OrderDates = c.Orders + .OrderBy(o => o.OrderID) + .Where(o => o.OrderID < 10500) + .Select(o => o.OrderDate) + .FirstOrDefault() + }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_multi_level3(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(c => c.CustomerID) .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => new - { - OrderDates = ss.Set() - .OrderBy(o => o.OrderID) - .Where(o => o.OrderID < 10500) - .Where(o => c.CustomerID == o.CustomerID) - .Select(o => o.OrderDate) - .FirstOrDefault() - }), + .Select(c => new + { + OrderDates = ss.Set() + .OrderBy(o => o.OrderID) + .Where(o => o.OrderID < 10500) + .Where(o => c.CustomerID == o.CustomerID) + .Select(o => o.OrderDate) + .FirstOrDefault() + }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_multi_level4(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(c => c.CustomerID) .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => new - { - Order = (int?)c.Orders - .OrderBy(o => o.OrderID) - .Where(o => o.OrderID < 10500) - .Select( - o => o.OrderDetails - .Where(od => od.OrderID > 10) - .Select(od => od.ProductID) - .Count()) - .FirstOrDefault() - }), + .Select(c => new + { + Order = (int?)c.Orders + .OrderBy(o => o.OrderID) + .Where(o => o.OrderID < 10500) + .Select(o => o.OrderDetails + .Where(od => od.OrderID > 10) + .Select(od => od.ProductID) + .Count()) + .FirstOrDefault() + }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_multi_level5(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(c => c.CustomerID) .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => new - { - Order = (int?)c.Orders - .OrderBy(o => o.OrderID) - .Where(o => o.OrderID < 10500) - .Select( - o => o.OrderDetails - .OrderBy(od => od.OrderID) - .ThenBy(od => od.ProductID) - .Where(od => od.OrderID != c.Orders.Count) - .Select(od => od.ProductID) - .FirstOrDefault()) - .FirstOrDefault() - }), + .Select(c => new + { + Order = (int?)c.Orders + .OrderBy(o => o.OrderID) + .Where(o => o.OrderID < 10500) + .Select(o => o.OrderDetails + .OrderBy(od => od.OrderID) + .ThenBy(od => od.ProductID) + .Where(od => od.OrderID != c.Orders.Count) + .Select(od => od.ProductID) + .FirstOrDefault()) + .FirstOrDefault() + }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_multi_level6(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(c => c.CustomerID) .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => new - { - Order = (int?)c.Orders - .OrderBy(o => o.OrderID) - .Where(o => o.OrderID < 10500) - .Select( - o => o.OrderDetails - .OrderBy(od => od.OrderID) - .ThenBy(od => od.ProductID) - .Where(od => od.OrderID != c.CustomerID.Length) - .Select(od => od.ProductID) - .FirstOrDefault()) - .FirstOrDefault() - }), + .Select(c => new + { + Order = (int?)c.Orders + .OrderBy(o => o.OrderID) + .Where(o => o.OrderID < 10500) + .Select(o => o.OrderDetails + .OrderBy(od => od.OrderID) + .ThenBy(od => od.ProductID) + .Where(od => od.OrderID != c.CustomerID.Length) + .Select(od => od.ProductID) + .FirstOrDefault()) + .FirstOrDefault() + }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_count_using_anonymous_type(bool async) => AssertQuery( async, @@ -532,8 +475,7 @@ public virtual Task Select_nested_collection_count_using_anonymous_type(bool asy .Select(c => new { c.Orders.Count }), e => e.Count); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_deep(bool async) => AssertQuery( async, @@ -556,8 +498,7 @@ orderby o2.OrderID ordered: true, elementAsserter: (ee, aa) => AssertCollection(ee, aa))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection_deep_distinct_no_identifiers(bool async) => AssertQuery( async, @@ -565,18 +506,16 @@ public virtual Task Select_nested_collection_deep_distinct_no_identifiers(bool a (from c in ss.Set() where c.City == "London" orderby c.CustomerID - select new { c.City }).Distinct().Select( - x => - ((from o1 in ss.Set() - where o1.CustomerID == x.City - && o1.OrderDate.Value.Year == 1997 - orderby o1.OrderID - select o1).Distinct().Select( - xx => - (from o2 in ss.Set() - where xx.CustomerID == x.City - orderby o2.OrderID - select xx.OrderID).ToList()).ToList())), + select new { c.City }).Distinct().Select(x => + ((from o1 in ss.Set() + where o1.CustomerID == x.City + && o1.OrderDate.Value.Year == 1997 + orderby o1.OrderID + select o1).Distinct().Select(xx => + (from o2 in ss.Set() + where xx.CustomerID == x.City + orderby o2.OrderID + select xx.OrderID).ToList()).ToList())), elementSorter: e => e.Count, elementAsserter: (e, a) => AssertCollection( e, @@ -584,8 +523,7 @@ orderby o2.OrderID ordered: true, elementAsserter: (ee, aa) => AssertCollection(ee, aa))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task New_date_time_in_anonymous_type_works(bool async) => AssertQuery( async, @@ -594,8 +532,7 @@ where c.CustomerID.StartsWith("A") select new { A = new DateTime() }, e => e.A); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_int_to_long_introduces_explicit_cast(bool async) => AssertQueryScalar( async, @@ -605,8 +542,7 @@ public virtual Task Select_non_matching_value_types_int_to_long_introduces_expli .Select(o => (long)o.OrderID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_nullable_int_to_long_introduces_explicit_cast(bool async) => AssertQueryScalar( async, @@ -616,8 +552,7 @@ public virtual Task Select_non_matching_value_types_nullable_int_to_long_introdu .Select(o => (long)o.EmployeeID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_nullable_int_to_int_doesnt_introduce_explicit_cast(bool async) => AssertQueryScalar( async, @@ -627,8 +562,7 @@ public virtual Task Select_non_matching_value_types_nullable_int_to_int_doesnt_i .Select(o => (uint)o.EmployeeID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_int_to_nullable_int_doesnt_introduce_explicit_cast(bool async) => AssertQueryScalar( async, @@ -638,8 +572,7 @@ public virtual Task Select_non_matching_value_types_int_to_nullable_int_doesnt_i .Select(o => (int?)o.OrderID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_from_binary_expression_introduces_explicit_cast(bool async) => AssertQueryScalar( async, @@ -649,8 +582,7 @@ public virtual Task Select_non_matching_value_types_from_binary_expression_intro .Select(o => (long)(o.OrderID + o.OrderID)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_from_binary_expression_nested_introduces_top_level_explicit_cast(bool async) => AssertQueryScalar( async, @@ -660,8 +592,7 @@ public virtual Task Select_non_matching_value_types_from_binary_expression_neste .Select(o => (short)(o.OrderID + (long)o.OrderID)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_from_unary_expression_introduces_explicit_cast1(bool async) => AssertQueryScalar( async, @@ -671,8 +602,7 @@ public virtual Task Select_non_matching_value_types_from_unary_expression_introd .Select(o => (long)-o.OrderID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_from_unary_expression_introduces_explicit_cast2(bool async) => AssertQueryScalar( async, @@ -682,8 +612,7 @@ public virtual Task Select_non_matching_value_types_from_unary_expression_introd .Select(o => -((long)o.OrderID)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_from_length_introduces_explicit_cast(bool async) => AssertQueryScalar( async, @@ -693,8 +622,7 @@ public virtual Task Select_non_matching_value_types_from_length_introduces_expli .Select(o => (long)o.CustomerID.Length), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_from_method_call_introduces_explicit_cast(bool async) => AssertQueryScalar( async, @@ -704,25 +632,22 @@ public virtual Task Select_non_matching_value_types_from_method_call_introduces_ .Select(o => (long)Math.Abs(o.OrderID)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_non_matching_value_types_from_anonymous_type_introduces_explicit_cast(bool async) => AssertQuery( async, ss => ss.Set() .Where(o => o.CustomerID == "ALFKI") .OrderBy(o => o.OrderID) - .Select( - o => new - { - LongOrder = (long)o.OrderID, - ShortOrder = (short)o.OrderID, - Order = o.OrderID - }), + .Select(o => new + { + LongOrder = (long)o.OrderID, + ShortOrder = (short)o.OrderID, + Order = o.OrderID + }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_conditional_with_null_comparison_in_test(bool async) => AssertQueryScalar( async, @@ -730,8 +655,7 @@ public virtual Task Select_conditional_with_null_comparison_in_test(bool async) where o.CustomerID == "ALFKI" select o.CustomerID == null ? true : o.OrderID < 100); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_over_10_nested_ternary_condition(bool isAsync) => AssertQuery( isAsync, @@ -761,8 +685,7 @@ public virtual Task Select_over_10_nested_ternary_condition(bool isAsync) ? "11" : null); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_conditional_drops_false(bool async) => AssertQueryScalar( async, @@ -773,8 +696,7 @@ public virtual Task Select_conditional_drops_false(bool async) ? 0 : -o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_conditional_terminates_at_true(bool async) => AssertQueryScalar( async, @@ -785,8 +707,7 @@ public virtual Task Select_conditional_terminates_at_true(bool async) ? 0 : -o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_conditional_flatten_nested_results(bool async) => AssertQueryScalar( async, @@ -797,8 +718,7 @@ public virtual Task Select_conditional_flatten_nested_results(bool async) : o.OrderID : o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_conditional_flatten_nested_tests(bool async) => AssertQueryScalar( async, @@ -807,8 +727,7 @@ public virtual Task Select_conditional_flatten_nested_tests(bool async) ? o.OrderID : -o.OrderID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_in_a_subquery_should_be_liftable(bool async) => AssertQuery( async, @@ -816,8 +735,7 @@ public virtual Task Projection_in_a_subquery_should_be_liftable(bool async) .Select(e => string.Format("{0}", e.EmployeeID)) .Skip(1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_changes_asc_order_to_desc(bool async) => AssertQuery( async, @@ -826,8 +744,7 @@ public virtual Task Reverse_changes_asc_order_to_desc(bool async) .Select(e => $"{e.EmployeeID}"), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_changes_desc_order_to_asc(bool async) => AssertQuery( async, @@ -836,15 +753,13 @@ public virtual Task Reverse_changes_desc_order_to_asc(bool async) .Reverse(), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_without_explicit_ordering(bool async) => AssertQueryScalar( async, ss => ss.Set().Reverse().Select(e => e.EmployeeID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_after_multiple_orderbys(bool async) => AssertQueryScalar( async, @@ -855,8 +770,7 @@ public virtual Task Reverse_after_multiple_orderbys(bool async) .Select(e => e.EmployeeID), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_after_orderby_thenby(bool async) => AssertQueryScalar( async, @@ -867,8 +781,7 @@ public virtual Task Reverse_after_orderby_thenby(bool async) .Reverse(), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_in_subquery_via_pushdown(bool async) => AssertQuery( async, @@ -880,8 +793,7 @@ public virtual Task Reverse_in_subquery_via_pushdown(bool async) .Select(e => new { e.EmployeeID, e.City }), elementSorter: e => e.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_after_orderBy_and_take(bool async) => AssertQuery( async, @@ -892,8 +804,7 @@ public virtual Task Reverse_after_orderBy_and_take(bool async) .Select(e => new { e.EmployeeID, e.City }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_in_join_outer(bool async) => AssertQuery( async, @@ -908,8 +819,7 @@ public virtual Task Reverse_in_join_outer(bool async) (o, i) => new { o.CustomerID, i.OrderID }), elementSorter: e => (e.CustomerID, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_in_join_outer_with_take(bool async) => AssertQuery( async, @@ -924,8 +834,7 @@ public virtual Task Reverse_in_join_outer_with_take(bool async) (o, i) => new { o.CustomerID, i.OrderID }), elementSorter: e => (e.CustomerID, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_in_join_inner(bool async) => AssertQuery( async, @@ -936,8 +845,7 @@ from o in grouping.DefaultIfEmpty() select new { c.CustomerID, OrderID = (int?)o.OrderID }, elementSorter: e => (e.CustomerID, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_in_join_inner_with_skip(bool async) => AssertQuery( async, @@ -948,8 +856,7 @@ from o in grouping.DefaultIfEmpty() select new { c.CustomerID, OrderID = (int?)o.OrderID }, elementSorter: e => (e.CustomerID, e.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_in_SelectMany(bool async) => AssertQuery( async, @@ -958,8 +865,7 @@ public virtual Task Reverse_in_SelectMany(bool async) .Reverse() .SelectMany(c => c.Orders.OrderByDescending(o => o.OrderID).Reverse())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_in_SelectMany_with_Take(bool async) => AssertQuery( async, @@ -969,8 +875,7 @@ public virtual Task Reverse_in_SelectMany_with_Take(bool async) .Take(20) .SelectMany(c => c.Orders.OrderByDescending(o => o.OrderID).Take(30).Reverse())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_in_projection_subquery(bool async) => AssertQuery( async, @@ -980,8 +885,7 @@ public virtual Task Reverse_in_projection_subquery(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_in_projection_subquery_single_result(bool async) => AssertQuery( async, @@ -990,58 +894,49 @@ public virtual Task Reverse_in_projection_subquery_single_result(bool async) .Select(c => ss.Set().OrderBy(o => o.OrderDate).ThenByDescending(o => o.OrderID).Reverse().FirstOrDefault()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse_in_projection_scalar_subquery(bool async) => AssertQueryScalar( async, ss => ss.Set() .OrderBy(c => c.CustomerID) - .Select( - c => ss.Set().OrderBy(o => o.OrderDate).ThenByDescending(o => o.OrderID).Reverse().Select(o => o.OrderID) - .FirstOrDefault()), + .Select(c => ss.Set().OrderBy(o => o.OrderDate).ThenByDescending(o => o.OrderID).Reverse().Select(o => o.OrderID) + .FirstOrDefault()), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_containing_DateTime_subtraction(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(o => o.OrderID < 10300) .Select(o => o.OrderDate.Value - new DateTime(1997, 1, 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_OrderBy_Take_and_FirstOrDefault(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.Orders.OrderBy(o => o.OrderID).Select(o => o.CustomerID).Take(1).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_OrderBy_Take_OrderBy_and_FirstOrDefault(bool async) => AssertQuery( async, - ss => ss.Set().Select( - c => c.Orders.OrderBy(o => o.OrderID).Take(1).OrderBy(o => o.OrderDate).FirstOrDefault())); + ss => ss.Set().Select(c => c.Orders.OrderBy(o => o.OrderID).Take(1).OrderBy(o => o.OrderDate).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_OrderBy_Skip_and_FirstOrDefault(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.Orders.OrderBy(o => o.OrderID).Select(o => o.CustomerID).Skip(1).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_OrderBy_Distinct_and_FirstOrDefault(bool async) => AssertQuery( async, ss => ss.Set() .Select(c => c.Orders.OrderBy(o => o.OrderID).Select(o => o.CustomerID).Distinct().FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_OrderBy_Distinct_and_FirstOrDefault_followed_by_projecting_length( bool async) => AssertQueryScalar( @@ -1053,16 +948,14 @@ public virtual Task Project_single_element_from_collection_with_OrderBy_Distinct .Select(c => c.Orders.OrderBy(o => o.OrderID).Select(o => o.CustomerID).Distinct().FirstOrDefault()) .Select(e => e.MaybeScalar(e => e.Length))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_OrderBy_Take_and_SingleOrDefault(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID == "ALFKI") .Select(c => c.Orders.OrderBy(o => o.OrderID).Select(o => o.CustomerID).Take(1).SingleOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_OrderBy_Take_and_FirstOrDefault_with_parameter(bool async) { var i = 1; @@ -1071,166 +964,142 @@ public virtual Task Project_single_element_from_collection_with_OrderBy_Take_and ss => ss.Set().Select(c => c.Orders.OrderBy(o => o.OrderID).Select(o => o.CustomerID).Take(i).FirstOrDefault())); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_multiple_OrderBys_Take_and_FirstOrDefault(bool async) => AssertQuery( async, - ss => ss.Set().Select( - c => c.Orders.OrderBy(o => o.OrderID) - .ThenByDescending(o => o.OrderDate) - .Select(o => o.CustomerID) - .Take(2) - .FirstOrDefault())); + ss => ss.Set().Select(c => c.Orders.OrderBy(o => o.OrderID) + .ThenByDescending(o => o.OrderDate) + .Select(o => o.CustomerID) + .Take(2) + .FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_multiple_OrderBys_Take_and_FirstOrDefault_followed_by_projection_of_length_property( bool async) => AssertQueryScalar( async, - ss => ss.Set().Select( - c => (int?)c.Orders.OrderBy(o => o.OrderID) - .ThenByDescending(o => o.OrderDate) - .Select(o => o.CustomerID) - .Take(2) - .FirstOrDefault().Length), - ss => ss.Set().Select( - c => c.Orders.OrderBy(o => o.OrderID) - .ThenByDescending(o => o.OrderDate) - .Select(o => o.CustomerID) - .Take(2) - .FirstOrDefault().MaybeScalar(x => x.Length))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + ss => ss.Set().Select(c => (int?)c.Orders.OrderBy(o => o.OrderID) + .ThenByDescending(o => o.OrderDate) + .Select(o => o.CustomerID) + .Take(2) + .FirstOrDefault().Length), + ss => ss.Set().Select(c => c.Orders.OrderBy(o => o.OrderID) + .ThenByDescending(o => o.OrderDate) + .Select(o => o.CustomerID) + .Take(2) + .FirstOrDefault().MaybeScalar(x => x.Length))); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_multiple_OrderBys_Take_and_FirstOrDefault_2(bool async) => AssertQuery( async, - ss => ss.Set().Select( - c => c.Orders.OrderBy(o => o.CustomerID) - .ThenByDescending(o => o.OrderDate) - .Select(o => o.CustomerID) - .Take(2) - .FirstOrDefault())); + ss => ss.Set().Select(c => c.Orders.OrderBy(o => o.CustomerID) + .ThenByDescending(o => o.OrderDate) + .Select(o => o.CustomerID) + .Take(2) + .FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_OrderBy_over_navigation_Take_and_FirstOrDefault(bool async) => AssertQueryScalar( async, ss => ss.Set().Where(o => o.OrderID < 10300) .Select(o => o.OrderDetails.OrderBy(od => od.Product.ProductName).Select(od => od.OrderID).Take(1).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_single_element_from_collection_with_OrderBy_over_navigation_Take_and_FirstOrDefault_2(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.OrderID < 10250) .Select(o => o.OrderDetails.OrderBy(od => od.Product.ProductName).Take(1).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_year_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.Value.Year)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_month_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.Value.Month)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_day_of_year_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.Value.DayOfYear)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_day_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.Value.Day)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_hour_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.Value.Hour)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_minute_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.Value.Minute)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_second_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.Value.Second)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_millisecond_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.Value.Millisecond)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_DayOfWeek_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => (int)o.OrderDate.Value.DayOfWeek)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_Ticks_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.Value.Ticks)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_datetime_TimeOfDay_component(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.Value.TimeOfDay)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_byte_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.CustomerID == "ALFKI" ? (byte)1 : (byte)2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_short_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.CustomerID == "ALFKI" ? (short)1 : (short)2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_bool_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.CustomerID == "ALFKI" ? true : false)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_projection_AsNoTracking_Selector(bool async) => AssertQueryScalar( async, @@ -1238,8 +1107,7 @@ public virtual Task Anonymous_projection_AsNoTracking_Selector(bool async) .AsNoTracking() // Just to cause a subquery .Select(e => e.B)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_projection_with_repeated_property_being_ordered(bool async) => AssertQuery( async, @@ -1247,8 +1115,7 @@ public virtual Task Anonymous_projection_with_repeated_property_being_ordered(bo orderby c.CustomerID select new { A = c.CustomerID, B = c.CustomerID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Anonymous_projection_with_repeated_property_being_ordered_2(bool async) => AssertQuery( async, @@ -1256,15 +1123,13 @@ public virtual Task Anonymous_projection_with_repeated_property_being_ordered_2( orderby o.CustomerID select new { A = o.Customer.CustomerID, B = o.CustomerID }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_GetValueOrDefault_on_DateTime(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDate.GetValueOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_GetValueOrDefault_on_DateTime_with_null_values(bool async) => AssertQueryScalar( async, @@ -1277,22 +1142,19 @@ join o in ss.Set() on c.CustomerID equals o.CustomerID into grouping from o in grouping.DefaultIfEmpty() select o != null ? o.OrderDate.Value : new DateTime(1753, 1, 1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Cast_on_top_level_projection_brings_explicit_Cast(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => (double?)o.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_in_projection_requiring_materialization_1(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID.StartsWith("A")).Select(c => c.ToString())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_in_projection_requiring_materialization_2(bool async) => AssertQuery( async, @@ -1301,19 +1163,17 @@ public virtual Task Client_method_in_projection_requiring_materialization_2(bool private static string ClientMethod(Customer c) => c.CustomerID; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_nullable_struct(bool async) => AssertQuery( async, - ss => ss.Set().Select( - o => new - { - One = o.CustomerID, - Two = o.CustomerID == "ALFKI" - ? new MyStruct { X = o.OrderID, Y = o.CustomerID.Length } - : (MyStruct?)null - }), + ss => ss.Set().Select(o => new + { + One = o.CustomerID, + Two = o.CustomerID == "ALFKI" + ? new MyStruct { X = o.OrderID, Y = o.CustomerID.Length } + : (MyStruct?)null + }), elementSorter: e => (e.One, e.Two?.X)); public struct MyStruct @@ -1321,8 +1181,7 @@ public struct MyStruct public int X, Y; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_select_many_with_predicate(bool async) => AssertQuery( async, @@ -1332,22 +1191,19 @@ from od in o.OrderDetails where od.Discount >= 0.25 select c); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_without_result_selector_naked_collection_navigation(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(c => c.Orders)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_without_result_selector_collection_navigation_composed(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(c => c.Orders.Select(o => o.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_with_outer_1(bool async) => AssertQuery( async, @@ -1355,8 +1211,7 @@ public virtual Task SelectMany_correlated_with_outer_1(bool async) from o in ss.Set().Where(o => c.CustomerID == o.CustomerID).Select(o => c.City) select new { c, o }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_with_outer_2(bool async) => AssertQuery( async, @@ -1371,8 +1226,7 @@ from o in ss.Set().Where(o => c.CustomerID == o.CustomerID) AssertEqual(e.o, a.o); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_with_outer_3(bool async) => AssertQuery( async, @@ -1386,8 +1240,7 @@ from o in ss.Set().Where(o => c.CustomerID == o.CustomerID).Select(o => c Assert.Equal(e.o, a.o); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_with_outer_4(bool async) => AssertQuery( async, @@ -1402,8 +1255,7 @@ from o in ss.Set().Where(o => c.CustomerID == o.CustomerID) AssertEqual(e.o, a.o); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_with_outer_5(bool async) => AssertQuery( async, @@ -1417,8 +1269,7 @@ from o in ss.Set().Where(o => c.CustomerID != o.CustomerID).Select(o => c Assert.Equal(e.o, a.o); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_with_outer_6(bool async) => AssertQuery( async, @@ -1433,8 +1284,7 @@ from o in ss.Set().Where(o => c.CustomerID != o.CustomerID) AssertEqual(e.o, a.o); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_correlated_with_outer_7(bool async) => AssertQuery( async, @@ -1449,15 +1299,13 @@ from o in ss.Set().Where(o => c.CustomerID.Length >= o.CustomerID.Length) AssertEqual(e.o, a.o); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_multiple_Take(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(c => c.Orders.OrderBy(o => o.OrderID).Take(5).Take(3))); - [ConditionalTheory] // #33343 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #33343 public virtual Task SelectMany_with_nested_DefaultIfEmpty(bool async) => AssertQuery( async, @@ -1469,15 +1317,13 @@ public virtual Task SelectMany_with_nested_DefaultIfEmpty(bool async) .SelectMany(o => o.OrderDetails.DefaultIfEmpty())), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_with_multiple_Take(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(o => o.CustomerID).Take(5).Take(3)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_over_empty_collection_of_value_type_returns_correct_results(bool async) => AssertQuery( async, @@ -1485,19 +1331,17 @@ public virtual Task FirstOrDefault_over_empty_collection_of_value_type_returns_c where c.CustomerID.Equals("FISSA") select new { c.CustomerID, OrderId = c.Orders.OrderBy(o => o.OrderID).Select(o => o.OrderID).FirstOrDefault() }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_non_nullable_value_after_FirstOrDefault_on_empty_collection(bool async) => AssertQueryScalar( async, - ss => ss.Set().Select( - c => (int?)ss.Set().Where(o => o.CustomerID == "John Doe").Select(o => o.CustomerID).FirstOrDefault().Length), - ss => ss.Set().Select( - c => ss.Set().Where(o => o.CustomerID == "John Doe").Select(o => o.CustomerID).FirstOrDefault() - .MaybeScalar(e => e.Length))); + ss => ss.Set().Select(c + => (int?)ss.Set().Where(o => o.CustomerID == "John Doe").Select(o => o.CustomerID).FirstOrDefault().Length), + ss => ss.Set().Select(c => ss.Set().Where(o => o.CustomerID == "John Doe").Select(o => o.CustomerID) + .FirstOrDefault() + .MaybeScalar(e => e.Length))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Member_binding_after_ctor_arguments_fails_with_client_eval(bool async) => AssertQuery( async, @@ -1520,16 +1364,14 @@ public override int GetHashCode() => HashCode.Combine(Id, City); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Filtered_collection_projection_is_tracked(bool async) { using var context = CreateContext(); var query = context.Customers .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => - new { Customer = c, FilteredOrders = c.Orders.Where(o => o.OrderID > 11000) }); + .Select(c => + new { Customer = c, FilteredOrders = c.Orders.Where(o => o.OrderID > 11000) }); var result = async ? (await query.ToListAsync()) @@ -1540,16 +1382,14 @@ public virtual async Task Filtered_collection_projection_is_tracked(bool async) Assert.Equal(6, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Filtered_collection_projection_with_to_list_is_tracked(bool async) { using var context = CreateContext(); var query = context.Customers .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => - new { Customer = c, FilteredOrders = c.Orders.Where(o => o.OrderID > 11000).ToList() }); + .Select(c => + new { Customer = c, FilteredOrders = c.Orders.Where(o => o.OrderID > 11000).ToList() }); var result = async ? (await query.ToListAsync()) @@ -1560,25 +1400,22 @@ public virtual async Task Filtered_collection_projection_with_to_list_is_tracked Assert.Equal(6, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_collection_being_correlated_subquery_which_references_inner_and_outer_entity(bool async) => AssertQuery( async, - ss => ss.Set().SelectMany( - c => c.Orders.Select(o => new { OrderProperty = o.CustomerID, CustomerProperty = c.CustomerID }))); + ss => ss.Set() + .SelectMany(c => c.Orders.Select(o => new { OrderProperty = o.CustomerID, CustomerProperty = c.CustomerID }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_collection_being_correlated_subquery_which_references_non_mapped_properties_from_inner_and_outer_entity(bool async) => AssertQuery( async, - ss => ss.Set().SelectMany( - c => c.Orders.Select(o => new { OrderProperty = o.ShipName, CustomerProperty = c.ContactName }))); + ss => ss.Set() + .SelectMany(c => c.Orders.Select(o => new { OrderProperty = o.ShipName, CustomerProperty = c.ContactName }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_with_complex_expression_that_can_be_funcletized(bool async) => AssertQueryScalar( async, @@ -1587,8 +1424,7 @@ public virtual Task Select_with_complex_expression_that_can_be_funcletized(bool .Select(c => c.Region == null ? default(int?) : c.Region.IndexOf("")), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_chained_entity_navigation_doesnt_materialize_intermittent_entities(bool async) => AssertQuery( async, @@ -1596,8 +1432,7 @@ public virtual Task Select_chained_entity_navigation_doesnt_materialize_intermit elementAsserter: (e, a) => AssertCollection(e, a), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_entity_compared_to_null(bool async) => AssertQueryScalar( async, @@ -1605,8 +1440,7 @@ public virtual Task Select_entity_compared_to_null(bool async) where o.CustomerID == "ALFKI" select o.Customer == null); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Explicit_cast_in_arithmetic_operation_is_preserved(bool async) => AssertQueryScalar( async, @@ -1615,8 +1449,7 @@ public virtual Task Explicit_cast_in_arithmetic_operation_is_preserved(bool asyn select o.OrderID / (decimal)(o.OrderID + 1000), asserter: (e, a) => Assert.InRange(a, e - 0.0001M, e + 0.0001M)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_whose_selector_references_outer_source(bool async) => AssertQuery( async, @@ -1627,23 +1460,20 @@ from g in from o in ss.Set() select g, elementSorter: e => (e.OrderDate, e.CustomerCity)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_FirstOrDefault_with_entity_equality_check_in_projection(bool async) => AssertQuery( async, - ss => ss.Set().Select( - c => new { Order = (c.Orders.Any() ? c.Orders.FirstOrDefault() : null) == null ? null : new Order() })); + ss => ss.Set().Select(c + => new { Order = (c.Orders.Any() ? c.Orders.FirstOrDefault() : null) == null ? null : new Order() })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_FirstOrDefault_with_nullable_unsigned_int_column(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(c => c.Orders.OrderBy(o => o.OrderID).Select(o => o.EmployeeID).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToList_Count_in_projection_works(bool async) => AssertQuery( async, @@ -1656,16 +1486,14 @@ public virtual Task ToList_Count_in_projection_works(bool async) Assert.Equal(e.Count, a.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LastOrDefault_member_access_in_projection_translates_to_server(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID.StartsWith("A")) .Select(c => new { c, c.Orders.OrderByDescending(o => o.OrderID).LastOrDefault().OrderDate })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_with_parameterized_constructor(bool async) => AssertQuery( async, @@ -1673,8 +1501,7 @@ public virtual Task Projection_with_parameterized_constructor(bool async) elementSorter: e => e.Customer.CustomerID, elementAsserter: (e, a) => Assert.Equal(e.Customer, a.Customer)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_with_parameterized_constructor_with_member_assignment(bool async) => AssertQuery( async, @@ -1688,8 +1515,7 @@ private class CustomerWrapper(Customer customer) public Customer Customer { get; } = customer; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_AsNoTracking_OrderBy(bool async) => AssertQuery( async, @@ -1704,15 +1530,13 @@ public virtual Task Collection_projection_AsNoTracking_OrderBy(bool async) AssertCollection(e.Orders, a.Orders, elementSorter: i => i, elementAsserter: (ie, ia) => Assert.Equal(ie, ia)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Coalesce_over_nullable_uint(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.EmployeeID ?? 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_uint_through_collection_FirstOrDefault(bool async) => AssertQueryScalar( async, @@ -1720,15 +1544,13 @@ public virtual Task Project_uint_through_collection_FirstOrDefault(bool async) ss => ss.Set().Select(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault()) .Select(e => e.MaybeScalar(x => x.EmployeeID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_keyless_entity_FirstOrDefault_without_orderby(bool async) => AssertQuery( async, ss => ss.Set().Select(c => ss.Set().FirstOrDefault(cv => cv.CompanyName == c.CompanyName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_AsEnumerable_projection(bool async) => AssertQuery( async, @@ -1741,17 +1563,15 @@ public virtual Task Projection_AsEnumerable_projection(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => ee.OrderID)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_custom_type_in_both_sides_of_ternary(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(c => c.CustomerID) - .Select( - c => c.City == "Seattle" - ? new IdName { Id = "PAY", Name = "Pay" } - : new IdName { Id = "REC", Name = "Receive" }), + .Select(c => c.City == "Seattle" + ? new IdName { Id = "PAY", Name = "Pay" } + : new IdName { Id = "REC", Name = "Receive" }), assertOrder: true, elementAsserter: (e, a) => { @@ -1765,8 +1585,7 @@ private class IdName public string Name { get; set; } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_multiple_collection_with_same_constant_works(bool async) => AssertQuery( async, @@ -1779,8 +1598,7 @@ public virtual Task Projecting_multiple_collection_with_same_constant_works(bool AssertCollection(e.O2, a.O2, ordered: true); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_after_navigation_and_distinct(bool async) { var filteredOrderIds = new[] { 10248, 10249, 10250 }; @@ -1790,19 +1608,17 @@ public virtual Task Projecting_after_navigation_and_distinct(bool async) ss => ss.Set() .Select(o => o.Customer) .Distinct() - .Select( - c => new - { - c.CustomerID, - Orders = c.Orders.Where(x => filteredOrderIds.Contains(x.OrderID)).OrderBy(x => x.OrderID) - .Select( - x => new - { - c.CustomerID, - x.OrderID, - x.OrderDate - }) - }), + .Select(c => new + { + c.CustomerID, + Orders = c.Orders.Where(x => filteredOrderIds.Contains(x.OrderID)).OrderBy(x => x.OrderID) + .Select(x => new + { + c.CustomerID, + x.OrderID, + x.OrderDate + }) + }), elementSorter: e => e.CustomerID, elementAsserter: (e, a) => { @@ -1811,8 +1627,7 @@ public virtual Task Projecting_after_navigation_and_distinct(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_after_distinct_with_complex_projection_containing_original_identifier(bool async) { var filteredOrderIds = new[] { 10248, 10249, 10250 }; @@ -1822,20 +1637,19 @@ public virtual Task Correlated_collection_after_distinct_with_complex_projection ss => ss.Set() .Select(o => new { o.OrderID, Complex = o.OrderDate.Value.Month }) .Distinct() - .Select( - c => new - { - c.OrderID, - c.Complex, - Subquery = (from x in ss.Set() - where x.OrderID == c.OrderID && filteredOrderIds.Contains(x.OrderID) - select new - { - Outer = c.OrderID, - Inner = x.OrderID, - x.OrderDate - }).ToList() - }), + .Select(c => new + { + c.OrderID, + c.Complex, + Subquery = (from x in ss.Set() + where x.OrderID == c.OrderID && filteredOrderIds.Contains(x.OrderID) + select new + { + Outer = c.OrderID, + Inner = x.OrderID, + x.OrderDate + }).ToList() + }), elementSorter: e => e.OrderID, elementAsserter: (e, a) => { @@ -1845,8 +1659,7 @@ public virtual Task Correlated_collection_after_distinct_with_complex_projection }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_after_distinct_not_containing_original_identifier(bool async) { var filteredOrderIds = new[] { 10248, 10249, 10250 }; @@ -1856,21 +1669,20 @@ public virtual Task Correlated_collection_after_distinct_not_containing_original ss => ss.Set() .Select(o => new { o.OrderDate, o.CustomerID }) .Distinct() - .Select( - c => new - { - c.OrderDate, - c.CustomerID, - Subquery = (from x in ss.Set() - where x.CustomerID == c.CustomerID && filteredOrderIds.Contains(x.OrderID) - select new - { - Outer1 = c.OrderDate, - Outer2 = c.CustomerID, - Inner = x.OrderID, - x.OrderDate - }).ToList() - }), + .Select(c => new + { + c.OrderDate, + c.CustomerID, + Subquery = (from x in ss.Set() + where x.CustomerID == c.CustomerID && filteredOrderIds.Contains(x.OrderID) + select new + { + Outer1 = c.OrderDate, + Outer2 = c.CustomerID, + Inner = x.OrderID, + x.OrderDate + }).ToList() + }), elementSorter: e => (e.OrderDate, e.CustomerID), elementAsserter: (e, a) => { @@ -1880,8 +1692,7 @@ public virtual Task Correlated_collection_after_distinct_not_containing_original }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_after_distinct_with_complex_projection_not_containing_original_identifier(bool async) { var filteredOrderIds = new[] { 10248, 10249, 10250 }; @@ -1889,31 +1700,29 @@ public virtual Task Correlated_collection_after_distinct_with_complex_projection return AssertQuery( async, ss => ss.Set() - .Select( - o => new - { - o.OrderDate, - o.CustomerID, - Complex = o.OrderDate.Value.Month - }) + .Select(o => new + { + o.OrderDate, + o.CustomerID, + Complex = o.OrderDate.Value.Month + }) .Distinct() - .Select( - c => new - { - c.OrderDate, - c.CustomerID, - c.Complex, - Subquery = (from x in ss.Set() - where x.CustomerID == c.CustomerID && filteredOrderIds.Contains(x.OrderID) - select new - { - Outer1 = c.OrderDate, - Outer2 = c.CustomerID, - Outer3 = c.Complex, - Inner = x.OrderID, - x.OrderDate - }).ToList() - }), + .Select(c => new + { + c.OrderDate, + c.CustomerID, + c.Complex, + Subquery = (from x in ss.Set() + where x.CustomerID == c.CustomerID && filteredOrderIds.Contains(x.OrderID) + select new + { + Outer1 = c.OrderDate, + Outer2 = c.CustomerID, + Outer3 = c.Complex, + Inner = x.OrderID, + x.OrderDate + }).ToList() + }), elementSorter: e => (e.OrderDate, e.CustomerID, e.Complex), elementAsserter: (e, a) => { @@ -1925,8 +1734,7 @@ public virtual Task Correlated_collection_after_distinct_with_complex_projection }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_after_groupby_with_complex_projection_containing_original_identifier(bool async) { var filteredOrderIds = new[] { 10248, 10249, 10250 }; @@ -1936,20 +1744,19 @@ public virtual Task Correlated_collection_after_groupby_with_complex_projection_ ss => ss.Set() .GroupBy(o => new { o.OrderID, Complex = o.OrderDate.Value.Month }) .Select(g => new { g.Key, Aggregate = g.Count() }) - .Select( - c => new - { - c.Key.OrderID, - c.Key.Complex, - Subquery = (from x in ss.Set() - where x.OrderID == c.Key.OrderID && filteredOrderIds.Contains(x.OrderID) - select new - { - Outer = c.Key.OrderID, - Inner = x.OrderID, - x.OrderDate - }).ToList() - }), + .Select(c => new + { + c.Key.OrderID, + c.Key.Complex, + Subquery = (from x in ss.Set() + where x.OrderID == c.Key.OrderID && filteredOrderIds.Contains(x.OrderID) + select new + { + Outer = c.Key.OrderID, + Inner = x.OrderID, + x.OrderDate + }).ToList() + }), elementSorter: e => e.OrderID, elementAsserter: (e, a) => { @@ -1959,27 +1766,24 @@ public virtual Task Correlated_collection_after_groupby_with_complex_projection_ }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Custom_projection_reference_navigation_PK_to_FK_optimization(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - o => new Order - { - OrderID = o.OrderID, - Customer = new Customer { CustomerID = o.Customer.CustomerID, City = o.Customer.City }, - OrderDate = o.OrderDate - }), + .Select(o => new Order + { + OrderID = o.OrderID, + Customer = new Customer { CustomerID = o.Customer.CustomerID, City = o.Customer.City }, + OrderDate = o.OrderDate + }), elementAsserter: (e, a) => { AssertEqual(e, a); AssertEqual(e.Customer, a.Customer); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_Length_of_a_string_property_after_FirstOrDefault_on_correlated_collection(bool async) => AssertQueryScalar( async, @@ -1991,8 +1795,7 @@ public virtual Task Projecting_Length_of_a_string_property_after_FirstOrDefault_ .Select(c => c.Orders.OrderBy(o => o.OrderID).Select(o => o.CustomerID).FirstOrDefault().MaybeScalar(x => x.Length)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_count_of_navigation_which_is_generic_list(bool async) => AssertQueryScalar( async, @@ -2001,8 +1804,7 @@ public virtual Task Projecting_count_of_navigation_which_is_generic_list(bool as .Select(c => c.Orders.Count), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_count_of_navigation_which_is_generic_collection(bool async) { var collectionCount = typeof(ICollection).GetProperty("Count"); @@ -2022,8 +1824,7 @@ public virtual Task Projecting_count_of_navigation_which_is_generic_collection(b assertOrder: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_count_of_navigation_which_is_generic_collection_using_convert(bool async) => AssertQueryScalar( async, @@ -2032,41 +1833,37 @@ public virtual Task Projecting_count_of_navigation_which_is_generic_collection_u .Select(c => ((ICollection)c.Orders).Count), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_take_projection_doesnt_project_intermittent_column(bool async) => AssertQuery( async, ss => ss .Set() .OrderBy(c => c.CustomerID) - .Select( - c => new - { - c.CustomerID, - c.City, - c.CompanyName - }) + .Select(c => new + { + c.CustomerID, + c.City, + c.CompanyName + }) .Take(10) .Select(x => new { Aggregate = x.CustomerID + " " + x.City }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Do_not_erase_projection_mapping_when_adding_single_projection(bool async) => AssertQuery( async, ss => ss.Set() .Where(o => o.OrderID < 10350) .Include(e => e.OrderDetails).ThenInclude(e => e.Product) - .Select( - o => new - { - o.OrderID, - Order = o, - Property1 = o.OrderDetails.FirstOrDefault(e => e.UnitPrice > 10), - Property2 = o.OrderDetails.Where(e => e.UnitPrice < 10), - }), + .Select(o => new + { + o.OrderID, + Order = o, + Property1 = o.OrderDetails.FirstOrDefault(e => e.UnitPrice > 10), + Property2 = o.OrderDetails.Where(e => e.UnitPrice < 10), + }), elementSorter: e => e.OrderID, elementAsserter: (e, a) => { @@ -2081,79 +1878,71 @@ public virtual Task Do_not_erase_projection_mapping_when_adding_single_projectio elementAsserter: (ei, ai) => AssertInclude(ei, ai, new ExpectedInclude(e => e.Product))); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_skip_projection_doesnt_project_intermittent_column(bool async) => AssertQuery( async, ss => ss .Set() .OrderBy(c => c.CustomerID) - .Select( - c => new - { - c.CustomerID, - c.City, - c.CompanyName - }) + .Select(c => new + { + c.CustomerID, + c.City, + c.CompanyName + }) .Skip(7) .Select(x => new { Aggregate = x.CustomerID + " " + x.City }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_Distinct_projection_preserves_columns_used_for_distinct_in_subquery(bool async) => AssertQuery( async, ss => ss .Set() .OrderBy(c => c.CustomerID) - .Select( - c => new - { - c.CustomerID, - FirstLetter = c.CustomerID.Substring(0, 1), - Foo = "Foo" - }) + .Select(c => new + { + c.CustomerID, + FirstLetter = c.CustomerID.Substring(0, 1), + Foo = "Foo" + }) .Distinct() .Select(x => new { Aggregate = x.FirstLetter + " " + x.Foo }), elementSorter: e => e.Aggregate); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projection_take_predicate_projection(bool async) => AssertQuery( async, ss => ss .Set() .OrderBy(c => c.CustomerID) - .Select( - c => new - { - c.CustomerID, - c.City, - c.CompanyName - }) + .Select(c => new + { + c.CustomerID, + c.City, + c.CompanyName + }) .Take(10) .Where(x => x.CustomerID.StartsWith("A")) .Select(x => new { Aggregate = x.CustomerID + " " + x.City }), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Ternary_in_client_eval_assigns_correct_types(bool async) => AssertQuery( async, ss => ss.Set() .Where(o => o.OrderID < 10300) .OrderBy(e => e.OrderID) - .Select( - o => new - { - CustomerID = ClientMethod(o.CustomerID), - OrderDate = o.OrderDate.HasValue ? o.OrderDate.Value : new DateTime(o.OrderID - 10000, 1, 1), - OrderDate2 = o.OrderDate.HasValue == false ? new DateTime(o.OrderID - 10000, 1, 1) : o.OrderDate.Value - }), + .Select(o => new + { + CustomerID = ClientMethod(o.CustomerID), + OrderDate = o.OrderDate.HasValue ? o.OrderDate.Value : new DateTime(o.OrderID - 10000, 1, 1), + OrderDate2 = o.OrderDate.HasValue == false ? new DateTime(o.OrderID - 10000, 1, 1) : o.OrderDate.Value + }), assertOrder: true, elementAsserter: (e, a) => { @@ -2165,28 +1954,25 @@ public virtual Task Ternary_in_client_eval_assigns_correct_types(bool async) private static string ClientMethod(string s) => s; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task VisitLambda_should_not_be_visited_trivially(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => - { - var orders = ss.Set().Where(o => o.CustomerID.StartsWith("A")).ToList(); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => + { + var orders = ss.Set().Where(o => o.CustomerID.StartsWith("A")).ToList(); - return ss.Set() - .Select(c => new { Customer = c, HasOrder = orders.Any(o => o.CustomerID == c.CustomerID) }); - }, - elementSorter: e => e.Customer.CustomerID, - elementAsserter: (e, a) => - { - AssertEqual(e.Customer, a.Customer); - AssertEqual(e.HasOrder, a.HasOrder); - })); + return ss.Set() + .Select(c => new { Customer = c, HasOrder = orders.Any(o => o.CustomerID == c.CustomerID) }); + }, + elementSorter: e => e.Customer.CustomerID, + elementAsserter: (e, a) => + { + AssertEqual(e.Customer, a.Customer); + AssertEqual(e.HasOrder, a.HasOrder); + })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Correlated_collection_after_groupby_with_complex_projection_not_containing_original_identifier(bool async) { var filteredOrderIds = new[] { 10248, 10249, 10250 }; @@ -2196,20 +1982,19 @@ public virtual Task Correlated_collection_after_groupby_with_complex_projection_ ss => ss.Set() .GroupBy(o => new { o.CustomerID, Complex = o.OrderDate.Value.Month }) .Select(g => new { g.Key, Aggregate = g.Count() }) - .Select( - c => new - { - c.Key.CustomerID, - c.Key.Complex, - Subquery = (from x in ss.Set() - where x.CustomerID == c.Key.CustomerID && filteredOrderIds.Contains(x.OrderID) - select new - { - Outer = c.Key.CustomerID, - Inner = x.OrderID, - x.OrderDate - }).ToList() - }), + .Select(c => new + { + c.Key.CustomerID, + c.Key.Complex, + Subquery = (from x in ss.Set() + where x.CustomerID == c.Key.CustomerID && filteredOrderIds.Contains(x.OrderID) + select new + { + Outer = c.Key.CustomerID, + Inner = x.OrderID, + x.OrderDate + }).ToList() + }), elementSorter: e => (e.CustomerID, e.Complex), elementAsserter: (e, a) => { @@ -2219,8 +2004,7 @@ public virtual Task Correlated_collection_after_groupby_with_complex_projection_ }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_include_over_result_of_single_non_scalar(bool async) => AssertQuery( async, @@ -2238,8 +2022,7 @@ public virtual Task Collection_include_over_result_of_single_non_scalar(bool asy AssertInclude(e.SingleOrder, a.SingleOrder, new ExpectedInclude(o => o.OrderDetails)); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_selecting_outer_element_followed_by_take(bool async) => AssertQuery( async, @@ -2257,34 +2040,30 @@ public virtual Task Collection_projection_selecting_outer_element_followed_by_ta elementAsserter: (ee, aa) => AssertInclude(ee, aa, new ExpectedInclude(i => i.Orders))); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_on_top_level_and_on_collection_projection_with_outer_apply(bool async) => AssertFirstOrDefault( async, ss => ss.Set() .Where(o => o.CustomerID.StartsWith("F")) - .Select( - o => new Order - { - OrderID = o.OrderID, - OrderDate = o.OrderDate, - OrderDetails = o.OrderDetails.Select( - e => new OrderDetail - { - OrderID = e.OrderID, - Product = e.Product, - UnitPrice = e.UnitPrice - }) - .OrderByDescending(e => e.OrderID) - .Skip(0) - .Take(10) - .ToList() - })); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + .Select(o => new Order + { + OrderID = o.OrderID, + OrderDate = o.OrderDate, + OrderDetails = o.OrderDetails.Select(e => new OrderDetail + { + OrderID = e.OrderID, + Product = e.Product, + UnitPrice = e.UnitPrice + }) + .OrderByDescending(e => e.OrderID) + .Skip(0) + .Take(10) + .ToList() + })); + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_on_correlated_collection_in_first(bool async) => AssertFirstOrDefault( async, @@ -2292,18 +2071,16 @@ public virtual Task Take_on_correlated_collection_in_first(bool async) ss.Set() .Where(o => o.CustomerID.StartsWith("F")) .OrderBy(e => e.CustomerID) - .Select( - o => new - { - Orders = o.Orders.OrderBy(a => a.OrderDate).Take(1) - .Select(e => new { Title = e.CustomerID == e.Customer.CustomerID ? "A" : "B" }).ToList() - }), + .Select(o => new + { + Orders = o.Orders.OrderBy(a => a.OrderDate).Take(1) + .Select(e => new { Title = e.CustomerID == e.Customer.CustomerID ? "A" : "B" }).ToList() + }), asserter: (e, a) => AssertCollection( e.Orders, a.Orders, ordered: true, elementAsserter: (ee, aa) => AssertEqual(ee.Title, aa.Title))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_projection_via_ctor_arguments(bool async) => AssertSingle( async, @@ -2311,10 +2088,9 @@ public virtual Task Client_projection_via_ctor_arguments(bool async) ss.Set() .Where(c => c.CustomerID == "ALFKI") .Include(c => c.Orders) - .Select( - c => new CustomerDetailsWithCount( - c.CustomerID, c.City, - c.Orders.Select(o => new OrderInfo(o.OrderID, o.OrderDate)).ToList(), c.Orders.Count)), + .Select(c => new CustomerDetailsWithCount( + c.CustomerID, c.City, + c.Orders.Select(o => new OrderInfo(o.OrderID, o.OrderDate)).ToList(), c.Orders.Count)), asserter: (e, a) => { Assert.Equal(e.CustomerID, a.CustomerID); @@ -2344,45 +2120,42 @@ private class OrderInfo(int orderID, DateTime? orderDate) public DateTime? OrderDate { get; } = orderDate; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_projection_with_string_initialization_with_scalar_subquery(bool async) => AssertQuery( async, ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Select( - c => new + .Select(c => new + { + c.CustomerID, + Order = c.Orders.FirstOrDefault(o => o.OrderID < 11000).OrderDate, + InterpolatedString = $"test{c.City}", + NonInterpolatedString = "test" + c.City, + Collection = new List { - c.CustomerID, - Order = c.Orders.FirstOrDefault(o => o.OrderID < 11000).OrderDate, - InterpolatedString = $"test{c.City}", - NonInterpolatedString = "test" + c.City, - Collection = new List - { - $"{c.CustomerID}@test1.com", - $"{c.CustomerID}@test2.com", - $"{c.CustomerID}@test3.com", - $"{c.CustomerID}@test4.com" - } - }), + $"{c.CustomerID}@test1.com", + $"{c.CustomerID}@test2.com", + $"{c.CustomerID}@test3.com", + $"{c.CustomerID}@test4.com" + } + }), ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Select( - c => new + .Select(c => new + { + c.CustomerID, + Order = c.Orders.FirstOrDefault(o => o.OrderID < 11000).MaybeScalar(e => e.OrderDate), + InterpolatedString = $"test{c.City}", + NonInterpolatedString = "test" + c.City, + Collection = new List { - c.CustomerID, - Order = Enumerable.FirstOrDefault(c.Orders, o => o.OrderID < 11000).MaybeScalar(e => e.OrderDate), - InterpolatedString = $"test{c.City}", - NonInterpolatedString = "test" + c.City, - Collection = new List - { - $"{c.CustomerID}@test1.com", - $"{c.CustomerID}@test2.com", - $"{c.CustomerID}@test3.com", - $"{c.CustomerID}@test4.com" - } - }), + $"{c.CustomerID}@test1.com", + $"{c.CustomerID}@test2.com", + $"{c.CustomerID}@test3.com", + $"{c.CustomerID}@test4.com" + } + }), elementSorter: e => e.CustomerID, elementAsserter: (e, a) => { @@ -2395,8 +2168,7 @@ public virtual Task Client_projection_with_string_initialization_with_scalar_sub private class OrderDto; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task MemberInit_in_projection_without_arguments(bool async) => AssertQuery( async, @@ -2410,20 +2182,18 @@ public virtual Task MemberInit_in_projection_without_arguments(bool async) AssertEqual(e.Orders.Count(), a.Orders.Count()); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task List_of_list_of_anonymous_type(bool async) => AssertQuery( async, ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Select( - c => new - { - c.CustomerID, - ListWithSubList = c.Orders.OrderBy(e => e.OrderID) - .Select(o => o.OrderDetails.Select(e => new { e.OrderID, e.ProductID })) - }), + .Select(c => new + { + c.CustomerID, + ListWithSubList = c.Orders.OrderBy(e => e.OrderID) + .Select(o => o.OrderDetails.Select(e => new { e.OrderID, e.ProductID })) + }), elementSorter: e => e.CustomerID, elementAsserter: (e, a) => { @@ -2433,8 +2203,7 @@ public virtual Task List_of_list_of_anonymous_type(bool async) elementAsserter: (ee, aa) => AssertCollection(ee, aa, elementSorter: i => (i.OrderID, i.ProductID))); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Using_enumerable_parameter_in_projection(bool async) { var customersToLoad = new List { "A" }; @@ -2444,14 +2213,13 @@ public virtual Task Using_enumerable_parameter_in_projection(bool async) async, ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Select( - c => new - { - c.CustomerID, - Orders = customersToLoad.Contains("FISSA") - ? c.Orders.Select(e => new OrderDto()) - : results - }), + .Select(c => new + { + c.CustomerID, + Orders = customersToLoad.Contains("FISSA") + ? c.Orders.Select(e => new OrderDto()) + : results + }), elementSorter: e => e.CustomerID, elementAsserter: (e, a) => { @@ -2460,8 +2228,7 @@ public virtual Task Using_enumerable_parameter_in_projection(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task List_from_result_of_single_result(bool async) => AssertFirstOrDefault( async, @@ -2470,8 +2237,7 @@ public virtual Task List_from_result_of_single_result(bool async) .Select(c => c.Orders.Select(e => e.OrderID)), asserter: (e, a) => AssertCollection(e, a, elementSorter: e => e, elementAsserter: (ee, aa) => AssertEqual(ee, aa))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task List_from_result_of_single_result_2(bool async) => AssertFirstOrDefault( async, @@ -2486,20 +2252,17 @@ public virtual Task List_from_result_of_single_result_2(bool async) AssertEqual(ee.OrderDate, aa.OrderDate); })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task List_from_result_of_single_result_3(bool async) => AssertFirstOrDefault( async, ss => ss.Set() .OrderBy(c => c.CustomerID) - .Select( - c => c.Orders.OrderBy(o => o.OrderDate) - .Select(e => e.OrderDetails.Select(od => od.ProductID)).FirstOrDefault()), + .Select(c => c.Orders.OrderBy(o => o.OrderDate) + .Select(e => e.OrderDetails.Select(od => od.ProductID)).FirstOrDefault()), asserter: (e, a) => AssertCollection(e, a, elementSorter: e => e, elementAsserter: (ee, aa) => AssertEqual(ee, aa))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Entity_passed_to_DTO_constructor_works(bool async) => AssertQuery( async, @@ -2512,25 +2275,23 @@ public class CustomerDtoWithEntityInCtor(Customer customer) public string Id { get; } = customer.CustomerID; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Set_operation_in_pending_collection(bool async) => AssertQuery( async, ss => ss.Set() .OrderBy(x => x.CustomerID) - .Select( - x => new - { - OrderIds = (from o1 in ss.Set() - where o1.CustomerID == x.CustomerID - select o1.OrderID) - .Union( - from o2 in ss.Set() - where o2.CustomerID == x.CustomerID - select o2.OrderID) - .ToList() - }).Take(5), + .Select(x => new + { + OrderIds = (from o1 in ss.Set() + where o1.CustomerID == x.CustomerID + select o1.OrderID) + .Union( + from o2 in ss.Set() + where o2.CustomerID == x.CustomerID + select o2.OrderID) + .ToList() + }).Take(5), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.OrderIds, a.OrderIds, elementSorter: ee => ee)); } diff --git a/test/EFCore.Specification.Tests/Query/NorthwindSetOperationsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindSetOperationsQueryTestBase.cs index dcbd3c5455a..3e5101bdc7d 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindSetOperationsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindSetOperationsQueryTestBase.cs @@ -18,8 +18,7 @@ protected virtual void ClearLog() { } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat(bool async) => AssertQuery( async, @@ -27,8 +26,7 @@ public virtual Task Concat(bool async) .Where(c => c.City == "Berlin") .Concat(ss.Set().Where(c => c.City == "London"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_nested(bool async) => AssertQuery( async, @@ -37,8 +35,7 @@ public virtual Task Concat_nested(bool async) .Concat(ss.Set().Where(s => s.City == "Berlin")) .Concat(ss.Set().Where(e => e.City == "London"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_non_entity(bool async) => AssertQuery( async, @@ -50,8 +47,7 @@ public virtual Task Concat_non_entity(bool async) .Where(s => s.ContactTitle == "Owner") .Select(c => c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Except(bool async) => AssertQuery( async, @@ -59,8 +55,7 @@ public virtual Task Except(bool async) .Where(c => c.City == "London") .Except(ss.Set().Where(c => c.ContactName.Contains("Thomas")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Except_simple_followed_by_projecting_constant(bool async) => AssertQueryScalar( async, @@ -69,8 +64,7 @@ public virtual Task Except_simple_followed_by_projecting_constant(bool async) .Select(e => 1), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Except_nested(bool async) => AssertQuery( async, @@ -81,19 +75,19 @@ public virtual Task Except_nested(bool async) // EXCEPT is non-commutative, unlike UNION/INTERSECT. Therefore, parentheses are needed in the following query // to ensure that the inner EXCEPT is evaluated first. See #36105. - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Except_nested2(bool async) => AssertQuery( async, ss => ss.Set() - .Except(ss.Set() - .Where(s => s.City == "Seattle") - .Except(ss.Set() - .Where(e => e.City == "Seattle")))); + .Except( + ss.Set() + .Where(s => s.City == "Seattle") + .Except( + ss.Set() + .Where(e => e.City == "Seattle")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Except_non_entity(bool async) => AssertQuery( async, @@ -105,8 +99,7 @@ public virtual Task Except_non_entity(bool async) .Where(c => c.City == "México D.F.") .Select(c => c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Intersect(bool async) => AssertQuery( async, @@ -114,8 +107,7 @@ public virtual Task Intersect(bool async) .Where(c => c.City == "London") .Intersect(ss.Set().Where(c => c.ContactName.Contains("Thomas")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Intersect_nested(bool async) => AssertQuery( async, @@ -124,8 +116,7 @@ public virtual Task Intersect_nested(bool async) .Intersect(ss.Set().Where(s => s.ContactTitle == "Owner")) .Intersect(ss.Set().Where(e => e.Fax != null))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Intersect_non_entity(bool async) => AssertQuery( async, @@ -137,8 +128,7 @@ public virtual Task Intersect_non_entity(bool async) .Where(s => s.ContactTitle == "Owner") .Select(c => c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union(bool async) => AssertQuery( async, @@ -146,8 +136,7 @@ public virtual Task Union(bool async) .Where(c => c.City == "Berlin") .Union(ss.Set().Where(c => c.City == "London"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_nested(bool async) => AssertQuery( async, @@ -156,8 +145,7 @@ public virtual Task Union_nested(bool async) .Union(ss.Set().Where(s => s.City == "México D.F.")) .Union(ss.Set().Where(e => e.City == "London"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_non_entity(bool async) => AssertQuery( async, @@ -170,8 +158,7 @@ public virtual Task Union_non_entity(bool async) .Select(c => c.CustomerID))); // OrderBy, Skip and Take are typically supported on the set operation itself (no need for query pushdown) - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_OrderBy_Skip_Take(bool async) => AssertQuery( async, @@ -184,8 +171,7 @@ public virtual Task Union_OrderBy_Skip_Take(bool async) assertOrder: true); // Should cause pushdown into a subquery - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_Where(bool async) => AssertQuery( async, @@ -195,8 +181,7 @@ public virtual Task Union_Where(bool async) .Where(c => c.ContactName.Contains("Thomas"))); // pushdown // Should cause pushdown into a subquery, keeping the ordering, offset and limit inside the subquery - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_Skip_Take_OrderBy_ThenBy_Where(bool async) => AssertQuery( async, @@ -209,8 +194,7 @@ public virtual Task Union_Skip_Take_OrderBy_ThenBy_Where(bool async) .Where(c => c.ContactName.Contains("Thomas"))); // pushdown // Nested set operation with same operation type - no parentheses are needed. - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_Union(bool async) => AssertQuery( async, @@ -221,8 +205,7 @@ public virtual Task Union_Union(bool async) // Nested set operation but with different operation type. On SqlServer and PostgreSQL INTERSECT binds // more tightly than UNION/EXCEPT, so parentheses are needed. - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_Intersect(bool async) => AssertQuery( async, @@ -233,17 +216,16 @@ public virtual Task Union_Intersect(bool async) // The evaluation order of Concat and Union can matter: A UNION ALL (B UNION C) can be different from (A UNION ALL B) UNION C. // Make sure parentheses are added. - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_inside_Concat(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.City == "Berlin") - .Concat(ss.Set().Where(c => c.City == "London") - .Union(ss.Set().Where(c => c.City == "Berlin")))); + .Concat( + ss.Set().Where(c => c.City == "London") + .Union(ss.Set().Where(c => c.City == "Berlin")))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_Take_Union_Take(bool async) => AssertQuery( async, @@ -257,8 +239,7 @@ public virtual Task Union_Take_Union_Take(bool async) .Take(1), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Union(bool async) => AssertQuery( async, @@ -270,8 +251,7 @@ public virtual Task Select_Union(bool async) .Where(c => c.City == "London") .Select(c => c.Address))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_Select(bool async) => AssertQuery( async, @@ -281,8 +261,7 @@ public virtual Task Union_Select(bool async) .Select(c => c.Address) .Where(a => a.Contains("Hanover"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_Select_scalar(bool async) => AssertQuery( async, @@ -290,8 +269,7 @@ public virtual Task Union_Select_scalar(bool async) .Union(ss.Set()) .Select(c => (object)1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_with_anonymous_type_projection(bool async) => AssertQuery( async, @@ -321,8 +299,7 @@ public override int GetHashCode() => Id != null ? Id.GetHashCode() : 0; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Union_unrelated(bool async) => AssertQuery( async, @@ -333,8 +310,7 @@ public virtual Task Select_Union_unrelated(bool async) .OrderBy(x => x), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Union_different_fields_in_anonymous_with_subquery(bool async) => AssertQuery( async, @@ -350,8 +326,7 @@ public virtual Task Select_Union_different_fields_in_anonymous_with_subquery(boo .Take(10) .Where(x => x.Foo == "Berlin")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_Include(bool async) => AssertQuery( async, @@ -360,8 +335,7 @@ public virtual Task Union_Include(bool async) .Union(ss.Set().Where(c => c.City == "London")) .Include(c => c.Orders)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_Union(bool async) => AssertQuery( async, @@ -373,8 +347,7 @@ public virtual Task Include_Union(bool async) .Where(c => c.City == "London") .Include(c => c.Orders))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_Except_reference_projection(bool async) => AssertQuery( async, @@ -385,8 +358,7 @@ public virtual Task Select_Except_reference_projection(bool async) .Where(o => o.CustomerID == "ALFKI") .Select(o => o.Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Intersect_on_distinct(bool async) => AssertQuery( async, @@ -399,8 +371,7 @@ public virtual Task Intersect_on_distinct(bool async) .Where(s => s.ContactTitle == "Owner") .Select(c => c.CompanyName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_on_distinct(bool async) => AssertQuery( async, @@ -413,8 +384,7 @@ public virtual Task Union_on_distinct(bool async) .Where(s => s.ContactTitle == "Owner") .Select(c => c.CompanyName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Except_on_distinct(bool async) => AssertQuery( async, @@ -427,51 +397,45 @@ public virtual Task Except_on_distinct(bool async) .Where(s => s.ContactTitle == "Owner") .Select(c => c.CompanyName))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_Union_only_on_one_side_throws(bool async) { - var message1 = (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Where(c => c.City == "Berlin") - .Include(c => c.Orders) - .Union(ss.Set().Where(c => c.City == "London"))))).Message; + var message1 = (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Where(c => c.City == "Berlin") + .Include(c => c.Orders) + .Union(ss.Set().Where(c => c.City == "London"))))).Message; Assert.Equal(CoreStrings.SetOperationWithDifferentIncludesInOperands, message1); - var message2 = (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Where(c => c.City == "Berlin") - .Union(ss.Set().Where(c => c.City == "London").Include(c => c.Orders))))).Message; + var message2 = (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Where(c => c.City == "Berlin") + .Union(ss.Set().Where(c => c.City == "London").Include(c => c.Orders))))).Message; Assert.Equal(CoreStrings.SetOperationWithDifferentIncludesInOperands, message2); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_Union_different_includes_throws(bool async) { - var message = (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set() - .Where(c => c.City == "Berlin") - .Include(c => c.Orders) - .Union( - ss.Set() - .Where(c => c.City == "London") - .Include(c => c.Orders) - .ThenInclude(o => o.OrderDetails))))).Message; + var message = (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set() + .Where(c => c.City == "Berlin") + .Include(c => c.Orders) + .Union( + ss.Set() + .Where(c => c.City == "London") + .Include(c => c.Orders) + .ThenInclude(o => o.OrderDetails))))).Message; Assert.Equal(CoreStrings.SetOperationWithDifferentIncludesInOperands, message); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SubSelect_Union(bool async) => AssertQuery( async, @@ -481,8 +445,7 @@ public virtual Task SubSelect_Union(bool async) ss.Set() .Select(c => new { Customer = c, Orders = c.Orders.Count }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_eval_Union_FirstOrDefault(bool async) => AssertFirstOrDefault( async, @@ -493,8 +456,7 @@ public virtual Task Client_eval_Union_FirstOrDefault(bool async) private static Customer ClientSideMethod(Customer c) => c; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_Select_Union(bool async) => AssertQuery( async, @@ -508,8 +470,7 @@ public virtual Task GroupBy_Select_Union(bool async) .GroupBy(c => c.CustomerID) .Select(g => new { CustomerID = g.Key, Count = g.Count() }))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_columns_with_different_nullability(bool async) => AssertQuery( async, @@ -519,328 +480,287 @@ public virtual Task Union_over_columns_with_different_nullability(bool async) ss.Set() .Select(c => (string)null))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_column_column(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID) .Union(ss.Set().Select(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_column_function(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID) .Union(ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_column_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID) .Union(ss.Set().Select(o => 8))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_column_unary(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID) .Union(ss.Set().Select(o => -o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_column_binary(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID) .Union(ss.Set().Select(o => o.OrderID + 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_column_scalarsubquery(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID) .Union(ss.Set().Select(o => o.OrderDetails.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_function_column(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()) .Union(ss.Set().Select(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_function_function(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()) .Union(ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_function_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()) .Union(ss.Set().Select(o => 8))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_function_unary(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()) .Union(ss.Set().Select(o => -o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_function_binary(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()) .Union(ss.Set().Select(o => o.OrderID + 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_function_scalarsubquery(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()) .Union(ss.Set().Select(o => o.OrderDetails.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_constant_column(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => 8) .Union(ss.Set().Select(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_constant_function(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => 8) .Union(ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_constant_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => 8) .Union(ss.Set().Select(o => 8))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_constant_unary(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => 8) .Union(ss.Set().Select(o => -o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_constant_binary(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => 8) .Union(ss.Set().Select(o => o.OrderID + 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_constant_scalarsubquery(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => 8) .Union(ss.Set().Select(o => o.OrderDetails.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_unary_column(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => -o.OrderID) .Union(ss.Set().Select(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_unary_function(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => -o.OrderID) .Union(ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_unary_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => -o.OrderID) .Union(ss.Set().Select(o => 8))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_unary_unary(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => -o.OrderID) .Union(ss.Set().Select(o => -o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_unary_binary(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => -o.OrderID) .Union(ss.Set().Select(o => o.OrderID + 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_unary_scalarsubquery(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => -o.OrderID) .Union(ss.Set().Select(o => o.OrderDetails.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_binary_column(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID + 1) .Union(ss.Set().Select(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_binary_function(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID + 1) .Union(ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_binary_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID + 1) .Union(ss.Set().Select(o => 8))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_binary_unary(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID + 1) .Union(ss.Set().Select(o => -o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_binary_binary(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID + 1) .Union(ss.Set().Select(o => o.OrderID + 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_binary_scalarsubquery(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID + 1) .Union(ss.Set().Select(o => o.OrderDetails.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_scalarsubquery_column(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDetails.Count()) .Union(ss.Set().Select(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_scalarsubquery_function(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDetails.Count()) .Union(ss.Set().GroupBy(o => o.OrderID).Select(g => g.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_scalarsubquery_constant(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDetails.Count()) .Union(ss.Set().Select(o => 8))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_scalarsubquery_unary(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDetails.Count()) .Union(ss.Set().Select(o => -o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_scalarsubquery_binary(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDetails.Count()) .Union(ss.Set().Select(o => o.OrderID + 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_scalarsubquery_scalarsubquery(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderDetails.Count()) .Union(ss.Set().Select(o => o.OrderDetails.Count()))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_OrderBy_Take1(bool async) => AssertQueryScalar( async, ss => ss.Set().OrderBy(o => o.OrderDate).Take(5).Select(o => o.OrderID) .Union(ss.Set().Select(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_OrderBy_without_Skip_Take1(bool async) => AssertQueryScalar( async, ss => ss.Set().OrderBy(o => o.OrderDate).Select(o => o.OrderID) .Union(ss.Set().Select(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_OrderBy_Take2(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID) .Union(ss.Set().OrderBy(o => o.OrderDate).Take(5).Select(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_OrderBy_without_Skip_Take2(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(o => o.OrderID) .Union(ss.Set().OrderBy(o => o.OrderDate).Select(o => o.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_Take_Union(bool async) => AssertQuery( async, @@ -853,8 +773,7 @@ public virtual Task OrderBy_Take_Union(bool async) .Take(1)), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_after_set_operation(bool async) => AssertQuery( async, @@ -868,8 +787,7 @@ public virtual Task Collection_projection_after_set_operation(bool async) AssertCollection(e.Orders, a.Orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_after_set_operation_fails_if_distinct(bool async) => AssertQuery( async, @@ -883,8 +801,7 @@ public virtual Task Collection_projection_after_set_operation_fails_if_distinct( AssertCollection(e.Orders, a.Orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Collection_projection_before_set_operation_fails(bool async) => AssertQuery( async, @@ -901,8 +818,7 @@ public virtual Task Collection_projection_before_set_operation_fails(bool async) AssertCollection(e.Orders, a.Orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_with_one_side_being_GroupBy_aggregate(bool async) => AssertQuery( async, @@ -919,8 +835,7 @@ public virtual Task Concat_with_one_side_being_GroupBy_aggregate(bool async) AssertEqual(e.OrderDate, a.OrderDate); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_on_entity_with_correlated_collection(bool async) => AssertQuery( async, @@ -934,8 +849,7 @@ public virtual Task Union_on_entity_with_correlated_collection(bool async) AssertCollection(e, a); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_on_entity_plus_other_column_with_correlated_collection(bool async) => AssertQuery( async, @@ -950,8 +864,7 @@ public virtual Task Union_on_entity_plus_other_column_with_correlated_collection AssertCollection(e.Orders, a.Orders); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_with_pruning(bool async) => AssertQuery( async, @@ -959,8 +872,7 @@ public virtual Task Concat_with_pruning(bool async) .Concat(ss.Set().Where(c => c.CustomerID.StartsWith("B"))) .Select(x => x.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_with_distinct_on_one_source_and_pruning(bool async) => AssertQuery( async, @@ -968,8 +880,7 @@ public virtual Task Concat_with_distinct_on_one_source_and_pruning(bool async) .Concat(ss.Set().Where(c => c.CustomerID.StartsWith("B")).Distinct()) .Select(x => x.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Concat_with_distinct_on_both_source_and_pruning(bool async) => AssertQuery( async, @@ -977,8 +888,7 @@ public virtual Task Concat_with_distinct_on_both_source_and_pruning(bool async) .Concat(ss.Set().Where(c => c.CustomerID.StartsWith("B")).Distinct()) .Select(x => x.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_concat_with_pruning(bool async) => AssertQuery( async, @@ -987,8 +897,7 @@ public virtual Task Nested_concat_with_pruning(bool async) .Concat(ss.Set().Where(c => c.CustomerID.StartsWith("A"))) .Select(x => x.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Nested_concat_with_distinct_in_the_middle_and_pruning(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/NorthwindStringIncludeQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindStringIncludeQueryTestBase.cs index 3a3856eb35e..febf94f09ca 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindStringIncludeQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindStringIncludeQueryTestBase.cs @@ -18,34 +18,30 @@ public abstract class NorthwindStringIncludeQueryTestBase(TFixture fix { private static readonly IncludeRewritingExpressionVisitor _includeRewritingExpressionVisitor = new(); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Include_non_existing_navigation(bool async) => Assert.Contains( CoreResources.LogInvalidIncludePath(new TestLogger()) .GenerateMessage("ArcticMonkeys", "ArcticMonkeys"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include("ArcticMonkeys")))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include("ArcticMonkeys")))).Message); public override async Task Include_property(bool async) => Assert.Contains( CoreResources.LogInvalidIncludePath(new TestLogger()) .GenerateMessage("OrderDate", "OrderDate"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(o => o.OrderDate)))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(o => o.OrderDate)))).Message); public override async Task Include_property_after_navigation(bool async) => Assert.Contains( CoreResources.LogInvalidIncludePath(new TestLogger()) .GenerateMessage("CustomerID", "Customer.CustomerID"), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Include(o => o.Customer.CustomerID)))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Include(o => o.Customer.CustomerID)))).Message); public override Task Include_property_expression_invalid(bool async) // Property expression cannot be converted to string include @@ -135,10 +131,9 @@ public override Task Filtered_include_with_multiple_ordering(bool async) public override async Task Include_specified_on_non_entity_not_supported(bool async) => Assert.Equal( CoreStrings.IncludeOnNonEntity("\"Item1.Orders\""), - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Select(c => new Tuple(c, 5)).Include(t => t.Item1.Orders)))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Select(c => new Tuple(c, 5)).Include(t => t.Item1.Orders)))).Message); protected override Expression RewriteServerQueryExpression(Expression serverQueryExpression) { @@ -152,37 +147,31 @@ private class IncludeRewritingExpressionVisitor : ExpressionVisitor private static readonly MethodInfo _includeMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo().GetDeclaredMethods(nameof(EntityFrameworkQueryableExtensions.Include)) - .Single( - mi => - mi.GetGenericArguments().Count() == 2 - && mi.GetParameters().Any( - pi => pi.Name == "navigationPropertyPath" && pi.ParameterType != typeof(string))); + .Single(mi => + mi.GetGenericArguments().Count() == 2 + && mi.GetParameters().Any(pi => pi.Name == "navigationPropertyPath" && pi.ParameterType != typeof(string))); private static readonly MethodInfo _stringIncludeMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo().GetDeclaredMethods(nameof(EntityFrameworkQueryableExtensions.Include)) - .Single( - mi => mi.GetParameters().Any( - pi => pi.Name == "navigationPropertyPath" && pi.ParameterType == typeof(string))); + .Single(mi => mi.GetParameters().Any(pi => pi.Name == "navigationPropertyPath" && pi.ParameterType == typeof(string))); private static readonly MethodInfo _thenIncludeAfterReferenceMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo().GetDeclaredMethods(nameof(EntityFrameworkQueryableExtensions.ThenInclude)) - .Single( - mi => mi.GetGenericArguments().Count() == 3 - && mi.GetParameters()[0].ParameterType.GenericTypeArguments[1].IsGenericParameter); + .Single(mi => mi.GetGenericArguments().Count() == 3 + && mi.GetParameters()[0].ParameterType.GenericTypeArguments[1].IsGenericParameter); private static readonly MethodInfo _thenIncludeAfterEnumerableMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo().GetDeclaredMethods(nameof(EntityFrameworkQueryableExtensions.ThenInclude)) .Where(mi => mi.GetGenericArguments().Count() == 3) - .Single( - mi => - { - var typeInfo = mi.GetParameters()[0].ParameterType.GenericTypeArguments[1]; - return typeInfo.IsGenericType - && typeInfo.GetGenericTypeDefinition() == typeof(IEnumerable<>); - }); + .Single(mi => + { + var typeInfo = mi.GetParameters()[0].ParameterType.GenericTypeArguments[1]; + return typeInfo.IsGenericType + && typeInfo.GetGenericTypeDefinition() == typeof(IEnumerable<>); + }); protected override Expression VisitMethodCall(MethodCallExpression methodCallExpression) { @@ -209,10 +198,9 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp return innerIncludeMethodCall.Update( innerIncludeMethodCall.Object, - new[] - { + [ innerIncludeMethodCall.Arguments[0], Expression.Constant($"{innerNavigationPath}.{currentNavigationpath}") - }); + ]); } } diff --git a/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs index a3256aa31b7..69c990d6845 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs @@ -20,8 +20,7 @@ protected virtual void ClearLog() { } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_simple(bool async) => AssertQuery( async, @@ -29,15 +28,13 @@ public virtual Task Where_simple(bool async) private static readonly Expression> _filter = o => o.CustomerID == "ALFKI"; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_as_queryable_expression(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.AsQueryable().Any(_filter))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_simple_closure(bool async) { var city = "London"; @@ -50,8 +47,7 @@ await AssertQuery( return context.Set().Where(c => c.City == city).ToQueryString(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_indexer_closure(bool async) { var cities = new[] { "London" }; @@ -61,8 +57,7 @@ public virtual Task Where_indexer_closure(bool async) ss => ss.Set().Where(c => c.City == cities[0])); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_dictionary_key_access_closure(bool async) { var predicateMap = new Dictionary { ["City"] = "London" }; @@ -72,8 +67,7 @@ public virtual Task Where_dictionary_key_access_closure(bool async) ss => ss.Set().Where(c => c.City == predicateMap["City"])); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_tuple_item_closure(bool async) { var predicateTuple = new Tuple("ALFKI", "London"); @@ -83,8 +77,7 @@ public virtual Task Where_tuple_item_closure(bool async) ss => ss.Set().Where(c => c.City == predicateTuple.Item2)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_named_tuple_item_closure(bool async) { (string CustomerID, string City) predicateTuple = ("ALFKI", "London"); @@ -94,8 +87,7 @@ public virtual Task Where_named_tuple_item_closure(bool async) ss => ss.Set().Where(c => c.City == predicateTuple.City)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_simple_closure_constant(bool async) { var predicate = true; @@ -105,8 +97,7 @@ public virtual Task Where_simple_closure_constant(bool async) ss => ss.Set().Where(c => predicate)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_simple_closure_via_query_cache(bool async) { var city = "London"; @@ -122,8 +113,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.City == city)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_method_call_nullable_type_closure_via_query_cache(bool async) { var city = new City { Int = 2 }; @@ -139,8 +129,7 @@ await AssertQuery( ss => ss.Set().Where(e => e.ReportsTo == city.Int)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_method_call_nullable_type_reverse_closure_via_query_cache(bool async) { var city = new City { NullableInt = 1 }; @@ -156,8 +145,7 @@ await AssertQuery( ss => ss.Set().Where(e => e.EmployeeID > city.NullableInt)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_method_call_closure_via_query_cache(bool async) { var city = new City { InstanceFieldValue = "London" }; @@ -173,8 +161,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.City == city.GetCity())); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_field_access_closure_via_query_cache(bool async) { var city = new City { InstanceFieldValue = "London" }; @@ -190,8 +177,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.City == city.InstanceFieldValue)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_property_access_closure_via_query_cache(bool async) { var city = new City { InstancePropertyValue = "London" }; @@ -207,8 +193,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.City == city.InstancePropertyValue)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_static_field_access_closure_via_query_cache(bool async) { City.StaticFieldValue = "London"; @@ -224,8 +209,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.City == City.StaticFieldValue)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_static_property_access_closure_via_query_cache(bool async) { City.StaticPropertyValue = "London"; @@ -241,8 +225,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.City == City.StaticPropertyValue)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_nested_field_access_closure_via_query_cache(bool async) { var city = new City { Nested = new City { InstanceFieldValue = "London" } }; @@ -258,8 +241,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.City == city.Nested.InstanceFieldValue)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_nested_property_access_closure_via_query_cache(bool async) { var city = new City { Nested = new City { InstancePropertyValue = "London" } }; @@ -275,60 +257,50 @@ await AssertQuery( ss => ss.Set().Where(c => c.City == city.Nested.InstancePropertyValue)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_nested_field_access_closure_via_query_cache_error_null(bool async) { var city = new City(); - return Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Where(c => c.City == city.Nested.InstanceFieldValue))); + return Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Where(c => c.City == city.Nested.InstanceFieldValue))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_nested_field_access_closure_via_query_cache_error_method_null(bool async) { var city = new City(); - return Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Where(c => c.City == city.Throw().InstanceFieldValue))); + return Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Where(c => c.City == city.Throw().InstanceFieldValue))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_new_instance_field_access_query_cache(bool async) { await AssertQuery( async, - ss => ss.Set().Where( - c => c.City == new City { InstanceFieldValue = "London" }.InstanceFieldValue)); + ss => ss.Set().Where(c => c.City == new City { InstanceFieldValue = "London" }.InstanceFieldValue)); await AssertQuery( async, - ss => ss.Set().Where( - c => c.City == new City { InstanceFieldValue = "Seattle" }.InstanceFieldValue)); + ss => ss.Set().Where(c => c.City == new City { InstanceFieldValue = "Seattle" }.InstanceFieldValue)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_new_instance_field_access_closure_via_query_cache(bool async) { var city = "London"; await AssertQuery( async, - ss => ss.Set().Where( - c => c.City == new City { InstanceFieldValue = city }.InstanceFieldValue)); + ss => ss.Set().Where(c => c.City == new City { InstanceFieldValue = city }.InstanceFieldValue)); city = "Seattle"; await AssertQuery( async, - ss => ss.Set().Where( - c => c.City == new City { InstanceFieldValue = city }.InstanceFieldValue)); + ss => ss.Set().Where(c => c.City == new City { InstanceFieldValue = city }.InstanceFieldValue)); } private class City @@ -352,8 +324,7 @@ public string GetCity() => InstanceFieldValue; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_simple_closure_via_query_cache_nullable_type(bool async) { int? reportsTo = 2; @@ -375,8 +346,7 @@ await AssertQuery( ss => ss.Set().Where(e => e.ReportsTo == reportsTo)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_simple_closure_via_query_cache_nullable_type_reverse(bool async) { int? reportsTo = null; @@ -398,8 +368,7 @@ await AssertQuery( ss => ss.Set().Where(e => e.ReportsTo == reportsTo)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_subquery_closure_via_query_cache(bool async) { using var context = CreateContext(); @@ -422,33 +391,28 @@ public virtual async Task Where_subquery_closure_via_query_cache(bool async) Assert.Equal("ANATR", result.Single().CustomerID); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_simple_shadow(bool async) => AssertQuery( async, ss => ss.Set().Where(e => EF.Property(e, "Title") == "Sales Representative")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_simple_shadow_projection(bool async) => AssertQuery( async, ss => ss.Set().Where(e => EF.Property(e, "Title") == "Sales Representative") .Select(e => EF.Property(e, "Title"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_simple_shadow_projection_mixed(bool async) => AssertQuery( async, ss => ss.Set().Where(e => EF.Property(e, "Title") == "Sales Representative") - .Select( - e => new { e, Title = EF.Property(e, "Title") }), + .Select(e => new { e, Title = EF.Property(e, "Title") }), e => e.e.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_simple_shadow_subquery(bool async) => AssertQuery( async, @@ -456,8 +420,7 @@ public virtual Task Where_simple_shadow_subquery(bool async) where EF.Property(e, "Title") == "Sales Representative" select e); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_shadow_subquery_FirstOrDefault(bool async) => AssertQuery( async, @@ -467,8 +430,7 @@ where EF.Property(e, "Title") ss.Set().OrderBy(e2 => EF.Property(e2, "Title")).FirstOrDefault(), "Title") select e); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_client(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -476,26 +438,22 @@ public virtual Task Where_client(bool async) ss => ss.Set().Where(c => c.IsLondon)), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_correlated(bool async) => AssertQuery( async, ss => ss.Set().Where(c1 => ss.Set().Any(c2 => c1.CustomerID == c2.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_correlated_client_eval(bool async) - => AssertTranslationFailed( - () => AssertQuery( - async, - ss => ss.Set() - .OrderBy(c1 => c1.CustomerID) - .Take(5) - .Where(c1 => ss.Set().Any(c2 => c1.CustomerID == c2.CustomerID && c2.IsLondon)))); + => AssertTranslationFailed(() => AssertQuery( + async, + ss => ss.Set() + .OrderBy(c1 => c1.CustomerID) + .Take(5) + .Where(c1 => ss.Set().Any(c2 => c1.CustomerID == c2.CustomerID && c2.IsLondon)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_client_and_server_top_level(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -503,8 +461,7 @@ public virtual Task Where_client_and_server_top_level(bool async) ss => ss.Set().Where(c => c.IsLondon && c.CustomerID != "AROUT")), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_client_or_server_top_level(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -512,8 +469,7 @@ public virtual Task Where_client_or_server_top_level(bool async) ss => ss.Set().Where(c => c.IsLondon || c.CustomerID == "ALFKI")), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_client_and_server_non_top_level(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -521,8 +477,7 @@ public virtual Task Where_client_and_server_non_top_level(bool async) ss => ss.Set().Where(c => c.CustomerID != "ALFKI" == (c.IsLondon && c.CustomerID != "AROUT"))), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_client_deep_inside_predicate_and_server_top_level(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -531,15 +486,13 @@ public virtual Task Where_client_deep_inside_predicate_and_server_top_level(bool .Where(c => c.CustomerID != "ALFKI" && (c.CustomerID == "MAUMAR" || (c.CustomerID != "AROUT" && c.IsLondon)))), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_equals_method_int(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.EmployeeID.Equals(1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_equals_using_object_overload_on_mismatched_types(bool async) { ulong longPrm = 1; @@ -550,8 +503,7 @@ public virtual Task Where_equals_using_object_overload_on_mismatched_types(bool assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_equals_using_int_overload_on_mismatched_types(bool async) { ushort shortPrm = 1; @@ -561,8 +513,7 @@ public virtual Task Where_equals_using_int_overload_on_mismatched_types(bool asy ss => ss.Set().Where(e => e.EmployeeID.Equals(shortPrm))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_equals_on_mismatched_types_nullable_int_long(bool async) { ulong longPrm = 2; @@ -578,8 +529,7 @@ await AssertQuery( assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_equals_on_mismatched_types_int_nullable_int(bool async) { uint intPrm = 2; @@ -593,8 +543,7 @@ await AssertQuery( ss => ss.Set().Where(e => intPrm.Equals(e.ReportsTo))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_equals_on_mismatched_types_nullable_long_nullable_int(bool async) { ulong? nullableLongPrm = 2; @@ -610,8 +559,7 @@ await AssertQuery( assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_equals_on_matched_nullable_int_types(bool async) { uint? nullableIntPrm = 2; @@ -625,8 +573,7 @@ await AssertQuery( ss => ss.Set().Where(e => e.ReportsTo.Equals(nullableIntPrm))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_equals_on_null_nullable_int_types(bool async) { uint? nullableIntPrm = null; @@ -642,80 +589,69 @@ await AssertQuery( ss => ss.Set().Where(e => e.ReportsTo == nullableIntPrm)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_comparison_nullable_type_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.ReportsTo == 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_comparison_nullable_type_null(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.ReportsTo == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_simple_reversed(bool async) => AssertQuery( async, ss => ss.Set().Where(c => "London" == c.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_is_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Region == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_null_is_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => null == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_constant_is_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => "foo" == null), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_is_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.City != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_null_is_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => null != null), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_constant_is_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => "foo" != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_identity_comparison(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.City == c.City)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_in_optimization_multiple(bool async) => AssertQuery( async, @@ -729,8 +665,7 @@ from e in ss.Set() select new { c, e }, e => e.c.CustomerID + " " + e.e.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_not_in_optimization1(bool async) => AssertQuery( async, @@ -742,8 +677,7 @@ from e in ss.Set() select new { c, e }, e => e.c.CustomerID + " " + e.e.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_not_in_optimization2(bool async) => AssertQuery( async, @@ -755,8 +689,7 @@ from e in ss.Set() select new { c, e }, e => e.c.CustomerID + " " + e.e.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_not_in_optimization3(bool async) => AssertQuery( async, @@ -769,8 +702,7 @@ from e in ss.Set() select new { c, e }, e => e.c.CustomerID + " " + e.e.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_not_in_optimization4(bool async) => AssertQuery( async, @@ -784,8 +716,7 @@ from e in ss.Set() select new { c, e }, e => e.c.CustomerID + " " + e.e.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_select_many_and(bool async) { return AssertQuery( @@ -802,44 +733,38 @@ from e in ss.Set() e => e.c.CustomerID + " " + e.e.EmployeeID); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_primitive(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(e => e.EmployeeID).Take(9).Where(i => i == 5)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_primitive_tracked(bool async) => AssertQuery( async, ss => ss.Set().Take(9).Where(e => e.EmployeeID == 5)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_primitive_tracked2(bool async) => AssertQuery( async, ss => ss.Set().Take(9).Select(e => new { e }).Where(e => e.e.EmployeeID == 5), e => e.e.EmployeeID); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_member(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Discontinued)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_member_false(bool async) => AssertQuery( async, ss => ss.Set().Where(p => !p.Discontinued)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_client_side_negated(bool async) => AssertQuery( async, @@ -852,8 +777,7 @@ private static bool ClientFunc(int id) return false; } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_member_negated_twice(bool async) { return AssertQuery( @@ -865,64 +789,55 @@ public virtual Task Where_bool_member_negated_twice(bool async) #pragma warning restore RCS1068 // Simplify logical negation. } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_member_shadow(bool async) => AssertQuery( async, ss => ss.Set().Where(p => EF.Property(p, "Discontinued"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_member_false_shadow(bool async) => AssertQuery( async, ss => ss.Set().Where(p => !EF.Property(p, "Discontinued"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_member_equals_constant(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Discontinued.Equals(true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_member_in_complex_predicate(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.ProductID > 100 && p.Discontinued || (p.Discontinued == true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_member_compared_to_binary_expression(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Discontinued == (p.ProductID > 50))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_not_bool_member_compared_to_not_bool_member(bool async) => AssertQuery( async, ss => ss.Set().Where(p => !p.Discontinued == !p.Discontinued)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_negated_boolean_expression_compared_to_another_negated_boolean_expression(bool async) => AssertQuery( async, ss => ss.Set().Where(p => !(p.ProductID > 50) == !(p.ProductID > 20))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_not_bool_member_compared_to_binary_expression(bool async) => AssertQuery( async, ss => ss.Set().Where(p => !p.Discontinued == (p.ProductID > 50))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_parameter(bool async) { var prm = true; @@ -932,8 +847,7 @@ public virtual Task Where_bool_parameter(bool async) ss => ss.Set().Where(p => prm)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_parameter_compared_to_binary_expression(bool async) { var prm = true; @@ -943,8 +857,7 @@ public virtual Task Where_bool_parameter_compared_to_binary_expression(bool asyn ss => ss.Set().Where(p => (p.ProductID > 50) != prm)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_bool_member_and_parameter_compared_to_binary_expression_nested(bool async) { var prm = true; @@ -954,58 +867,50 @@ public virtual Task Where_bool_member_and_parameter_compared_to_binary_expressio ss => ss.Set().Where(p => p.Discontinued == ((p.ProductID > 50) != prm))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_de_morgan_or_optimized(bool async) => AssertQuery( async, ss => ss.Set().Where(p => !(p.Discontinued || (p.ProductID < 20)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_de_morgan_and_optimized(bool async) => AssertQuery( async, ss => ss.Set().Where(p => !(p.Discontinued && (p.ProductID < 20)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_complex_negated_expression_optimized(bool async) => AssertQuery( async, ss => ss.Set().Where(p => !(!(!p.Discontinued && (p.ProductID < 60)) || !(p.ProductID > 30)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_short_member_comparison(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.UnitsInStock > 10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_comparison_to_nullable_bool(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID.EndsWith("KI") == ((bool?)true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_true(bool async) => AssertQuery( async, ss => ss.Set().Where(c => true)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_false(bool async) => AssertQuery( async, ss => ss.Set().Where(c => false), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_bool_closure(bool async) { var boolean = false; @@ -1030,8 +935,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.CustomerID == "ALFKI" || boolean)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_poco_closure(bool async) { var customer = new Customer { CustomerID = "ALFKI" }; @@ -1047,8 +951,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.Equals(customer)).Select(c => c.CustomerID)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_default(bool async) { var parameter = Expression.Parameter(typeof(Customer), "c"); @@ -1067,8 +970,7 @@ public virtual Task Where_default(bool async) ss => ss.Set().Where(defaultExpression)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_expression_invoke_1(bool async) { Expression> expression = c => c.CustomerID == "ALFKI"; @@ -1080,8 +982,7 @@ public virtual Task Where_expression_invoke_1(bool async) Expression.Lambda>(Expression.Invoke(expression, parameter), parameter))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_expression_invoke_2(bool async) { Expression> customer = o => o.Customer; @@ -1095,8 +996,7 @@ public virtual Task Where_expression_invoke_2(bool async) ss => ss.Set().Where(exp)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_expression_invoke_3(bool async) { Expression> lambda3 = c => c.CustomerID == "ALFKI"; @@ -1114,8 +1014,7 @@ public virtual Task Where_expression_invoke_3(bool async) ss => ss.Set().Where(lambda)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_ternary_boolean_condition_true(bool async) { var flag = true; @@ -1125,8 +1024,7 @@ public virtual Task Where_ternary_boolean_condition_true(bool async) ss => ss.Set().Where(p => flag ? p.UnitsInStock >= 20 : p.UnitsInStock < 20)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_ternary_boolean_condition_false(bool async) { var flag = false; @@ -1136,8 +1034,7 @@ public virtual Task Where_ternary_boolean_condition_false(bool async) ss => ss.Set().Where(p => flag ? p.UnitsInStock >= 20 : p.UnitsInStock < 20)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_ternary_boolean_condition_with_another_condition(bool async) { var flag = true; @@ -1148,8 +1045,7 @@ public virtual Task Where_ternary_boolean_condition_with_another_condition(bool ss => ss.Set().Where(p => p.ProductID < productId && (flag ? p.UnitsInStock >= 20 : p.UnitsInStock < 20))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_ternary_boolean_condition_with_false_as_result_true(bool async) { var flag = true; @@ -1159,8 +1055,7 @@ public virtual Task Where_ternary_boolean_condition_with_false_as_result_true(bo ss => ss.Set().Where(p => flag ? p.UnitsInStock >= 20 : false)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_ternary_boolean_condition_with_false_as_result_false(bool async) { var flag = false; @@ -1171,127 +1066,107 @@ public virtual Task Where_ternary_boolean_condition_with_false_as_result_false(b assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_ternary_boolean_condition_negated(bool async) => AssertQuery( async, ss => ss.Set().Where(p => !(p.UnitsInStock >= 20 ? false : true))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_constructed_equal(bool async) => AssertQuery( async, ss => ss.Set().Where(c => new { x = c.City } == new { x = "London" }), ss => ss.Set().Where(c => c.City == "London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_constructed_multi_value_equal(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new { x = c.City, y = c.Country } == new { x = "London", y = "UK" }), + ss => ss.Set().Where(c => new { x = c.City, y = c.Country } == new { x = "London", y = "UK" }), ss => ss.Set().Where(c => c.City == "London" && c.Country == "UK")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_constructed_multi_value_not_equal(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new { x = c.City, y = c.Country } != new { x = "London", y = "UK" })); + ss => ss.Set().Where(c => new { x = c.City, y = c.Country } != new { x = "London", y = "UK" })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_tuple_constructed_equal(bool async) => AssertQuery( async, ss => ss.Set().Where(c => new Tuple(c.City) == new Tuple("London")), ss => ss.Set().Where(c => c.City == "London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_tuple_constructed_multi_value_equal(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new Tuple(c.City, c.Country) == new Tuple("London", "UK")), + ss => ss.Set().Where(c => new Tuple(c.City, c.Country) == new Tuple("London", "UK")), ss => ss.Set().Where(c => c.City == "London" && c.Country == "UK")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_tuple_constructed_multi_value_not_equal(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new Tuple(c.City, c.Country) != new Tuple("London", "UK")), + ss => ss.Set().Where(c => new Tuple(c.City, c.Country) != new Tuple("London", "UK")), ss => ss.Set().Where(c => c.City != "London" || c.Country != "UK")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_tuple_create_constructed_equal(bool async) => AssertQuery( async, ss => ss.Set().Where(c => Tuple.Create(c.City) == Tuple.Create("London")), ss => ss.Set().Where(c => c.City == "London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_tuple_create_constructed_multi_value_equal(bool async) => AssertQuery( async, ss => ss.Set().Where(c => Tuple.Create(c.City, c.Country) == Tuple.Create("London", "UK")), ss => ss.Set().Where(c => c.City == "London" && c.Country == "UK")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_tuple_create_constructed_multi_value_not_equal(bool async) => AssertQuery( async, ss => ss.Set().Where(c => Tuple.Create(c.City, c.Country) != Tuple.Create("London", "UK")), ss => ss.Set().Where(c => c.City != "London" || c.Country != "UK")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Region == null && c.Country == "UK")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_null_with_cast_to_object(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Region == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_compare_with_both_cast_to_object(bool async) => AssertQuery( async, // ReSharper disable twice RedundantCast ss => ss.Set().Where(c => (object)c.City == (object)"London")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_projection(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.City == "London").Select(c => c.CompanyName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Is_on_same_type(bool async) => AssertQuery( async, // ReSharper disable once ConvertTypeCheckToNullCheck ss => ss.Set().Where(c => c is Customer)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_chain(bool async) => AssertQuery( async, @@ -1299,8 +1174,7 @@ public virtual Task Where_chain(bool async) .Where(o => o.CustomerID == "QUICK") .Where(o => o.OrderDate > new DateTime(1998, 1, 1))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Where_navigation_contains(bool async) { using var context = CreateContext(); @@ -1312,8 +1186,7 @@ public virtual async Task Where_navigation_contains(bool async) Assert.Equal(12, result.Count); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_array_index(bool async) { var customers = new[] { "ALFKI", "ANATR" }; @@ -1323,50 +1196,42 @@ public virtual Task Where_array_index(bool async) ss => ss.Set().Where(c => c.CustomerID == customers[0])); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_multiple_contains_in_subquery_with_or(bool async) => AssertQuery( async, - ss => ss.Set().Where( - od => ss.Set().OrderBy(p => p.ProductID).Take(1).Select(p => p.ProductID).Contains(od.ProductID) - || ss.Set().OrderBy(o => o.OrderID).Take(1).Select(o => o.OrderID).Contains(od.OrderID))); + ss => ss.Set().Where(od + => ss.Set().OrderBy(p => p.ProductID).Take(1).Select(p => p.ProductID).Contains(od.ProductID) + || ss.Set().OrderBy(o => o.OrderID).Take(1).Select(o => o.OrderID).Contains(od.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_multiple_contains_in_subquery_with_and(bool async) => AssertQuery( async, - ss => ss.Set().Where( - od => ss.Set().OrderBy(p => p.ProductID).Take(20).Select(p => p.ProductID).Contains(od.ProductID) - && ss.Set().OrderBy(o => o.OrderID).Take(10).Select(o => o.OrderID).Contains(od.OrderID))); + ss => ss.Set().Where(od + => ss.Set().OrderBy(p => p.ProductID).Take(20).Select(p => p.ProductID).Contains(od.ProductID) + && ss.Set().OrderBy(o => o.OrderID).Take(10).Select(o => o.OrderID).Contains(od.OrderID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_contains_on_navigation(bool async) => AssertQuery( async, ss => ss.Set().Where(o => ss.Set().Any(c => c.Orders.Contains(o)))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_FirstOrDefault_is_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_subquery_FirstOrDefault_compared_to_entity(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault() == new Order { OrderID = 10276 }), - ss => ss.Set().Where( - c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault().OrderID == 10276)); + ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault() == new Order { OrderID = 10276 }), + ss => ss.Set().Where(c => c.Orders.OrderBy(o => o.OrderID).FirstOrDefault().OrderID == 10276)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task TypeBinary_short_circuit(bool async) { var customer = new Customer(); @@ -1379,8 +1244,7 @@ public virtual Task TypeBinary_short_circuit(bool async) assertEmpty: true); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Decimal_cast_to_double_works(bool async) { var customer = new Customer(); @@ -1390,8 +1254,7 @@ public virtual Task Decimal_cast_to_double_works(bool async) ss => ss.Set().Where(p => (double?)p.UnitPrice > 100)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_is_conditional(bool async) => AssertQuery( async, @@ -1400,8 +1263,7 @@ public virtual Task Where_is_conditional(bool async) ss => ss.Set().Where(p => p is Product ? false : true), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Enclosing_class_settable_member_generates_parameter(bool async) { SettableProperty = 10274; @@ -1417,22 +1279,19 @@ await AssertQuery( ss => ss.Set().Where(o => o.OrderID == SettableProperty)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Enclosing_class_readonly_member_generates_parameter(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.OrderID == ReadOnlyProperty)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Enclosing_class_const_member_does_not_generate_parameter(bool async) => AssertQuery( async, ss => ss.Set().Where(o => o.OrderID == ConstantProperty)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Generic_Ilist_contains_translates_to_server(bool async) { var cities = new List { "Seattle" } as IList; @@ -1449,18 +1308,16 @@ private int ReadOnlyProperty private const int ConstantProperty = 10274; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_non_nullable_value_after_FirstOrDefault_on_empty_collection(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => ss.Set().Where(o => o.CustomerID == "John Doe").Select(o => o.CustomerID).FirstOrDefault().Length == 0), + ss => ss.Set().Where(c + => ss.Set().Where(o => o.CustomerID == "John Doe").Select(o => o.CustomerID).FirstOrDefault().Length == 0), ss => ss.Set().Where(c => false), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Using_same_parameter_twice_in_query_generates_one_sql_parameter(bool async) { var i = 10; @@ -1470,8 +1327,7 @@ public virtual Task Using_same_parameter_twice_in_query_generates_one_sql_parame .Select(c => c.CustomerID)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Two_parameters_with_same_name_get_uniquified(bool async) { var i = 10; @@ -1483,8 +1339,7 @@ public virtual Task Two_parameters_with_same_name_get_uniquified(bool async) ss => ss.Set().Where(c => (c.CustomerID + (i + 1)) + (c.CustomerID + (i + 2)) == "ALFKI11ALFKI12")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Queryable_ToList_Count(bool async) => AssertQuery( async, @@ -1494,8 +1349,7 @@ public virtual Task Where_Queryable_ToList_Count(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Queryable_ToList_Contains(bool async) => AssertQuery( async, @@ -1503,8 +1357,7 @@ public virtual Task Where_Queryable_ToList_Contains(bool async) .Select(c => ss.Set().Where(o => o.CustomerID == c.CustomerID).Select(o => o.CustomerID).ToList()) .Where(e => e.Contains("ALFKI"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Queryable_ToArray_Count(bool async) => AssertQuery( async, @@ -1514,8 +1367,7 @@ public virtual Task Where_Queryable_ToArray_Count(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Queryable_ToArray_Contains(bool async) => AssertQuery( async, @@ -1523,8 +1375,7 @@ public virtual Task Where_Queryable_ToArray_Contains(bool async) .Select(c => ss.Set().Where(o => o.CustomerID == c.CustomerID).Select(o => o.CustomerID).ToArray()) .Where(e => e.Contains("ALFKI"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Queryable_AsEnumerable_Count(bool async) => AssertQuery( async, @@ -1534,8 +1385,7 @@ public virtual Task Where_Queryable_AsEnumerable_Count(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Queryable_AsEnumerable_Contains(bool async) => AssertQuery( async, @@ -1543,24 +1393,21 @@ public virtual Task Where_Queryable_AsEnumerable_Contains(bool async) .Select(c => ss.Set().Where(o => o.CustomerID == c.CustomerID).Select(o => o.CustomerID).AsEnumerable()) .Where(e => e.Contains("ALFKI"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Queryable_AsEnumerable_Contains_negated(bool async) => AssertQuery( async, ss => ss.Set() - .Select( - c => new - { - c.CustomerID, - Subquery = ss.Set().Where(o => o.CustomerID == c.CustomerID).Select(o => o.CustomerID).AsEnumerable() - }) + .Select(c => new + { + c.CustomerID, + Subquery = ss.Set().Where(o => o.CustomerID == c.CustomerID).Select(o => o.CustomerID).AsEnumerable() + }) .Where(e => !e.Subquery.Contains("ALFKI")), elementSorter: e => e.CustomerID, elementAsserter: (e, a) => AssertCollection(e.Subquery, a.Subquery)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Queryable_ToList_Count_member(bool async) => AssertQuery( async, @@ -1570,8 +1417,7 @@ public virtual Task Where_Queryable_ToList_Count_member(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Queryable_ToArray_Length_member(bool async) => AssertQuery( async, @@ -1581,8 +1427,7 @@ public virtual Task Where_Queryable_ToArray_Length_member(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_ToList_Count(bool async) => AssertQuery( async, @@ -1594,8 +1439,7 @@ public virtual Task Where_collection_navigation_ToList_Count(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_ToList_Contains(bool async) { var order = new Order { OrderID = 10248 }; @@ -1607,8 +1451,7 @@ public virtual Task Where_collection_navigation_ToList_Contains(bool async) .Where(e => e.Contains(order))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_ToArray_Count(bool async) => AssertQuery( async, @@ -1620,8 +1463,7 @@ public virtual Task Where_collection_navigation_ToArray_Count(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_ToArray_Contains(bool async) { var order = new Order { OrderID = 10248 }; @@ -1633,8 +1475,7 @@ public virtual Task Where_collection_navigation_ToArray_Contains(bool async) .Where(e => e.Contains(order))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_AsEnumerable_Count(bool async) => AssertQuery( async, @@ -1646,8 +1487,7 @@ public virtual Task Where_collection_navigation_AsEnumerable_Count(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_AsEnumerable_Contains(bool async) { var order = new Order { OrderID = 10248 }; @@ -1659,8 +1499,7 @@ public virtual Task Where_collection_navigation_AsEnumerable_Contains(bool async .Where(e => e.Contains(order))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_ToList_Count_member(bool async) => AssertQuery( async, @@ -1672,8 +1511,7 @@ public virtual Task Where_collection_navigation_ToList_Count_member(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_ToArray_Length_member(bool async) => AssertQuery( async, @@ -1685,8 +1523,7 @@ public virtual Task Where_collection_navigation_ToArray_Length_member(bool async assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_list_object_contains_over_value_type(bool async) { var orderIds = new List { 10248, 10249 }; @@ -1696,8 +1533,7 @@ public virtual Task Where_list_object_contains_over_value_type(bool async) .Where(o => orderIds.Contains(o.OrderID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_array_of_object_contains_over_value_type(bool async) { var orderIds = new object[] { 10248, 10249 }; @@ -1707,54 +1543,47 @@ public virtual Task Where_array_of_object_contains_over_value_type(bool async) .Where(o => orderIds.Contains(o.OrderID))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_OrElse_on_same_column_converted_to_in_with_overlap(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => c.CustomerID == "ALFKI" || c.CustomerID == "ANATR" || c.CustomerID == "ANTON" || c.CustomerID == "ANATR")); + ss => ss.Set().Where(c + => c.CustomerID == "ALFKI" || c.CustomerID == "ANATR" || c.CustomerID == "ANTON" || c.CustomerID == "ANATR")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_OrElse_on_same_column_with_null_constant_comparison_converted_to_in(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Region == "WA" || c.Region == "OR" || c.Region == null || c.Region == "BC")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Constant_array_Contains_OrElse_comparison_with_constant_gets_combined_to_one_in(bool async) => AssertQuery( async, ss => ss.Set().Where(c => new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) || c.CustomerID == "ANTON")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Constant_array_Contains_OrElse_comparison_with_constant_gets_combined_to_one_in_with_overlap(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => c.CustomerID == "ANTON" || new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) || c.CustomerID == "ALFKI")); + ss => ss.Set().Where(c + => c.CustomerID == "ANTON" || new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) || c.CustomerID == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Constant_array_Contains_OrElse_another_Contains_gets_combined_to_one_in_with_overlap(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) || new[] { "ALFKI", "ANTON" }.Contains(c.CustomerID))); + ss => ss.Set().Where(c + => new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) || new[] { "ALFKI", "ANTON" }.Contains(c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Constant_array_Contains_AndAlso_another_Contains_gets_combined_to_one_in_with_overlap(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => !new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) && !new[] { "ALFKI", "ANTON" }.Contains(c.CustomerID))); + ss => ss.Set().Where(c + => !new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) && !new[] { "ALFKI", "ANTON" }.Contains(c.CustomerID))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_AndAlso_on_same_column_converted_to_in_using_parameters(bool async) { var (prm1, prm2, prm3) = ("ALFKI", "ANATR", "ANTON"); @@ -1764,8 +1593,7 @@ public virtual Task Multiple_AndAlso_on_same_column_converted_to_in_using_parame ss => ss.Set().Where(c => c.CustomerID != prm1 && c.CustomerID != prm2 && c.CustomerID != prm3)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Array_of_parameters_Contains_OrElse_comparison_with_constant_gets_combined_to_one_in(bool async) { var (prm1, prm2) = ("ALFKI", "ANATR"); @@ -1775,8 +1603,7 @@ public virtual Task Array_of_parameters_Contains_OrElse_comparison_with_constant ss => ss.Set().Where(c => new[] { prm1, prm2 }.Contains(c.CustomerID) || c.CustomerID == "ANTON")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Multiple_OrElse_on_same_column_with_null_parameter_comparison_converted_to_in(bool async) { string prm = null; @@ -1786,8 +1613,7 @@ public virtual Task Multiple_OrElse_on_same_column_with_null_parameter_compariso ss => ss.Set().Where(c => c.Region == "WA" || c.Region == "OR" || c.Region == prm || c.Region == "BC")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Parameter_array_Contains_OrElse_comparison_with_constant(bool async) { var array = new[] { "ALFKI", "ANATR" }; @@ -1797,8 +1623,7 @@ public virtual Task Parameter_array_Contains_OrElse_comparison_with_constant(boo ss => ss.Set().Where(c => array.Contains(c.CustomerID) || c.CustomerID == "ANTON")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Parameter_array_Contains_OrElse_comparison_with_parameter_with_overlap(bool async) { var array = new[] { "ALFKI", "ANATR" }; @@ -1810,31 +1635,27 @@ public virtual Task Parameter_array_Contains_OrElse_comparison_with_parameter_wi ss => ss.Set().Where(c => c.CustomerID == prm1 || array.Contains(c.CustomerID) || c.CustomerID == prm2)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Two_sets_of_comparison_combine_correctly(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) && (c.CustomerID == "ANATR" || c.CustomerID == "ANTON"))); + ss => ss.Set().Where(c + => new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) && (c.CustomerID == "ANATR" || c.CustomerID == "ANTON"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Two_sets_of_comparison_combine_correctly2(bool async) => AssertQuery( async, - ss => ss.Set().Where( - c => (c.Region != "WA" && c.Region != "OR" && c.Region != null) || (c.Region != "WA" && c.Region != null))); + ss => ss.Set().Where(c + => (c.Region != "WA" && c.Region != "OR" && c.Region != null) || (c.Region != "WA" && c.Region != null))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_with_property_compared_to_null_wrapped_in_explicit_convert_to_object(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Region == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_with_EF_Property_using_closure_for_property_name(bool async) { var id = "CustomerID"; @@ -1844,129 +1665,112 @@ public virtual Task Filter_with_EF_Property_using_closure_for_property_name(bool ss => ss.Set().Where(c => EF.Property(c, id) == "ALFKI")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_with_EF_Property_using_function_for_property_name(bool async) => AssertQuery( async, ss => ss.Set().Where(c => EF.Property(c, StringMethod("CustomerID")) == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_over_scalar_projection_compared_to_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => (int?)o.OrderID).FirstOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_over_scalar_projection_compared_to_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => (int?)o.OrderID).FirstOrDefault() != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_over_custom_projection_compared_to_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).FirstOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_over_custom_projection_compared_to_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).FirstOrDefault() != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SingleOrDefault_over_custom_projection_compared_to_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).SingleOrDefault() == null), ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).FirstOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SingleOrDefault_over_custom_projection_compared_to_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).SingleOrDefault() != null), ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).FirstOrDefault() != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LastOrDefault_over_custom_projection_compared_to_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).LastOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LastOrDefault_over_custom_projection_compared_to_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).LastOrDefault() != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task First_over_custom_projection_compared_to_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).First() == null), ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).FirstOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task First_over_custom_projection_compared_to_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).First() != null), ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).FirstOrDefault() != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ElementAt_over_custom_projection_compared_to_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).ElementAt(3) != null), ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).ElementAtOrDefault(3) != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ElementAtOrDefault_over_custom_projection_compared_to_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).ElementAtOrDefault(7) == null), ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).ElementAtOrDefault(7) == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Single_over_custom_projection_compared_to_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).Single() == null), ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).FirstOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Single_over_custom_projection_compared_to_not_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).Single() != null), ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).FirstOrDefault() != null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Last_over_custom_projection_compared_to_null(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).Last() == null), ss => ss.Set().Where(c => c.Orders.Select(o => new { o.OrderID }).LastOrDefault() == null)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Last_over_custom_projection_compared_to_not_null(bool async) => AssertQuery( async, @@ -1976,8 +1780,7 @@ public virtual Task Last_over_custom_projection_compared_to_not_null(bool async) private string StringMethod(string arg) => arg; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Contains_and_comparison(bool async) { var customerIds = new[] { "ALFKI", "FISSA", "WHITC" }; @@ -1987,8 +1790,7 @@ public virtual Task Where_Contains_and_comparison(bool async) ss => ss.Set().Where(c => customerIds.Contains(c.CustomerID) && c.City == "Seattle")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_Contains_or_comparison(bool async) { var customerIds = new[] { "ALFKI", "FISSA" }; @@ -1997,38 +1799,33 @@ public virtual Task Where_Contains_or_comparison(bool async) ss => ss.Set().Where(c => customerIds.Contains(c.CustomerID) || c.City == "Seattle")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_on_non_hierarchy1(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.GetType() == typeof(Customer))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_on_non_hierarchy2(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.GetType() != typeof(Customer)), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_on_non_hierarchy3(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.GetType() == typeof(Order)), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetType_on_non_hierarchy4(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.GetType() != typeof(Order))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Case_block_simplification_works_correctly(bool async) #pragma warning disable IDE0029 // Use coalesce expression => AssertQuery( @@ -2036,8 +1833,7 @@ public virtual Task Case_block_simplification_works_correctly(bool async) ss => ss.Set().Where(c => (c.Region == null ? "OR" : c.Region) == "OR")); #pragma warning restore IDE0029 // Use coalesce expression - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EF_Constant(bool async) { var id = "ALFKI"; @@ -2048,8 +1844,7 @@ public virtual Task EF_Constant(bool async) ss => ss.Set().Where(c => c.CustomerID == "ALFKI")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EF_Constant_with_subtree(bool async) { var i = "ALF"; @@ -2061,8 +1856,7 @@ public virtual Task EF_Constant_with_subtree(bool async) ss => ss.Set().Where(c => c.CustomerID == "ALFKI")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EF_Constant_does_not_parameterized_as_part_of_bigger_subtree(bool async) { var id = "ALF"; @@ -2073,28 +1867,24 @@ public virtual Task EF_Constant_does_not_parameterized_as_part_of_bigger_subtree ss => ss.Set().Where(c => c.CustomerID == "ALF" + "KI")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task EF_Constant_with_non_evaluatable_argument_throws(bool async) { - var exception = await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Where(c => c.CustomerID == EF.Constant(c.CustomerID)))); + var exception = await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Where(c => c.CustomerID == EF.Constant(c.CustomerID)))); Assert.Equal(CoreStrings.EFMethodWithNonEvaluatableArgument("EF.Constant"), exception.Message); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EF_Parameter(bool async) => AssertQuery( async, ss => ss.Set().Where(c => c.CustomerID == EF.Parameter("ALFKI")), ss => ss.Set().Where(c => c.CustomerID == "ALFKI")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EF_Parameter_with_subtree(bool async) { // This is a somewhat silly scenario: a subtree would get parameterized anyway, with or without EF.Parameter(). @@ -2108,8 +1898,7 @@ public virtual Task EF_Parameter_with_subtree(bool async) ss => ss.Set().Where(c => c.CustomerID == "ALFKI")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EF_Parameter_does_not_parameterized_as_part_of_bigger_subtree(bool async) { var id = "ALF"; @@ -2120,14 +1909,12 @@ public virtual Task EF_Parameter_does_not_parameterized_as_part_of_bigger_subtre ss => ss.Set().Where(c => c.CustomerID == "ALF" + "KI")); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task EF_Parameter_with_non_evaluatable_argument_throws(bool async) { - var exception = await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Where(c => c.CustomerID == EF.Parameter(c.CustomerID)))); + var exception = await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Where(c => c.CustomerID == EF.Parameter(c.CustomerID)))); Assert.Equal(CoreStrings.EFMethodWithNonEvaluatableArgument("EF.Parameter"), exception.Message); } @@ -2149,8 +1936,7 @@ public EntityWithImplicitCast Clone() => new(_value); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Implicit_cast_in_predicate(bool async) { await AssertQuery( @@ -2195,8 +1981,7 @@ public static IQueryable AddFilter(IQueryable query, int id) where T : IHaveId => query.Where(a => a.Id == id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Interface_casting_though_generic_method(bool async) { await AssertQuery( @@ -2220,8 +2005,7 @@ await AssertQuery( elementAsserter: (e, a) => AssertEqual(e.Id, a.Id)); } - [ConditionalTheory] // #35095 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // #35095 public virtual Task Simplifiable_coalesce_over_nullable(bool async) { int? orderId = 10248; @@ -2233,22 +2017,19 @@ public virtual Task Simplifiable_coalesce_over_nullable(bool async) #region Evaluation order of operators - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_and_Where_evaluation_order(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(e => e.EmployeeID).Take(3).Where(e => e.EmployeeID % 2 == 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_and_Where_evaluation_order(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(e => e.EmployeeID).Skip(3).Where(e => e.EmployeeID % 2 == 0)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Take_and_Distinct_evaluation_order(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/NullKeysTestBase.cs b/test/EFCore.Specification.Tests/Query/NullKeysTestBase.cs index a40d3dfc365..0312f9acdac 100644 --- a/test/EFCore.Specification.Tests/Query/NullKeysTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NullKeysTestBase.cs @@ -33,11 +33,11 @@ public virtual void Include_with_null_FKs_and_nullable_PK() results.Select(e => e.Fk).ToArray()); Assert.Equal( - new WithStringKey[] { null, null }, + [null, null], results.Take(2).Select(e => e.Principal)); Assert.Equal( - new[] { "Empire", "Fire", "Stereo", "Stereo" }, + ["Empire", "Fire", "Stereo", "Stereo"], results.Skip(2).Select(e => e.Principal.Id)); } @@ -77,7 +77,7 @@ public virtual void Include_with_null_fKs_and_non_nullable_PK() results.Select(e => e.Id).ToArray()); Assert.Equal( - new int?[] { null, 1, null, 2, null, null }, + [null, 1, null, 2, null, null], results.Select(e => e.Fk)); Assert.Null(results[0].Principal); @@ -98,11 +98,11 @@ public virtual void Include_with_null_fKs_and_nullable_PK() .ToList(); Assert.Equal( - new[] { 1, 2, 3, 4, 5, 6 }, + [1, 2, 3, 4, 5, 6], results.Select(e => e.Id)); Assert.Equal( - new int?[] { null, 1, null, 2, null, null }, + [null, 1, null, 2, null, null], results.Select(e => e.Fk)); Assert.Null(results[0].Principal); @@ -217,32 +217,29 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .WithOne(e => e.Self) .HasForeignKey(e => e.SelfFk); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.HasMany(e => e.Dependents) - .WithOne(e => e.Principal) - .HasForeignKey(e => e.Fk); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.HasMany(e => e.Dependents) - .WithOne(e => e.Principal) - .HasForeignKey(e => e.Fk); - }); - - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.HasMany(e => e.Dependents) - .WithOne(e => e.Principal) - .HasForeignKey(e => e.Fk); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.HasMany(e => e.Dependents) + .WithOne(e => e.Principal) + .HasForeignKey(e => e.Fk); + }); + + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.HasMany(e => e.Dependents) + .WithOne(e => e.Principal) + .HasForeignKey(e => e.Fk); + }); + + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.HasMany(e => e.Dependents) + .WithOne(e => e.Principal) + .HasForeignKey(e => e.Fk); + }); modelBuilder.Entity() .Property(e => e.Id).ValueGeneratedNever(); diff --git a/test/EFCore.Specification.Tests/Query/OwnedEntityQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/OwnedEntityQueryTestBase.cs index 79fd107759d..e78ba572820 100644 --- a/test/EFCore.Specification.Tests/Query/OwnedEntityQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/OwnedEntityQueryTestBase.cs @@ -157,17 +157,15 @@ public virtual async Task Correlated_subquery_with_owned_navigation_being_compar using (var context = contextFactory.CreateContext()) { var partners = context.Partners - .Select( - x => new + .Select(x => new + { + Addresses = x.Addresses.Select(y => new { - Addresses = x.Addresses.Select( - y => new - { - Turnovers = y.Turnovers == null - ? null - : new { y.Turnovers.AmountIn } - }).ToList() - }).ToList(); + Turnovers = y.Turnovers == null + ? null + : new { y.Turnovers.AmountIn } + }).ToList() + }).ToList(); Assert.Single(partners); Assert.Collection( @@ -243,54 +241,53 @@ public virtual async Task Owned_entity_multiple_level_in_aggregate() protected class Context14911(DbContextOptions options) : DbContext(options) { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - builder => - { - builder.HasKey(e => e.Id); - builder.OwnsOne( - e => e.FirstValueObject, dr => - { - dr.OwnsMany( - d => d.SecondValueObjects, c => - { - c.Property("Id").IsRequired(); - c.HasKey("Id"); - c.OwnsOne( - b => b.FourthValueObject, b => - { - b.OwnsMany( - t => t.FifthValueObjects, sp => - { - sp.Property("Id").IsRequired(); - sp.HasKey("Id"); - sp.Property(e => e.AnyValue).IsRequired(); - sp.WithOwner().HasForeignKey("SecondValueObjectId"); - }); - }); - c.OwnsMany( - b => b.ThirdValueObjects, b => - { - b.Property("Id").IsRequired(); - b.HasKey("Id"); - - b.OwnsOne( - d => d.FourthValueObject, dpd => - { - dpd.OwnsMany( - d => d.FifthValueObjects, sp => - { - sp.Property("Id").IsRequired(); - sp.HasKey("Id"); - sp.Property(e => e.AnyValue).IsRequired(); - sp.WithOwner().HasForeignKey("ThirdValueObjectId"); - }); - }); - b.WithOwner().HasForeignKey("SecondValueObjectId"); - }); - c.WithOwner().HasForeignKey("AggregateId"); - }); - }); - }); + => modelBuilder.Entity(builder => + { + builder.HasKey(e => e.Id); + builder.OwnsOne( + e => e.FirstValueObject, dr => + { + dr.OwnsMany( + d => d.SecondValueObjects, c => + { + c.Property("Id").IsRequired(); + c.HasKey("Id"); + c.OwnsOne( + b => b.FourthValueObject, b => + { + b.OwnsMany( + t => t.FifthValueObjects, sp => + { + sp.Property("Id").IsRequired(); + sp.HasKey("Id"); + sp.Property(e => e.AnyValue).IsRequired(); + sp.WithOwner().HasForeignKey("SecondValueObjectId"); + }); + }); + c.OwnsMany( + b => b.ThirdValueObjects, b => + { + b.Property("Id").IsRequired(); + b.HasKey("Id"); + + b.OwnsOne( + d => d.FourthValueObject, dpd => + { + dpd.OwnsMany( + d => d.FifthValueObjects, sp => + { + sp.Property("Id").IsRequired(); + sp.HasKey("Id"); + sp.Property(e => e.AnyValue).IsRequired(); + sp.WithOwner().HasForeignKey("ThirdValueObjectId"); + }); + }); + b.WithOwner().HasForeignKey("SecondValueObjectId"); + }); + c.WithOwner().HasForeignKey("AggregateId"); + }); + }); + }); public Task SeedAsync() { @@ -362,18 +359,16 @@ public class FifthValueObject #region 18582 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Projecting_correlated_collection_property_for_owned_entity(bool async) { var contextFactory = await InitializeAsync(seed: c => c.SeedAsync()); using var context = contextFactory.CreateContext(); - var query = context.Warehouses.Select( - x => new Context18582.WarehouseModel - { - WarehouseCode = x.WarehouseCode, DestinationCountryCodes = x.DestinationCountries.Select(c => c.CountryCode).ToArray() - }).AsNoTracking(); + var query = context.Warehouses.Select(x => new Context18582.WarehouseModel + { + WarehouseCode = x.WarehouseCode, DestinationCountryCodes = x.DestinationCountries.Select(c => c.CountryCode).ToArray() + }).AsNoTracking(); var result = async ? await query.ToListAsync() @@ -499,27 +494,25 @@ public class OtherEntity #region 20277 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Multiple_single_result_in_projection_containing_owned_types(bool async) { var contextFactory = await InitializeAsync(); using var context = contextFactory.CreateContext(); - var query = context.Entities.AsNoTracking().Select( - e => new - { - e.Id, - FirstChild = e.Children - .Where(c => c.Type == 1) - .AsQueryable() - .Select(_project) - .FirstOrDefault(), - SecondChild = e.Children - .Where(c => c.Type == 2) - .AsQueryable() - .Select(_project) - .FirstOrDefault(), - }); + var query = context.Entities.AsNoTracking().Select(e => new + { + e.Id, + FirstChild = e.Children + .Where(c => c.Type == 1) + .AsQueryable() + .Select(_project) + .FirstOrDefault(), + SecondChild = e.Children + .Where(c => c.Type == 2) + .AsQueryable() + .Select(_project) + .FirstOrDefault(), + }); var result = async ? await query.ToListAsync() @@ -543,15 +536,14 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); - modelBuilder.Entity( - cfg => - { - cfg.OwnsMany( - e => e.Children, inner => - { - inner.OwnsOne(e => e.Owned); - }); - }); + modelBuilder.Entity(cfg => + { + cfg.OwnsMany( + e => e.Children, inner => + { + inner.OwnsOne(e => e.Owned); + }); + }); } public class Entity @@ -709,19 +701,18 @@ public virtual async Task Nested_owned_required_dependents_are_materialized() protected class Context21807(DbContextOptions options) : DbContext(options) { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - builder => - { - builder.HasKey(x => x.Id); + => modelBuilder.Entity(builder => + { + builder.HasKey(x => x.Id); - builder.OwnsOne( - x => x.Contact, contact => - { - contact.OwnsOne(c => c.Address); - }); + builder.OwnsOne( + x => x.Contact, contact => + { + contact.OwnsOne(c => c.Address); + }); - builder.Navigation(x => x.Contact).IsRequired(); - }); + builder.Navigation(x => x.Contact).IsRequired(); + }); public Task SeedAsync() { @@ -755,14 +746,13 @@ public class Address #region 22090 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task OwnsMany_correlated_projection(bool async) { var contextFactory = await InitializeAsync(); using var context = contextFactory.CreateContext(); - var results = await context.Contacts.Select( - contact => new Context22089.ContactDto + var results = await context.Contacts.Select(contact + => new Context22089.ContactDto { Id = contact.Id, Names = contact.Names.Select(name => new Context22089.NameDto()).ToArray() }) @@ -809,20 +799,18 @@ public class NameDto #region 24133 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Projecting_owned_collection_and_aggregate(bool async) { var contextFactory = await InitializeAsync(); using var context = contextFactory.CreateContext(); var query = context.Set() - .Select( - b => new Context24133.BlogDto - { - Id = b.Id, - TotalComments = b.Posts.Sum(p => p.CommentsCount), - Posts = b.Posts.Select(p => new Context24133.PostDto { Title = p.Title, CommentsCount = p.CommentsCount }) - }); + .Select(b => new Context24133.BlogDto + { + Id = b.Id, + TotalComments = b.Posts.Sum(p => p.CommentsCount), + Posts = b.Posts.Select(p => new Context24133.PostDto { Title = p.Title, CommentsCount = p.CommentsCount }) + }); var result = async ? await query.ToListAsync() @@ -833,16 +821,15 @@ public virtual async Task Projecting_owned_collection_and_aggregate(bool async) protected class Context24133(DbContextOptions options) : DbContext(options) { protected override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( - blog => - { - blog.OwnsMany( - b => b.Posts, p => - { - p.WithOwner().HasForeignKey("BlogId"); - p.Property("BlogId").HasMaxLength(40); - }); - }); + => modelBuilder.Entity(blog => + { + blog.OwnsMany( + b => b.Posts, p => + { + p.WithOwner().HasForeignKey("BlogId"); + p.Property("BlogId").HasMaxLength(40); + }); + }); public class Blog { diff --git a/test/EFCore.Specification.Tests/Query/OwnedQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/OwnedQueryTestBase.cs index 8bafc857258..a13939bf68a 100644 --- a/test/EFCore.Specification.Tests/Query/OwnedQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/OwnedQueryTestBase.cs @@ -14,8 +14,7 @@ protected OwnedQueryTestBase(TFixture fixture) : base(fixture) => fixture.ListLoggerFactory.Clear(); - [ConditionalTheory] // Issue #26257 - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] // Issue #26257 public virtual async Task Can_query_owner_with_different_owned_types_having_same_property_name_in_hierarchy(bool async) { using (var context = CreateContext()) @@ -47,8 +46,7 @@ await context.AddAsync( } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_with_owned_entity_equality_operator(bool async) => AssertQuery( async, @@ -58,8 +56,7 @@ from b in ss.Set() select a, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_with_owned_entity_equality_method(bool async) => AssertQuery( async, @@ -69,8 +66,7 @@ where a.LeafAAddress.Equals(b.LeafBAddress) select a, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_with_owned_entity_equality_object_method(bool async) => AssertQuery( async, @@ -80,43 +76,37 @@ where Equals(a.LeafAAddress, b.LeafBAddress) select a, assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_for_base_type_loads_all_owned_navs(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task No_ignored_include_warning_when_implicit_load(bool async) => AssertCount( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_for_branch_type_loads_all_owned_navs(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_for_branch_type_loads_all_owned_navs_tracking(bool async) => AssertQuery( async, ss => ss.Set().AsTracking()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_for_leaf_type_loads_all_owned_navs(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_when_subquery(bool async) => AssertQuery( async, @@ -127,37 +117,32 @@ public virtual Task Query_when_subquery(bool async) assertOrder: true, elementAsserter: (e, a) => AssertEqual(e.op, a.op)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_owned_reference_navigation_which_owns_additional(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(o => o.Id).Select(p => p.PersonAddress)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_owned_reference_navigation_which_does_not_own_additional(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(o => o.Id).Select(p => p.PersonAddress.Country)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_reference_projecting_scalar(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.PersonAddress.Country.Name == "USA") .Select(p => p.PersonAddress.Country.Name)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_reference_projecting_entity(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.PersonAddress.Country.Name == "USA")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_collection(bool async) => AssertQuery( async, @@ -165,38 +150,33 @@ public virtual Task Navigation_rewrite_on_owned_collection(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_collection_with_composition(bool async) => AssertQueryScalar( async, ss => ss.Set().OrderBy(p => p.Id) .Select(p => p.Orders.OrderBy(o => o.Id).Select(o => o.Id != 42).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_collection_with_composition_complex(bool async) => AssertQuery( async, - ss => ss.Set().Select( - p => p.Orders.OrderBy(o => o.Id).Select(o => o.Client.PersonAddress.Country.Name).FirstOrDefault())); + ss => ss.Set() + .Select(p => p.Orders.OrderBy(o => o.Id).Select(o => o.Client.PersonAddress.Country.Name).FirstOrDefault())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_on_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(p => p.Orders)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_with_result_selector(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(o => o.Orders, (p, o) => new { PersonId = p.Id, OrderId = o.Id })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Set_throws_for_owned_type(bool async) { var exception = await Assert.ThrowsAsync(() => AssertQuery(async, ss => ss.Set())); @@ -206,15 +186,13 @@ public virtual async Task Set_throws_for_owned_type(bool async) exception.Message); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_reference_followed_by_regular_entity(bool async) => AssertQuery( async, ss => ss.Set().Select(p => p.PersonAddress.Country.Planet)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_owned_entity_chained_with_regular_entity_followed_by_projecting_owned_collection(bool async) => AssertQuery( async, @@ -223,19 +201,17 @@ public virtual Task Filter_owned_entity_chained_with_regular_entity_followed_by_ assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.Orders, a.Orders)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_multiple_owned_navigations(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(p => p.Id) - .Select( - p => new - { - p.Orders, - p.PersonAddress, - p.PersonAddress.Country.Planet - }), + .Select(p => new + { + p.Orders, + p.PersonAddress, + p.PersonAddress.Country.Planet + }), assertOrder: true, elementAsserter: (e, a) => { @@ -244,17 +220,14 @@ public virtual Task Project_multiple_owned_navigations(bool async) AssertEqual(e.Planet, a.Planet); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Project_multiple_owned_navigations_with_expansion_on_owned_collections(bool async) => AssertQuery( async, - ss => ss.Set().OrderBy(p => p.Id).Select( - p => new - { - Count = p.Orders.Where(o => o.Client.PersonAddress.Country.Planet.Star.Id != 42).Count(), - p.PersonAddress.Country.Planet - }), + ss => ss.Set().OrderBy(p => p.Id).Select(p => new + { + Count = p.Orders.Where(o => o.Client.PersonAddress.Country.Planet.Star.Id != 42).Count(), p.PersonAddress.Country.Planet + }), assertOrder: true, elementAsserter: (e, a) => { @@ -262,8 +235,7 @@ public virtual Task Project_multiple_owned_navigations_with_expansion_on_owned_c AssertEqual(e.Planet, a.Planet); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_reference_followed_by_regular_entity_filter(bool async) => AssertQuery( async, @@ -271,15 +243,13 @@ public virtual Task Navigation_rewrite_on_owned_reference_followed_by_regular_en elementSorter: e => e.p.Id, elementAsserter: (e, a) => AssertEqual(e.p, a.p)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_property(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(p => p.PersonAddress.Country.Planet.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_collection(bool async) => AssertQuery( async, @@ -287,44 +257,38 @@ public virtual Task Navigation_rewrite_on_owned_reference_followed_by_regular_en assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_on_owned_reference_followed_by_regular_entity_and_collection(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(p => p.PersonAddress.Country.Planet.Moons)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SelectMany_on_owned_reference_with_entity_in_between_ending_in_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().SelectMany(p => p.PersonAddress.Country.Planet.Star.Composition)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_collection_count(bool async) => AssertQueryScalar( async, ss => ss.Set().Select(p => p.PersonAddress.Country.Planet.Moons.Count)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_another_reference(bool async) => AssertQuery( async, ss => ss.Set().Select(p => p.PersonAddress.Country.Planet.Star)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_another_reference_and_scalar(bool async) => AssertQuery( async, ss => ss.Set().Select(p => p.PersonAddress.Country.Planet.Star.Name), elementSorter: e => e); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_another_reference_in_predicate_and_projection(bool async) => AssertQuery( @@ -332,22 +296,19 @@ public virtual Task ss => ss.Set().Where(p => p.PersonAddress.Country.Planet.Star.Name == "Sol") .Select(p => p.PersonAddress.Country.Planet.Star)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_with_OfType_eagerly_loads_correct_owned_navigations(bool async) => AssertQuery( async, ss => ss.Set().OfType()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Query_loads_reference_nav_automatically_in_projection(bool async) => AssertSingle( async, ss => ss.Set().Select(e => e.Barton)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Throw_for_owned_entities_without_owner_in_tracking_query(bool async) { using var context = CreateContext(); @@ -369,11 +330,7 @@ public virtual async Task Throw_for_owned_entities_without_owner_in_tracking_que Assert.Equal(CoreStrings.OwnedEntitiesCannotBeTrackedWithoutTheirOwner, message); } - [ConditionalTheory] - [InlineData(false, false)] - [InlineData(false, true)] - [InlineData(true, false)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(false, true), InlineData(true, false), InlineData(true, true)] public virtual async Task Owned_entity_without_owner_does_not_throw_for_identity_resolution(bool async, bool useAsTracking) { using var context = CreateContext(); @@ -391,8 +348,7 @@ public virtual async Task Owned_entity_without_owner_does_not_throw_for_identity Assert.Empty(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Preserve_includes_when_applying_skip_take_after_anonymous_type_select(bool async) { using var context = CreateContext(); @@ -414,30 +370,26 @@ public virtual async Task Preserve_includes_when_applying_skip_take_after_anonym } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Unmapped_property_projection_loads_owned_navigations(bool async) => AssertQuery( async, ss => ss.Set().Where(e => e.Id == 1).AsTracking().Select(e => new { e.ReadOnlyProperty })); // Issue#18140 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_skip_loads_owned_navigations(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(e => e.Id).Select(e => Map(e)).Skip(1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_take_loads_owned_navigations(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(e => e.Id).Select(e => Map(e)).Take(2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_skip_take_loads_owned_navigations(bool async) => AssertQuery( async, @@ -447,22 +399,19 @@ private static string Map(OwnedPerson person) => person.PersonAddress.Country.Name; // Issue#18734 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_skip_loads_owned_navigations_variation_2(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(e => e.Id).Select(e => Identity(e)).Skip(1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_take_loads_owned_navigations_variation_2(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(e => e.Id).Select(e => Identity(e)).Take(2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Client_method_skip_take_loads_owned_navigations_variation_2(bool async) => AssertQuery( async, @@ -471,8 +420,7 @@ public virtual Task Client_method_skip_take_loads_owned_navigations_variation_2( private static OwnedPerson Identity(OwnedPerson person) => person; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_owned_collection_navigation_ToList_Count(bool async) => AssertQuery( async, @@ -484,8 +432,7 @@ public virtual Task Where_owned_collection_navigation_ToList_Count(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_ToArray_Count(bool async) => AssertQuery( async, @@ -497,8 +444,7 @@ public virtual Task Where_collection_navigation_ToArray_Count(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_AsEnumerable_Count(bool async) => AssertQuery( async, @@ -510,8 +456,7 @@ public virtual Task Where_collection_navigation_AsEnumerable_Count(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_ToList_Count_member(bool async) => AssertQuery( async, @@ -523,8 +468,7 @@ public virtual Task Where_collection_navigation_ToList_Count_member(bool async) assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Where_collection_navigation_ToArray_Length_member(bool async) => AssertQuery( async, @@ -536,22 +480,19 @@ public virtual Task Where_collection_navigation_ToArray_Length_member(bool async assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_on_indexer_properties(bool async) => AssertQuery( async, ss => ss.Set().Where(c => (string)c["Name"] == "Mona Cy")); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_on_owned_indexer_properties(bool async) => AssertQuery( async, ss => ss.Set().Where(c => (int)c.PersonAddress["ZipCode"] == 38654).Select(c => (string)c["Name"])); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_on_indexer_property_when_property_name_from_closure(bool async) { var propertyName = "Name"; @@ -560,96 +501,83 @@ public virtual Task Can_query_on_indexer_property_when_property_name_from_closur ss => ss.Set().Where(c => (string)c[propertyName] == "Mona Cy").Select(c => (string)c["Name"])); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_project_indexer_properties(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c["Name"])); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_project_owned_indexer_properties(bool async) => AssertQuery( async, ss => ss.Set().Select(c => c.PersonAddress["AddressLine"])); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_project_indexer_properties_converted(bool async) => AssertQuery( async, ss => ss.Set().Select(c => (string)c["Name"])); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_project_owned_indexer_properties_converted(bool async) => AssertQuery( async, ss => ss.Set().Select(c => (string)c.PersonAddress["AddressLine"])); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_OrderBy_indexer_properties(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c["Name"]).ThenBy(c => c.Id), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_OrderBy_indexer_properties_converted(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => (string)c["Name"]).ThenBy(c => c.Id).Select(c => (string)c["Name"]), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_OrderBy_owned_indexer_properties(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => c.PersonAddress["ZipCode"]).ThenBy(c => c.Id).Select(c => (string)c["Name"]), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_OrderBy_owned_indexer_properties_converted(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(c => (int)c.PersonAddress["ZipCode"]).ThenBy(c => c.Id).Select(c => (string)c["Name"]), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_group_by_indexer_property(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(c => c["Name"]).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_group_by_converted_indexer_property(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(c => (string)c["Name"]).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_group_by_owned_indexer_property(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(c => c.PersonAddress["ZipCode"]).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_group_by_converted_owned_indexer_property(bool async) => AssertQueryScalar( async, ss => ss.Set().GroupBy(c => (int)c.PersonAddress["ZipCode"]).Select(g => g.Count())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_join_on_indexer_property_on_query(bool async) => AssertQuery( async, @@ -659,24 +587,21 @@ join c2 in ss.Set() on c1.PersonAddress["ZipCode"] equals c2.PersonAddress["ZipCode"] select new { c1.Id, c2.PersonAddress.Country.Name })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_indexer_property_ignores_include(bool async) => AssertQuery( async, ss => from c in ss.Set().AsTracking() select new { Nation = c.PersonAddress["ZipCode"] }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_indexer_property_ignores_include_converted(bool async) => AssertQuery( async, ss => from c in ss.Set().AsTracking() select new { Nation = (int)c.PersonAddress["ZipCode"] }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Indexer_property_is_pushdown_into_subquery(bool async) => AssertQuery( async, @@ -684,16 +609,14 @@ public virtual Task Indexer_property_is_pushdown_into_subquery(bool async) .Where(g => (string)ss.Set().Where(c => c.Id == g.Id).FirstOrDefault()["Name"] == "Mona Cy") .Select(c => (string)c["Name"])); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Can_query_indexer_property_on_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(ow => ow.Orders.Where(o => ((DateTime)o["OrderDate"]).Year == 2018).Count() == 1) .Select(c => (string)c["Name"])); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task NoTracking_Include_with_cycles_throws(bool async) { using var context = CreateContext(); @@ -706,11 +629,7 @@ public virtual async Task NoTracking_Include_with_cycles_throws(bool async) : Assert.Throws(() => query.ToList()).Message); } - [ConditionalTheory] - [InlineData(false, false)] - [InlineData(false, true)] - [InlineData(true, false)] - [InlineData(true, true)] + [ConditionalTheory, InlineData(false, false), InlineData(false, true), InlineData(true, false), InlineData(true, true)] public virtual async Task NoTracking_Include_with_cycles_does_not_throw_when_performing_identity_resolution( bool async, bool useAsTracking) @@ -734,8 +653,7 @@ public virtual async Task NoTracking_Include_with_cycles_does_not_throw_when_per } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Trying_to_access_non_existent_indexer_property_throws_meaningful_exception(bool async) => AssertTranslationFailedWithDetails( () => AssertQuery( @@ -743,39 +661,33 @@ public virtual Task Trying_to_access_non_existent_indexer_property_throws_meanin ss => ss.Set().Where(op => (bool)op["Foo"])), CoreStrings.QueryUnableToTranslateMember("Foo", nameof(OwnedPerson))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_with_multiple_aggregates_on_owned_navigation_properties(bool async) => AssertQuery( async, - ss => ss.Set().GroupBy(e => 1, x => x.PersonAddress.Country.Planet.Star).Select( - e => new - { - p1 = e.Average(x => x.Id), - p2 = e.Sum(x => x.Id), - p3 = e.Max(x => x.Name.Length), - })); + ss => ss.Set().GroupBy(e => 1, x => x.PersonAddress.Country.Planet.Star).Select(e => new + { + p1 = e.Average(x => x.Id), + p2 = e.Sum(x => x.Id), + p3 = e.Max(x => x.Name.Length), + })); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Non_nullable_property_through_optional_navigation(bool async) => Assert.Equal( "Nullable object must have a value.", - (await Assert.ThrowsAsync( - () => AssertQuery( - async, - ss => ss.Set().Select(e => new { e.Throned.Value })))).Message); + (await Assert.ThrowsAsync(() => AssertQuery( + async, + ss => ss.Set().Select(e => new { e.Throned.Value })))).Message); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Ordering_by_identifying_projection(bool async) => AssertQuery( async, ss => ss.Set().OrderBy(p => p.PersonAddress.PlaceType).ThenBy(e => e.Id), assertOrder: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Query_on_collection_entry_works_for_owned_collection(bool async) { using var context = CreateContext(); @@ -797,8 +709,7 @@ public virtual async Task Query_on_collection_entry_works_for_owned_collection(b } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Projecting_collection_correlated_with_keyless_entity_after_navigation_works_using_parent_identifiers(bool async) => AssertQuery( async, @@ -811,8 +722,7 @@ public virtual Task Projecting_collection_correlated_with_keyless_entity_after_n AssertCollection(e.Planets, a.Planets); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_indexer_using_closure(bool async) { var zipCode = "ZipCode"; @@ -822,8 +732,7 @@ public virtual Task Filter_on_indexer_using_closure(bool async) ss => ss.Set().Where(p => (int)p.PersonAddress[zipCode] == 38654)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Filter_on_indexer_using_function_argument(bool async) { var zipCode = "ZipCode"; @@ -842,22 +751,27 @@ public virtual async Task Filter_on_indexer_using_function_argument(bool async) await myFunc(async, zipCode); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Simple_query_entity_with_owned_collection(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_on_entity_with_owned_navigations(bool async) => AssertQuery( async, ss => from c1 in ss.Set() join c2 in ss.Set() on c1.Id equals c2.Id into grouping from c2 in grouping.DefaultIfEmpty() - select new { c1, c2.Id, c2, c2.Orders, c2.PersonAddress }, + select new + { + c1, + c2.Id, + c2, + c2.Orders, + c2.PersonAddress + }, elementSorter: e => (e.c1.Id, e.c2.Id), elementAsserter: (e, a) => { @@ -868,8 +782,7 @@ from c2 in grouping.DefaultIfEmpty() AssertEqual(e.PersonAddress, a.PersonAddress); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Left_join_on_entity_with_owned_navigations_complex(bool async) => AssertQuery( async, @@ -896,8 +809,7 @@ from sub in grouping2.DefaultIfEmpty() AssertEqual(e.sub.c2, a.sub.c2); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GroupBy_aggregate_on_owned_navigation_in_aggregate_selector(bool async) => AssertQuery( async, @@ -911,46 +823,40 @@ public virtual Task GroupBy_aggregate_on_owned_navigation_in_aggregate_selector( AssertEqual(e.Sum, a.Sum); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Count_over_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Orders.Count == 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_without_predicate_over_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Orders.Any())); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Any_with_predicate_over_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Orders.Any(i => i.Id == -30))); // TODO: proper owned entity containment, #34027 - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains_over_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Orders.Contains(new Order { Id = -30 })), ss => ss.Set().Where(p => p.Orders.Any(o => o.Id == -30))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ElementAt_over_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Orders.ElementAt(1).Id == -11), ss => ss.Set().Where(p => p.Orders.Count >= 2 && p.Orders.ElementAt(1).Id == -11)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ElementAtOrDefault_over_owned_collection(bool async) => AssertQuery( async, @@ -958,40 +864,34 @@ public virtual Task ElementAtOrDefault_over_owned_collection(bool async) ss => ss.Set().Where(p => p.Orders.Count >= 11 && p.Orders.ElementAtOrDefault(1).Id == -11), assertEmpty: true); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OrderBy_ElementAt_over_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Orders.OrderBy(o => o.Id).ElementAt(1).Id == -10), ss => ss.Set().Where(p => p.Orders.Count >= 2 && p.Orders.OrderBy(o => o.Id).ElementAt(1).Id == -10)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Skip_Take_over_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Orders.Skip(1).Take(1).Count() == 1)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task FirstOrDefault_over_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(p => ((DateTime)p.Orders.FirstOrDefault(o => o.Id > -20)["OrderDate"]).Year == 2018), - ss => ss.Set().Where( - p => Enumerable.FirstOrDefault(p.Orders, o => o.Id > -20) != null - && ((DateTime)p.Orders.FirstOrDefault(o => o.Id > -20)["OrderDate"]).Year == 2018)); + ss => ss.Set().Where(p => p.Orders.FirstOrDefault(o => o.Id > -20) != null + && ((DateTime)p.Orders.FirstOrDefault(o => o.Id > -20)["OrderDate"]).Year == 2018)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distinct_over_owned_collection(bool async) => AssertQuery( async, ss => ss.Set().Where(p => p.Orders.Distinct().Count() == 2)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_over_owned_collection(bool async) => AssertQuery( async, @@ -1300,328 +1200,320 @@ protected override string StoreName protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - eb => - { - eb.IndexerProperty("Name"); - var ownedPerson = new OwnedPerson { Id = 1, ["Name"] = "Mona Cy" }; - eb.HasData(ownedPerson); + modelBuilder.Entity(eb => + { + eb.IndexerProperty("Name"); + var ownedPerson = new OwnedPerson { Id = 1, ["Name"] = "Mona Cy" }; + eb.HasData(ownedPerson); - eb.OwnsOne( - p => p.PersonAddress, ab => - { - ab.IndexerProperty("AddressLine"); - ab.IndexerProperty(typeof(int), "ZipCode"); - ab.HasData( - new - { - OwnedPersonId = 1, - PlaceType = "Land", - AddressLine = "804 S. Lakeshore Road", - ZipCode = 38654 - }, - new - { - OwnedPersonId = 2, - PlaceType = "Land", - AddressLine = "7 Church Dr.", - ZipCode = 28655 - }, - new - { - OwnedPersonId = 3, - PlaceType = "Land", - AddressLine = "72 Hickory Rd.", - ZipCode = 07728 - }, - new - { - OwnedPersonId = 4, - PlaceType = "Land", - AddressLine = "28 Strawberry St.", - ZipCode = 19053 - }); - - ab.OwnsOne( - a => a.Country, cb => - { - cb.HasData( - new - { - OwnedAddressOwnedPersonId = 1, - PlanetId = 1, - Name = "USA" - }, - new - { - OwnedAddressOwnedPersonId = 2, - PlanetId = 1, - Name = "USA" - }, - new - { - OwnedAddressOwnedPersonId = 3, - PlanetId = 1, - Name = "USA" - }, - new - { - OwnedAddressOwnedPersonId = 4, - PlanetId = 1, - Name = "USA" - }); - - cb.HasOne(cc => cc.Planet).WithMany().HasForeignKey(ee => ee.PlanetId) - .OnDelete(DeleteBehavior.Restrict); - }); - }); - - eb.OwnsMany( - p => p.Orders, ob => - { - ob.IndexerProperty("OrderDate"); - ob.HasData( - new - { - Id = -10, - ClientId = 1, - OrderDate = Convert.ToDateTime("2018-07-11 10:01:41") - }, - new - { - Id = -11, - ClientId = 1, - OrderDate = Convert.ToDateTime("2015-03-03 04:37:59") - }, - new - { - Id = -20, - ClientId = 2, - OrderDate = Convert.ToDateTime("2015-05-25 20:35:48") - }, - new - { - Id = -30, - ClientId = 3, - OrderDate = Convert.ToDateTime("2014-11-10 04:32:42") - }, - new - { - Id = -40, - ClientId = 4, - OrderDate = Convert.ToDateTime("2016-04-25 19:23:56") - } - ); - - ob.OwnsMany( - e => e.Details, odb => - { - odb.HasData( - new - { - Id = -100, - OrderId = -10, - OrderClientId = 1, - Detail = "Discounted Order" - }, - new - { - Id = -101, - OrderId = -10, - OrderClientId = 1, - Detail = "Full Price Order" - }, - new - { - Id = -200, - OrderId = -20, - OrderClientId = 2, - Detail = "Internal Order" - }, - new - { - Id = -300, - OrderId = -30, - OrderClientId = 3, - Detail = "Bulk Order" - }); - }); - }); - }); + eb.OwnsOne( + p => p.PersonAddress, ab => + { + ab.IndexerProperty("AddressLine"); + ab.IndexerProperty(typeof(int), "ZipCode"); + ab.HasData( + new + { + OwnedPersonId = 1, + PlaceType = "Land", + AddressLine = "804 S. Lakeshore Road", + ZipCode = 38654 + }, + new + { + OwnedPersonId = 2, + PlaceType = "Land", + AddressLine = "7 Church Dr.", + ZipCode = 28655 + }, + new + { + OwnedPersonId = 3, + PlaceType = "Land", + AddressLine = "72 Hickory Rd.", + ZipCode = 07728 + }, + new + { + OwnedPersonId = 4, + PlaceType = "Land", + AddressLine = "28 Strawberry St.", + ZipCode = 19053 + }); + + ab.OwnsOne( + a => a.Country, cb => + { + cb.HasData( + new + { + OwnedAddressOwnedPersonId = 1, + PlanetId = 1, + Name = "USA" + }, + new + { + OwnedAddressOwnedPersonId = 2, + PlanetId = 1, + Name = "USA" + }, + new + { + OwnedAddressOwnedPersonId = 3, + PlanetId = 1, + Name = "USA" + }, + new + { + OwnedAddressOwnedPersonId = 4, + PlanetId = 1, + Name = "USA" + }); + + cb.HasOne(cc => cc.Planet).WithMany().HasForeignKey(ee => ee.PlanetId) + .OnDelete(DeleteBehavior.Restrict); + }); + }); + + eb.OwnsMany( + p => p.Orders, ob => + { + ob.IndexerProperty("OrderDate"); + ob.HasData( + new + { + Id = -10, + ClientId = 1, + OrderDate = Convert.ToDateTime("2018-07-11 10:01:41") + }, + new + { + Id = -11, + ClientId = 1, + OrderDate = Convert.ToDateTime("2015-03-03 04:37:59") + }, + new + { + Id = -20, + ClientId = 2, + OrderDate = Convert.ToDateTime("2015-05-25 20:35:48") + }, + new + { + Id = -30, + ClientId = 3, + OrderDate = Convert.ToDateTime("2014-11-10 04:32:42") + }, + new + { + Id = -40, + ClientId = 4, + OrderDate = Convert.ToDateTime("2016-04-25 19:23:56") + } + ); + + ob.OwnsMany( + e => e.Details, odb => + { + odb.HasData( + new + { + Id = -100, + OrderId = -10, + OrderClientId = 1, + Detail = "Discounted Order" + }, + new + { + Id = -101, + OrderId = -10, + OrderClientId = 1, + Detail = "Full Price Order" + }, + new + { + Id = -200, + OrderId = -20, + OrderClientId = 2, + Detail = "Internal Order" + }, + new + { + Id = -300, + OrderId = -30, + OrderClientId = 3, + Detail = "Bulk Order" + }); + }); + }); + }); - modelBuilder.Entity( - eb => - { - eb.HasData(new { Id = 2, Name = "Antigonus Mitul" }); + modelBuilder.Entity(eb => + { + eb.HasData(new { Id = 2, Name = "Antigonus Mitul" }); - eb.OwnsOne( - p => p.BranchAddress, ab => - { - ab.IndexerProperty("BranchName").IsRequired(); - ab.HasData( - new - { - BranchId = 2, - PlaceType = "Land", - BranchName = "BranchA" - }, - new - { - BranchId = 3, - PlaceType = "Land", - BranchName = "BranchB" - }); - - ab.OwnsOne( - a => a.Country, cb => - { - cb.HasData( - new - { - OwnedAddressBranchId = 2, - PlanetId = 1, - Name = "Canada" - }, - new - { - OwnedAddressBranchId = 3, - PlanetId = 1, - Name = "Canada" - }); - }); - }); - }); + eb.OwnsOne( + p => p.BranchAddress, ab => + { + ab.IndexerProperty("BranchName").IsRequired(); + ab.HasData( + new + { + BranchId = 2, + PlaceType = "Land", + BranchName = "BranchA" + }, + new + { + BranchId = 3, + PlaceType = "Land", + BranchName = "BranchB" + }); - modelBuilder.Entity( - eb => - { - var leafA = new LeafA { Id = 3 }; - leafA["Name"] = "Madalena Morana"; - eb.HasData(leafA); + ab.OwnsOne( + a => a.Country, cb => + { + cb.HasData( + new + { + OwnedAddressBranchId = 2, + PlanetId = 1, + Name = "Canada" + }, + new + { + OwnedAddressBranchId = 3, + PlanetId = 1, + Name = "Canada" + }); + }); + }); + }); - eb.OwnsOne( - p => p.LeafAAddress, ab => - { - ab.IndexerProperty("LeafType"); - - ab.HasData( - new - { - LeafAId = 3, - PlaceType = "Land", - LeafType = 1 - }); - - ab.OwnsOne( - a => a.Country, cb => - { - cb.HasOne(c => c.Planet).WithMany().HasForeignKey(c => c.PlanetId) - .OnDelete(DeleteBehavior.Restrict); - - cb.HasData( - new - { - OwnedAddressLeafAId = 3, - PlanetId = 1, - Name = "Mexico" - }); - }); - }); - }); + modelBuilder.Entity(eb => + { + var leafA = new LeafA { Id = 3 }; + leafA["Name"] = "Madalena Morana"; + eb.HasData(leafA); - modelBuilder.Entity( - eb => - { - var leafB = new LeafB { Id = 4 }; - leafB["Name"] = "Vanda Waldemar"; - eb.HasData(leafB); + eb.OwnsOne( + p => p.LeafAAddress, ab => + { + ab.IndexerProperty("LeafType"); - eb.OwnsOne( - p => p.LeafBAddress, ab => - { - ab.IndexerProperty("LeafBType").IsRequired(); - ab.HasData( - new - { - LeafBId = 4, - PlaceType = "Land", - LeafBType = "Green" - }); - - ab.OwnsOne( - a => a.Country, cb => - { - cb.HasOne(c => c.Planet).WithMany().HasForeignKey(c => c.PlanetId) - .OnDelete(DeleteBehavior.Restrict); - - cb.HasData( - new - { - OwnedAddressLeafBId = 4, - PlanetId = 1, - Name = "Panama" - }); - }); - }); - }); + ab.HasData( + new + { + LeafAId = 3, + PlaceType = "Land", + LeafType = 1 + }); - modelBuilder.Entity( - pb => pb.HasData( - new Planet - { - Id = 1, - StarId = 1, - Name = "Earth" - })); - - modelBuilder.Entity( - mb => mb.HasData( - new Moon + ab.OwnsOne( + a => a.Country, cb => + { + cb.HasOne(c => c.Planet).WithMany().HasForeignKey(c => c.PlanetId) + .OnDelete(DeleteBehavior.Restrict); + + cb.HasData( + new + { + OwnedAddressLeafAId = 3, + PlanetId = 1, + Name = "Mexico" + }); + }); + }); + }); + + modelBuilder.Entity(eb => + { + var leafB = new LeafB { Id = 4 }; + leafB["Name"] = "Vanda Waldemar"; + eb.HasData(leafB); + + eb.OwnsOne( + p => p.LeafBAddress, ab => { - Id = 1, - PlanetId = 1, - Diameter = 3474 - })); + ab.IndexerProperty("LeafBType").IsRequired(); + ab.HasData( + new + { + LeafBId = 4, + PlaceType = "Land", + LeafBType = "Green" + }); - modelBuilder.Entity( - sb => + ab.OwnsOne( + a => a.Country, cb => + { + cb.HasOne(c => c.Planet).WithMany().HasForeignKey(c => c.PlanetId) + .OnDelete(DeleteBehavior.Restrict); + + cb.HasData( + new + { + OwnedAddressLeafBId = 4, + PlanetId = 1, + Name = "Panama" + }); + }); + }); + }); + + modelBuilder.Entity(pb => pb.HasData( + new Planet { - sb.HasData(new Star { Id = 1, Name = "Sol" }); - sb.OwnsMany( - s => s.Composition, ob => - { - ob.HasKey(e => e.Id); - ob.HasData( - new - { - Id = "H", - Name = "Hydrogen", - StarId = 1 - }, - new - { - Id = "He", - Name = "Helium", - StarId = 1 - }); - }); - }); + Id = 1, + StarId = 1, + Name = "Earth" + })); - modelBuilder.Entity( - b => + modelBuilder.Entity(mb => mb.HasData( + new Moon { - b.OwnsOne( - e => e.Throned, b => b.HasData( + Id = 1, + PlanetId = 1, + Diameter = 3474 + })); + + modelBuilder.Entity(sb => + { + sb.HasData(new Star { Id = 1, Name = "Sol" }); + sb.OwnsMany( + s => s.Composition, ob => + { + ob.HasKey(e => e.Id); + ob.HasData( new { - BartonId = 1, - Property = "Property", - Value = 42 - })); - b.HasData( - new Barton { Id = 1, Simple = "Simple" }, - new Barton { Id = 2, Simple = "Not" }); - }); + Id = "H", + Name = "Hydrogen", + StarId = 1 + }, + new + { + Id = "He", + Name = "Helium", + StarId = 1 + }); + }); + }); + + modelBuilder.Entity(b => + { + b.OwnsOne( + e => e.Throned, b => b.HasData( + new + { + BartonId = 1, + Property = "Property", + Value = 42 + })); + b.HasData( + new Barton { Id = 1, Simple = "Simple" }, + new Barton { Id = 2, Simple = "Not" }); + }); modelBuilder.Entity().HasData( new { Id = 1, BartonId = 1 }); diff --git a/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs index 9d47e240d0b..ce390626e95 100644 --- a/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs @@ -12,18 +12,15 @@ public abstract class PrimitiveCollectionsQueryTestBase(TFixture fixtu [ConditionalFact] public virtual Task Inline_collection_of_ints_Contains() - => AssertQuery( - ss => ss.Set().Where(c => new[] { 10, 999 }.Contains(c.Int))); + => AssertQuery(ss => ss.Set().Where(c => new[] { 10, 999 }.Contains(c.Int))); [ConditionalFact] public virtual Task Inline_collection_of_nullable_ints_Contains() - => AssertQuery( - ss => ss.Set().Where(c => new int?[] { 10, 999 }.Contains(c.NullableInt))); + => AssertQuery(ss => ss.Set().Where(c => new int?[] { 10, 999 }.Contains(c.NullableInt))); [ConditionalFact] public virtual Task Inline_collection_of_nullable_ints_Contains_null() - => AssertQuery( - ss => ss.Set().Where(c => new int?[] { null, 999 }.Contains(c.NullableInt))); + => AssertQuery(ss => ss.Set().Where(c => new int?[] { null, 999 }.Contains(c.NullableInt))); [ConditionalFact] public virtual Task Inline_collection_Count_with_zero_values() @@ -34,18 +31,15 @@ public virtual Task Inline_collection_Count_with_zero_values() [ConditionalFact] public virtual Task Inline_collection_Count_with_one_value() - => AssertQuery( - ss => ss.Set().Where(c => new[] { 2 }.Count(i => i > c.Id) == 1)); + => AssertQuery(ss => ss.Set().Where(c => new[] { 2 }.Count(i => i > c.Id) == 1)); [ConditionalFact] public virtual Task Inline_collection_Count_with_two_values() - => AssertQuery( - ss => ss.Set().Where(c => new[] { 2, 999 }.Count(i => i > c.Id) == 1)); + => AssertQuery(ss => ss.Set().Where(c => new[] { 2, 999 }.Count(i => i > c.Id) == 1)); [ConditionalFact] public virtual Task Inline_collection_Count_with_three_values() - => AssertQuery( - ss => ss.Set().Where(c => new[] { 2, 999, 1000 }.Count(i => i > c.Id) == 2)); + => AssertQuery(ss => ss.Set().Where(c => new[] { 2, 999, 1000 }.Count(i => i > c.Id) == 2)); [ConditionalFact] public virtual Task Inline_collection_Contains_with_zero_values() @@ -56,26 +50,22 @@ public virtual Task Inline_collection_Contains_with_zero_values() [ConditionalFact] public virtual Task Inline_collection_Contains_with_one_value() - => AssertQuery( - ss => ss.Set().Where(c => new[] { 2 }.Contains(c.Id))); + => AssertQuery(ss => ss.Set().Where(c => new[] { 2 }.Contains(c.Id))); [ConditionalFact] public virtual Task Inline_collection_Contains_with_two_values() - => AssertQuery( - ss => ss.Set().Where(c => new[] { 2, 999 }.Contains(c.Id))); + => AssertQuery(ss => ss.Set().Where(c => new[] { 2, 999 }.Contains(c.Id))); [ConditionalFact] public virtual Task Inline_collection_Contains_with_three_values() - => AssertQuery( - ss => ss.Set().Where(c => new[] { 2, 999, 1000 }.Contains(c.Id))); + => AssertQuery(ss => ss.Set().Where(c => new[] { 2, 999, 1000 }.Contains(c.Id))); [ConditionalFact] public virtual Task Inline_collection_Contains_with_all_parameters() { var (i, j) = (2, 999); - return AssertQuery( - ss => ss.Set().Where(c => new[] { i, j }.Contains(c.Id))); + return AssertQuery(ss => ss.Set().Where(c => new[] { i, j }.Contains(c.Id))); } [ConditionalFact] @@ -83,8 +73,7 @@ public virtual Task Inline_collection_Contains_with_constant_and_parameter() { var j = 999; - return AssertQuery( - ss => ss.Set().Where(c => new[] { 2, j }.Contains(c.Id))); + return AssertQuery(ss => ss.Set().Where(c => new[] { 2, j }.Contains(c.Id))); } [ConditionalFact] @@ -94,8 +83,7 @@ public virtual async Task Inline_collection_Contains_with_mixed_value_types() var i = 11; - await AssertQuery( - ss => ss.Set().Where(c => new[] { 999, i, c.Id, c.Id + c.Int }.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => new[] { 999, i, c.Id, c.Id + c.Int }.Contains(c.Int))); } [ConditionalFact] @@ -103,54 +91,45 @@ public virtual async Task Inline_collection_List_Contains_with_mixed_value_types { var i = 11; - await AssertQuery( - ss => ss.Set().Where( - c => new List - { - 999, - i, - c.Id, - c.Id + c.Int - }.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => new List + { + 999, + i, + c.Id, + c.Id + c.Int + }.Contains(c.Int))); } [ConditionalFact] public virtual Task Inline_collection_Contains_as_Any_with_predicate() - => AssertQuery( - ss => ss.Set().Where(c => new[] { 2, 999 }.Any(i => i == c.Id))); + => AssertQuery(ss => ss.Set().Where(c => new[] { 2, 999 }.Any(i => i == c.Id))); [ConditionalFact] public virtual Task Inline_collection_negated_Contains_as_All() - => AssertQuery( - ss => ss.Set().Where(c => new[] { 2, 999 }.All(i => i != c.Id))); + => AssertQuery(ss => ss.Set().Where(c => new[] { 2, 999 }.All(i => i != c.Id))); [ConditionalFact] public virtual async Task Inline_collection_Min_with_two_values() - => await AssertQuery( - ss => ss.Set().Where(c => new[] { 30, c.Int }.Min() == 30)); + => await AssertQuery(ss => ss.Set().Where(c => new[] { 30, c.Int }.Min() == 30)); [ConditionalFact] public virtual async Task Inline_collection_List_Min_with_two_values() - => await AssertQuery( - ss => ss.Set().Where(c => new List { 30, c.Int }.Min() == 30)); + => await AssertQuery(ss => ss.Set().Where(c => new List { 30, c.Int }.Min() == 30)); [ConditionalFact] public virtual async Task Inline_collection_Max_with_two_values() - => await AssertQuery( - ss => ss.Set().Where(c => new[] { 30, c.Int }.Max() == 30)); + => await AssertQuery(ss => ss.Set().Where(c => new[] { 30, c.Int }.Max() == 30)); [ConditionalFact] public virtual async Task Inline_collection_List_Max_with_two_values() - => await AssertQuery( - ss => ss.Set().Where(c => new List { 30, c.Int }.Max() == 30)); + => await AssertQuery(ss => ss.Set().Where(c => new List { 30, c.Int }.Max() == 30)); [ConditionalFact] public virtual async Task Inline_collection_Min_with_three_values() { var i = 25; - await AssertQuery( - ss => ss.Set().Where(c => new[] { 30, c.Int, i }.Min() == 25)); + await AssertQuery(ss => ss.Set().Where(c => new[] { 30, c.Int, i }.Min() == 25)); } [ConditionalFact] @@ -158,15 +137,13 @@ public virtual async Task Inline_collection_List_Min_with_three_values() { var i = 25; - await AssertQuery( - ss => ss.Set().Where( - c => new List - { - 30, - c.Int, - i - }.Min() - == 25)); + await AssertQuery(ss => ss.Set().Where(c => new List + { + 30, + c.Int, + i + }.Min() + == 25)); } [ConditionalFact] @@ -174,8 +151,7 @@ public virtual async Task Inline_collection_Max_with_three_values() { var i = 35; - await AssertQuery( - ss => ss.Set().Where(c => new[] { 30, c.Int, i }.Max() == 35)); + await AssertQuery(ss => ss.Set().Where(c => new[] { 30, c.Int, i }.Max() == 35)); } [ConditionalFact] @@ -183,15 +159,13 @@ public virtual async Task Inline_collection_List_Max_with_three_values() { var i = 35; - await AssertQuery( - ss => ss.Set().Where( - c => new List - { - 30, - c.Int, - i - }.Max() - == 35)); + await AssertQuery(ss => ss.Set().Where(c => new List + { + 30, + c.Int, + i + }.Max() + == 35)); } [ConditionalFact] @@ -199,8 +173,7 @@ public virtual async Task Inline_collection_of_nullable_value_type_Min() { int? i = 25; - await AssertQuery( - ss => ss.Set().Where(c => new[] { 30, c.Int, i }.Min() == 25)); + await AssertQuery(ss => ss.Set().Where(c => new[] { 30, c.Int, i }.Min() == 25)); } [ConditionalFact] @@ -208,8 +181,7 @@ public virtual async Task Inline_collection_of_nullable_value_type_Max() { int? i = 35; - await AssertQuery( - ss => ss.Set().Where(c => new[] { 30, c.Int, i }.Max() == 35)); + await AssertQuery(ss => ss.Set().Where(c => new[] { 30, c.Int, i }.Max() == 35)); } [ConditionalFact] @@ -217,8 +189,7 @@ public virtual async Task Inline_collection_of_nullable_value_type_with_null_Min { int? i = null; - await AssertQuery( - ss => ss.Set().Where(c => new[] { 30, c.NullableInt, i }.Min() == 30)); + await AssertQuery(ss => ss.Set().Where(c => new[] { 30, c.NullableInt, i }.Min() == 30)); } [ConditionalFact] @@ -226,8 +197,7 @@ public virtual async Task Inline_collection_of_nullable_value_type_with_null_Max { int? i = null; - await AssertQuery( - ss => ss.Set().Where(c => new[] { 30, c.NullableInt, i }.Max() == 30)); + await AssertQuery(ss => ss.Set().Where(c => new[] { 30, c.NullableInt, i }.Max() == 30)); } [ConditionalFact] @@ -267,8 +237,7 @@ public virtual Task Parameter_collection_Count() { var ids = new[] { 2, 999 }; - return AssertQuery( - ss => ss.Set().Where(c => ids.Count(i => i > c.Id) == 1)); + return AssertQuery(ss => ss.Set().Where(c => ids.Count(i => i > c.Id) == 1)); } [ConditionalFact] @@ -276,10 +245,8 @@ public virtual async Task Parameter_collection_of_ints_Contains_int() { var ints = new[] { 10, 999 }; - await AssertQuery( - ss => ss.Set().Where(c => ints.Contains(c.Int))); - await AssertQuery( - ss => ss.Set().Where(c => !ints.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => ints.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => !ints.Contains(c.Int))); } [ConditionalFact] @@ -287,10 +254,8 @@ public virtual async Task Parameter_collection_HashSet_of_ints_Contains_int() { var ints = new HashSet { 10, 999 }; - await AssertQuery( - ss => ss.Set().Where(c => ints.Contains(c.Int))); - await AssertQuery( - ss => ss.Set().Where(c => !ints.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => ints.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => !ints.Contains(c.Int))); } [ConditionalFact] @@ -298,10 +263,8 @@ public virtual async Task Parameter_collection_ImmutableArray_of_ints_Contains_i { var ints = ImmutableArray.Create([10, 999]); - await AssertQuery( - ss => ss.Set().Where(c => ints.Contains(c.Int))); - await AssertQuery( - ss => ss.Set().Where(c => !ints.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => ints.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => !ints.Contains(c.Int))); } [ConditionalFact] @@ -322,10 +285,8 @@ public virtual async Task Parameter_collection_of_nullable_ints_Contains_int() { var nullableInts = new int?[] { 10, 999 }; - await AssertQuery( - ss => ss.Set().Where(c => nullableInts.Contains(c.Int))); - await AssertQuery( - ss => ss.Set().Where(c => !nullableInts.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => nullableInts.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => !nullableInts.Contains(c.Int))); } [ConditionalFact] @@ -333,10 +294,8 @@ public virtual async Task Parameter_collection_of_nullable_ints_Contains_nullabl { var nullableInts = new int?[] { null, 999 }; - await AssertQuery( - ss => ss.Set().Where(c => nullableInts.Contains(c.NullableInt))); - await AssertQuery( - ss => ss.Set().Where(c => !nullableInts.Contains(c.NullableInt))); + await AssertQuery(ss => ss.Set().Where(c => nullableInts.Contains(c.NullableInt))); + await AssertQuery(ss => ss.Set().Where(c => !nullableInts.Contains(c.NullableInt))); } [ConditionalFact] @@ -344,13 +303,11 @@ public virtual async Task Parameter_collection_of_structs_Contains_struct() { var values = new List { new(22), new(33) }; - await AssertQuery( - ss => ss.Set().Where(c => values.Contains(c.WrappedId))); + await AssertQuery(ss => ss.Set().Where(c => values.Contains(c.WrappedId))); - values = new List { new(11), new(44) }; + values = [new(11), new(44)]; - await AssertQuery( - ss => ss.Set().Where(c => !values.Contains(c.WrappedId))); + await AssertQuery(ss => ss.Set().Where(c => !values.Contains(c.WrappedId))); } [ConditionalFact] @@ -360,13 +317,15 @@ public virtual async Task Parameter_collection_of_structs_Contains_nullable_stru await AssertQuery( ss => ss.Set().Where(c => values.Contains(c.NullableWrappedId!.Value)), - ss => ss.Set().Where(c => c.NullableWrappedId != null && values.Contains(c.NullableWrappedId.Value))); + ss => ss.Set() + .Where(c => c.NullableWrappedId != null && values.Contains(c.NullableWrappedId.Value))); - values = new List { new(11), new(44) }; + values = [new(11), new(44)]; await AssertQuery( ss => ss.Set().Where(c => !values.Contains(c.NullableWrappedId!.Value)), - ss => ss.Set().Where(c => c.NullableWrappedId == null || !values.Contains(c.NullableWrappedId!.Value))); + ss => ss.Set() + .Where(c => c.NullableWrappedId == null || !values.Contains(c.NullableWrappedId!.Value))); } [ConditionalFact] // Issue #35117 @@ -376,57 +335,51 @@ public virtual async Task Parameter_collection_of_structs_Contains_nullable_stru await AssertQuery( ss => ss.Set().Where(c => values.Contains(c.NullableWrappedIdWithNullableComparer!.Value)), - ss => ss.Set().Where( - c => c.NullableWrappedIdWithNullableComparer != null && values.Contains(c.NullableWrappedIdWithNullableComparer.Value))); + ss => ss.Set().Where(c + => c.NullableWrappedIdWithNullableComparer != null && values.Contains(c.NullableWrappedIdWithNullableComparer.Value))); - values = new List { new(11), new(44) }; + values = [new(11), new(44)]; await AssertQuery( ss => ss.Set().Where(c => !values.Contains(c.NullableWrappedId!.Value)), - ss => ss.Set().Where( - c => c.NullableWrappedIdWithNullableComparer == null || !values.Contains(c.NullableWrappedIdWithNullableComparer!.Value))); + ss => ss.Set().Where(c + => c.NullableWrappedIdWithNullableComparer == null || !values.Contains(c.NullableWrappedIdWithNullableComparer!.Value))); } [ConditionalFact] public virtual async Task Parameter_collection_of_nullable_structs_Contains_struct() { - var values = new List { null, new(22) }; + var values = new List { null, new WrappedId(22) }; - await AssertQuery( - ss => ss.Set().Where(c => values.Contains(c.WrappedId))); + await AssertQuery(ss => ss.Set().Where(c => values.Contains(c.WrappedId))); - values = new List { new(11), new(44) }; + values = [new WrappedId(11), new WrappedId(44)]; - await AssertQuery( - ss => ss.Set().Where(c => !values.Contains(c.WrappedId))); + await AssertQuery(ss => ss.Set().Where(c => !values.Contains(c.WrappedId))); } [ConditionalFact] public virtual async Task Parameter_collection_of_nullable_structs_Contains_nullable_struct() { - var values = new List { null, new(22) }; + var values = new List { null, new WrappedId(22) }; - await AssertQuery( - ss => ss.Set().Where(c => values.Contains(c.NullableWrappedId))); + await AssertQuery(ss => ss.Set().Where(c => values.Contains(c.NullableWrappedId))); - values = new List { new(11), new(44) }; + values = [new WrappedId(11), new WrappedId(44)]; - await AssertQuery( - ss => ss.Set().Where(c => !values.Contains(c.NullableWrappedId))); + await AssertQuery(ss => ss.Set().Where(c => !values.Contains(c.NullableWrappedId))); } [ConditionalFact] public virtual async Task Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer() { - var values = new List { null, new(22) }; + var values = new List { null, new WrappedId(22) }; - await AssertQuery( - ss => ss.Set().Where(c => values.Contains(c.NullableWrappedIdWithNullableComparer))); + await AssertQuery(ss => ss.Set().Where(c => values.Contains(c.NullableWrappedIdWithNullableComparer))); - values = new List { new(11), new(44) }; + values = [new WrappedId(11), new WrappedId(44)]; - await AssertQuery( - ss => ss.Set().Where(c => !values.Contains(c.NullableWrappedIdWithNullableComparer))); + await AssertQuery(ss => ss.Set().Where(c => !values.Contains(c.NullableWrappedIdWithNullableComparer))); } [ConditionalFact] @@ -434,10 +387,8 @@ public virtual async Task Parameter_collection_of_strings_Contains_string() { var strings = new[] { "10", "999" }; - await AssertQuery( - ss => ss.Set().Where(c => strings.Contains(c.String))); - await AssertQuery( - ss => ss.Set().Where(c => !strings.Contains(c.String))); + await AssertQuery(ss => ss.Set().Where(c => strings.Contains(c.String))); + await AssertQuery(ss => ss.Set().Where(c => !strings.Contains(c.String))); } [ConditionalFact] @@ -445,10 +396,8 @@ public virtual async Task Parameter_collection_of_strings_Contains_nullable_stri { string?[] strings = ["10", "999"]; - await AssertQuery( - ss => ss.Set().Where(c => strings.Contains(c.NullableString))); - await AssertQuery( - ss => ss.Set().Where(c => !strings.Contains(c.NullableString))); + await AssertQuery(ss => ss.Set().Where(c => strings.Contains(c.NullableString))); + await AssertQuery(ss => ss.Set().Where(c => !strings.Contains(c.NullableString))); } [ConditionalFact] @@ -456,10 +405,8 @@ public virtual async Task Parameter_collection_of_nullable_strings_Contains_stri { var strings = new[] { "10", null }; - await AssertQuery( - ss => ss.Set().Where(c => strings.Contains(c.String))); - await AssertQuery( - ss => ss.Set().Where(c => !strings.Contains(c.String))); + await AssertQuery(ss => ss.Set().Where(c => strings.Contains(c.String))); + await AssertQuery(ss => ss.Set().Where(c => !strings.Contains(c.String))); } [ConditionalFact] @@ -467,10 +414,8 @@ public virtual async Task Parameter_collection_of_nullable_strings_Contains_null { var strings = new[] { "999", null }; - await AssertQuery( - ss => ss.Set().Where(c => strings.Contains(c.NullableString))); - await AssertQuery( - ss => ss.Set().Where(c => !strings.Contains(c.NullableString))); + await AssertQuery(ss => ss.Set().Where(c => strings.Contains(c.NullableString))); + await AssertQuery(ss => ss.Set().Where(c => !strings.Contains(c.NullableString))); } // See more nullability-related tests in NullSemanticsQueryTestBase @@ -483,8 +428,7 @@ public virtual Task Parameter_collection_of_DateTimes_Contains() new DateTime(2020, 1, 10, 12, 30, 0, DateTimeKind.Utc), new DateTime(9999, 1, 1, 0, 0, 0, DateTimeKind.Utc) }; - return AssertQuery( - ss => ss.Set().Where(c => dateTimes.Contains(c.DateTime))); + return AssertQuery(ss => ss.Set().Where(c => dateTimes.Contains(c.DateTime))); } [ConditionalFact] @@ -492,8 +436,7 @@ public virtual Task Parameter_collection_of_bools_Contains() { var bools = new[] { true }; - return AssertQuery( - ss => ss.Set().Where(c => bools.Contains(c.Bool))); + return AssertQuery(ss => ss.Set().Where(c => bools.Contains(c.Bool))); } [ConditionalFact] @@ -501,8 +444,7 @@ public virtual Task Parameter_collection_of_enums_Contains() { var enums = new[] { MyEnum.Value1, MyEnum.Value4 }; - return AssertQuery( - ss => ss.Set().Where(c => enums.Contains(c.Enum))); + return AssertQuery(ss => ss.Set().Where(c => enums.Contains(c.Enum))); } [ConditionalFact] @@ -557,8 +499,7 @@ public virtual Task Parameter_collection_Count_with_huge_number_of_values() var extra = Enumerable.Range(1000, (int)NumberOfValuesForHugeParameterCollectionTests); var ids = new[] { 2, 999 }.Concat(extra).ToArray(); - return AssertQuery( - ss => ss.Set().Where(c => ids.Count(i => i > c.Id) > 0)); + return AssertQuery(ss => ss.Set().Where(c => ids.Count(i => i > c.Id) > 0)); } [ConditionalFact] @@ -572,26 +513,21 @@ public virtual async Task Parameter_collection_of_ints_Contains_int_with_huge_nu var extra = Enumerable.Range(1000, (int)NumberOfValuesForHugeParameterCollectionTests); var ints = new[] { 10, 999 }.Concat(extra).ToArray(); - await AssertQuery( - ss => ss.Set().Where(c => ints.Contains(c.Int))); - await AssertQuery( - ss => ss.Set().Where(c => !ints.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => ints.Contains(c.Int))); + await AssertQuery(ss => ss.Set().Where(c => !ints.Contains(c.Int))); } [ConditionalFact] public virtual Task Column_collection_of_ints_Contains() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Contains(10))); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Contains(10))); [ConditionalFact] public virtual Task Column_collection_of_nullable_ints_Contains() - => AssertQuery( - ss => ss.Set().Where(c => c.NullableInts.Contains(10))); + => AssertQuery(ss => ss.Set().Where(c => c.NullableInts.Contains(10))); [ConditionalFact] public virtual Task Column_collection_of_nullable_ints_Contains_null() - => AssertQuery( - ss => ss.Set().Where(c => c.NullableInts.Contains(null))); + => AssertQuery(ss => ss.Set().Where(c => c.NullableInts.Contains(null))); [ConditionalFact] public virtual Task Column_collection_of_strings_contains_null() @@ -601,13 +537,11 @@ public virtual Task Column_collection_of_strings_contains_null() [ConditionalFact] public virtual Task Column_collection_of_nullable_strings_contains_null() - => AssertQuery( - ss => ss.Set().Where(c => c.NullableStrings.Contains(null))); + => AssertQuery(ss => ss.Set().Where(c => c.NullableStrings.Contains(null))); [ConditionalFact] public virtual Task Column_collection_of_bools_Contains() - => AssertQuery( - ss => ss.Set().Where(c => c.Bools.Contains(true))); + => AssertQuery(ss => ss.Set().Where(c => c.Bools.Contains(true))); [ConditionalFact] public virtual Task Column_collection_Count_method() @@ -617,18 +551,15 @@ public virtual Task Column_collection_Count_method() [ConditionalFact] public virtual Task Column_collection_Length() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Length == 2)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Length == 2)); [ConditionalFact] public virtual Task Column_collection_Count_with_predicate() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Count(i => i > 1) == 2)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Count(i => i > 1) == 2)); [ConditionalFact] // #33932 public virtual Task Column_collection_Where_Count() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Where(i => i > 1).Count() == 2)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Where(i => i > 1).Count() == 2)); [ConditionalFact] public virtual Task Column_collection_index_int() @@ -645,10 +576,9 @@ public virtual Task Column_collection_index_string() [ConditionalFact] public virtual Task Column_collection_index_datetime() => AssertQuery( - ss => ss.Set().Where( - c => c.DateTimes[1] == new DateTime(2020, 1, 10, 12, 30, 0, DateTimeKind.Utc)), - ss => ss.Set().Where( - c => (c.DateTimes.Length >= 2 ? c.DateTimes[1] : default) == new DateTime(2020, 1, 10, 12, 30, 0, DateTimeKind.Utc))); + ss => ss.Set().Where(c => c.DateTimes[1] == new DateTime(2020, 1, 10, 12, 30, 0, DateTimeKind.Utc)), + ss => ss.Set().Where(c + => (c.DateTimes.Length >= 2 ? c.DateTimes[1] : default) == new DateTime(2020, 1, 10, 12, 30, 0, DateTimeKind.Utc))); [ConditionalFact] public virtual Task Column_collection_index_beyond_end() @@ -699,24 +629,22 @@ public virtual Task Inline_collection_value_index_Column() [ConditionalFact] public virtual Task Inline_collection_List_value_index_Column() => AssertQuery( - ss => ss.Set().Where( - c => new List + ss => ss.Set().Where(c => new List + { + 1, + c.Int, + 3 + }[c.Int] + == 1), + ss => ss.Set().Where(c => (c.Int <= 2 + ? new List { 1, c.Int, 3 }[c.Int] - == 1), - ss => ss.Set().Where( - c => (c.Int <= 2 - ? new List - { - 1, - c.Int, - 3 - }[c.Int] - : -1) - == 1)); + : -1) + == 1)); // The JsonScalarExpression (ints[c.Int]) should get inferred from the column on the other side (c.Int), and that should propagate to // ints @@ -756,8 +684,7 @@ public virtual Task Column_collection_First() [ConditionalFact] public virtual Task Column_collection_FirstOrDefault() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.FirstOrDefault() == 1)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.FirstOrDefault() == 1)); [ConditionalFact] public virtual Task Column_collection_Single() @@ -773,38 +700,31 @@ public virtual Task Column_collection_SingleOrDefault() [ConditionalFact] public virtual Task Column_collection_Skip() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Skip(1).Count() == 2)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Skip(1).Count() == 2)); [ConditionalFact] public virtual Task Column_collection_Take() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Take(2).Contains(11))); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Take(2).Contains(11))); [ConditionalFact] public virtual Task Column_collection_Skip_Take() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Skip(1).Take(2).Contains(11))); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Skip(1).Take(2).Contains(11))); [ConditionalFact] public virtual Task Column_collection_Where_Skip() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Where(i => i > 1).Skip(1).Count() == 3)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Where(i => i > 1).Skip(1).Count() == 3)); [ConditionalFact] public virtual Task Column_collection_Where_Take() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Where(i => i > 1).Take(2).Count() == 2)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Where(i => i > 1).Take(2).Count() == 2)); [ConditionalFact] public virtual Task Column_collection_Where_Skip_Take() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Where(i => i > 1).Skip(1).Take(2).Count() == 1)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Where(i => i > 1).Skip(1).Take(2).Count() == 1)); [ConditionalFact] public virtual Task Column_collection_Contains_over_subquery() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Where(i => i > 1).Contains(11))); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Where(i => i > 1).Contains(11))); [ConditionalFact] public virtual Task Column_collection_OrderByDescending_ElementAt() @@ -824,8 +744,7 @@ public virtual Task Column_collection_Where_ElementAt() [ConditionalFact] public virtual Task Column_collection_Any() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Any())); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Any())); // If this test is failing because of DistinctAfterOrderByWithoutRowLimitingOperatorWarning, this is because EF warns/errors by // default for Distinct after OrderBy (without Skip/Take); but you likely have a naturally-ordered JSON collection, where the @@ -834,23 +753,20 @@ public virtual Task Column_collection_Any() // collections, exempting them from the warning. [ConditionalFact] public virtual Task Column_collection_Distinct() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Distinct().Count() == 3)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Distinct().Count() == 3)); [ConditionalFact] // #32505 public virtual Task Column_collection_SelectMany() - => AssertQuery( - ss => ss.Set().SelectMany(c => c.Ints)); + => AssertQuery(ss => ss.Set().SelectMany(c => c.Ints)); [ConditionalFact] public virtual Task Column_collection_SelectMany_with_filter() - => AssertQuery( - ss => ss.Set().SelectMany(c => c.Ints.Where(i => i > 1))); + => AssertQuery(ss => ss.Set().SelectMany(c => c.Ints.Where(i => i > 1))); [ConditionalFact] public virtual Task Column_collection_SelectMany_with_Select_to_anonymous_type() - => AssertQuery( - ss => ss.Set().SelectMany(c => c.Ints.Select(i => new { Original = i, Incremented = i + 1 }))); + => AssertQuery(ss + => ss.Set().SelectMany(c => c.Ints.Select(i => new { Original = i, Incremented = i + 1 }))); [ConditionalFact] public virtual Task Column_collection_projection_from_top_level() @@ -864,24 +780,21 @@ public virtual Task Column_collection_Join_parameter_collection() { var ints = new[] { 11, 111 }; - return AssertQuery( - ss => ss.Set() - .Where(c => c.Ints.Join(ints, i => i, j => j, (i, j) => new { I = i, J = j }).Count() == 2)); + return AssertQuery(ss => ss.Set() + .Where(c => c.Ints.Join(ints, i => i, j => j, (i, j) => new { I = i, J = j }).Count() == 2)); } [ConditionalFact] public virtual Task Inline_collection_Join_ordered_column_collection() - => AssertQuery( - ss => ss.Set() - .Where(c => new[] { 11, 111 }.Join(c.Ints, i => i, j => j, (i, j) => new { I = i, J = j }).Count() == 2)); + => AssertQuery(ss => ss.Set() + .Where(c => new[] { 11, 111 }.Join(c.Ints, i => i, j => j, (i, j) => new { I = i, J = j }).Count() == 2)); [ConditionalFact] public virtual Task Parameter_collection_Concat_column_collection() { int[] ints = [11, 111]; - return AssertQuery( - ss => ss.Set().Where(c => ints.Concat(c.Ints).Count() == 2)); + return AssertQuery(ss => ss.Set().Where(c => ints.Concat(c.Ints).Count() == 2)); } [ConditionalFact] // #33582 @@ -889,8 +802,7 @@ public virtual Task Parameter_collection_with_type_inference_for_JsonScalarExpre { string[] values = ["one", "two"]; - return AssertQuery( - ss => ss.Set().Select(c => c.Id != 0 ? values[c.Int % 2] : "foo")); + return AssertQuery(ss => ss.Set().Select(c => c.Id != 0 ? values[c.Int % 2] : "foo")); } [ConditionalFact] @@ -898,27 +810,22 @@ public virtual Task Column_collection_Union_parameter_collection() { var ints = new[] { 11, 111 }; - return AssertQuery( - ss => ss.Set().Where(c => c.Ints.Union(ints).Count() == 2)); + return AssertQuery(ss => ss.Set().Where(c => c.Ints.Union(ints).Count() == 2)); } [ConditionalFact] public virtual Task Column_collection_Intersect_inline_collection() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Intersect(new[] { 11, 111 }).Count() == 2)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Intersect(new[] { 11, 111 }).Count() == 2)); [ConditionalFact] public virtual Task Inline_collection_Except_column_collection() // Note that in relational, since the VALUES is on the left side of the set operation, it must assign column names, otherwise the // column coming out of the set operation has undetermined naming. - => AssertQuery( - ss => ss.Set().Where( - c => new[] { 11, 111 }.Except(c.Ints).Count(i => i % 2 == 1) == 2)); + => AssertQuery(ss => ss.Set().Where(c => new[] { 11, 111 }.Except(c.Ints).Count(i => i % 2 == 1) == 2)); [ConditionalFact] public virtual Task Column_collection_Where_Union() - => AssertQuery( - ss => ss.Set().Where(c => c.Ints.Where(i => i > 100).Union(new[] { 50 }).Count() == 2)); + => AssertQuery(ss => ss.Set().Where(c => c.Ints.Where(i => i > 100).Union(new[] { 50 }).Count() == 2)); [ConditionalFact] public virtual Task Column_collection_equality_parameter_collection() @@ -969,9 +876,8 @@ public virtual async Task Parameter_collection_in_subquery_Count_as_compiled_que // subquery as its table, and not directly to the parameter's table. // This creates an initially untyped ColumnExpression referencing the pushed-down subquery; it must also be inferred. // Note that this must be a compiled query, since with normal queries the Skip(1) gets client-evaluated. - var compiledQuery = EF.CompileQuery( - (PrimitiveCollectionsContext context, int[] ints) - => context.Set().Where(p => ints.Skip(1).Count(i => i > p.Id) == 1).Count()); + var compiledQuery = EF.CompileQuery((PrimitiveCollectionsContext context, int[] ints) + => context.Set().Where(p => ints.Skip(1).Count(i => i > p.Id) == 1).Count()); await using var context = Fixture.CreateContext(); var ints = new[] { 10, 111 }; @@ -987,9 +893,8 @@ public virtual async Task Parameter_collection_in_subquery_Union_column_collecti // subquery as its table, and not directly to the parameter's table. // This creates an initially untyped ColumnExpression referencing the pushed-down subquery; it must also be inferred. // Note that this must be a compiled query, since with normal queries the Skip(1) gets client-evaluated. - var compiledQuery = EF.CompileQuery( - (PrimitiveCollectionsContext context, int[] ints) - => context.Set().Where(p => ints.Skip(1).Union(p.Ints).Count() == 3)); + var compiledQuery = EF.CompileQuery((PrimitiveCollectionsContext context, int[] ints) + => context.Set().Where(p => ints.Skip(1).Union(p.Ints).Count() == 3)); await using var context = Fixture.CreateContext(); var ints = new[] { 10, 111 }; @@ -1003,8 +908,7 @@ public virtual Task Parameter_collection_in_subquery_Union_column_collection() { var ints = new[] { 10, 111 }; - return AssertQuery( - ss => ss.Set().Where(p => ints.Skip(1).Union(p.Ints).Count() == 3)); + return AssertQuery(ss => ss.Set().Where(p => ints.Skip(1).Union(p.Ints).Count() == 3)); } [ConditionalFact] @@ -1012,17 +916,15 @@ public virtual Task Parameter_collection_in_subquery_Union_column_collection_nes { var ints = new[] { 10, 111 }; - return AssertQuery( - ss => ss.Set().Where( - p => ints.Skip(1).Union(p.Ints.OrderBy(x => x).Skip(1).Distinct().OrderByDescending(x => x).Take(20)).Count() == 3)); + return AssertQuery(ss => ss.Set().Where(p + => ints.Skip(1).Union(p.Ints.OrderBy(x => x).Skip(1).Distinct().OrderByDescending(x => x).Take(20)).Count() == 3)); } [ConditionalFact] public virtual void Parameter_collection_in_subquery_and_Convert_as_compiled_query() { - var query = EF.CompileQuery( - (PrimitiveCollectionsContext context, object[] parameters) - => context.Set().Where(p => p.String == (string)parameters[0])); + var query = EF.CompileQuery((PrimitiveCollectionsContext context, object[] parameters) + => context.Set().Where(p => p.String == (string)parameters[0])); using var context = Fixture.CreateContext(); @@ -1032,9 +934,8 @@ public virtual void Parameter_collection_in_subquery_and_Convert_as_compiled_que [ConditionalFact] public virtual async Task Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query() { - var compiledQuery = EF.CompileQuery( - (PrimitiveCollectionsContext context, int[] ints1, int[] ints2) - => context.Set().Where(p => ints1.Skip(1).Union(ints2).Count() == 3)); + var compiledQuery = EF.CompileQuery((PrimitiveCollectionsContext context, int[] ints1, int[] ints2) + => context.Set().Where(p => ints1.Skip(1).Union(ints2).Count() == 3)); await using var context = Fixture.CreateContext(); var ints1 = new[] { 10, 111 }; @@ -1050,8 +951,7 @@ public virtual Task Column_collection_in_subquery_Union_parameter_collection() // The Skip causes a pushdown into a subquery before the Union. This creates an initially untyped ColumnExpression referencing the // pushed-down subquery; it must also be inferred - return AssertQuery( - ss => ss.Set().Where(c => c.Ints.Skip(1).Union(ints).Count() == 3)); + return AssertQuery(ss => ss.Set().Where(c => c.Ints.Skip(1).Union(ints).Count() == 3)); } [ConditionalFact] @@ -1119,11 +1019,10 @@ public virtual Task Project_collection_of_ints_with_ToList_and_FirstOrDefault() [ConditionalFact] public virtual Task Project_empty_collection_of_nullables_and_collection_only_containing_nulls() => AssertQuery( - ss => ss.Set().OrderBy(x => x.Id).Select( - x => new - { - Empty = x.NullableInts.Where(x => false).ToList(), OnlyNull = x.NullableInts.Where(x => x == null).ToList(), - }), + ss => ss.Set().OrderBy(x => x.Id).Select(x => new + { + Empty = x.NullableInts.Where(x => false).ToList(), OnlyNull = x.NullableInts.Where(x => x == null).ToList(), + }), assertOrder: true, elementAsserter: (e, a) => { @@ -1134,14 +1033,13 @@ public virtual Task Project_empty_collection_of_nullables_and_collection_only_co [ConditionalFact] public virtual Task Project_multiple_collections() => AssertQuery( - ss => ss.Set().OrderBy(x => x.Id).Select( - x => new - { - Ints = x.Ints.ToList(), - OrderedInts = x.Ints.OrderByDescending(xx => xx).ToList(), - FilteredDateTimes = x.DateTimes.Where(xx => xx.Day != 1).ToList(), - FilteredDateTimes2 = x.DateTimes.Where(xx => xx > new DateTime(2000, 1, 1)).ToList() - }), + ss => ss.Set().OrderBy(x => x.Id).Select(x => new + { + Ints = x.Ints.ToList(), + OrderedInts = x.Ints.OrderByDescending(xx => xx).ToList(), + FilteredDateTimes = x.DateTimes.Where(xx => xx.Day != 1).ToList(), + FilteredDateTimes2 = x.DateTimes.Where(xx => xx > new DateTime(2000, 1, 1)).ToList() + }), elementAsserter: (e, a) => { AssertCollection(e.Ints, a.Ints, ordered: true); @@ -1154,8 +1052,8 @@ public virtual Task Project_multiple_collections() [ConditionalFact] public virtual Task Project_primitive_collections_element() => AssertQuery( - ss => ss.Set().Where(x => x.Id < 4).OrderBy(x => x.Id).Select( - x => new + ss => ss.Set().Where(x => x.Id < 4).OrderBy(x => x.Id).Select(x + => new { Indexer = x.Ints[0], EnumerableElementAt = x.DateTimes.ElementAt(0), @@ -1180,13 +1078,12 @@ public virtual Task Project_inline_collection() public virtual Task Project_inline_collection_with_Union() => AssertQuery( ss => ss.Set() - .Select( - x => new - { - x.Id, - Values = new[] { x.String } - .Union(ss.Set().OrderBy(xx => xx.Id).Select(xx => xx.String)).ToList() - }) + .Select(x => new + { + x.Id, + Values = new[] { x.String } + .Union(ss.Set().OrderBy(xx => xx.Id).Select(xx => xx.String)).ToList() + }) .OrderBy(x => x.Id), elementAsserter: (e, a) => { @@ -1199,13 +1096,12 @@ public virtual Task Project_inline_collection_with_Union() public virtual Task Project_inline_collection_with_Concat() => AssertQuery( ss => ss.Set() - .Select( - x => new - { - x.Id, - Values = new[] { x.String } - .Concat(ss.Set().OrderBy(xx => xx.Id).Select(xx => xx.String)).ToList() - }) + .Select(x => new + { + x.Id, + Values = new[] { x.String } + .Concat(ss.Set().OrderBy(xx => xx.Id).Select(xx => xx.String)).ToList() + }) .OrderBy(x => x.Id), elementAsserter: (e, a) => { @@ -1232,8 +1128,7 @@ public virtual Task Nested_contains_with_Lists_and_no_inferred_type_mapping() // Note that in this query, the outer Contains really has no type mapping, neither for its source (collection parameter), nor // for its item (the conditional expression returns constants). The default type mapping must be applied. - return AssertQuery( - ss => ss.Set().Where(e => strings.Contains(ints.Contains(e.Int) ? "one" : "two"))); + return AssertQuery(ss => ss.Set().Where(e => strings.Contains(ints.Contains(e.Int) ? "one" : "two"))); } [ConditionalFact] // #32208, #32215 @@ -1244,14 +1139,13 @@ public virtual Task Nested_contains_with_arrays_and_no_inferred_type_mapping() // Note that in this query, the outer Contains really has no type mapping, neither for its source (collection parameter), nor // for its item (the conditional expression returns constants). The default type mapping must be applied. - return AssertQuery( - ss => ss.Set().Where(e => strings.Contains(ints.Contains(e.Int) ? "one" : "two"))); + return AssertQuery(ss => ss.Set().Where(e => strings.Contains(ints.Contains(e.Int) ? "one" : "two"))); } [ConditionalFact] public virtual Task Values_of_enum_casted_to_underlying_value() - => AssertQuery( - ss => ss.Set().Where(x => Enum.GetValues().Cast().Count(y => y == x.Int) > 0)); + => AssertQuery(ss + => ss.Set().Where(x => Enum.GetValues().Cast().Count(y => y == x.Int) > 0)); public abstract class PrimitiveCollectionsQueryFixtureBase : SharedStoreFixtureBase, IQueryFixtureBase { @@ -1264,16 +1158,15 @@ public Func GetContextCreator() => () => CreateContext(); protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) - => modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.WrappedId).HasConversion(); - b.Property(e => e.NullableWrappedId).HasConversion(); - b.Property(e => e.NullableWrappedIdWithNullableComparer).HasConversion(); - }); + => modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.WrappedId).HasConversion(); + b.Property(e => e.NullableWrappedId).HasConversion(); + b.Property(e => e.NullableWrappedIdWithNullableComparer).HasConversion(); + }); - protected class WrappedIdConverter() : ValueConverter(v => v.Value, v => new(v)); + protected class WrappedIdConverter() : ValueConverter(v => v.Value, v => new WrappedId(v)); // Note that value comparers over nullable value types are not a good idea, unless the comparer is handling nulls itself. protected class NullableWrappedIdConverter() : ValueConverter( @@ -1377,11 +1270,11 @@ private static IReadOnlyList CreatePrimitiveArrayEnt DateTime = new DateTime(2020, 1, 10, 12, 30, 0, DateTimeKind.Utc), Bool = true, Enum = MyEnum.Value1, - WrappedId = new(22), + WrappedId = new WrappedId(22), NullableInt = 10, NullableString = "10", - NullableWrappedId = new(22), - NullableWrappedIdWithNullableComparer = new(22), + NullableWrappedId = new WrappedId(22), + NullableWrappedIdWithNullableComparer = new WrappedId(22), Ints = [1, 10], Strings = ["1", "10"], DateTimes = @@ -1401,7 +1294,7 @@ private static IReadOnlyList CreatePrimitiveArrayEnt DateTime = new DateTime(2020, 1, 11, 12, 30, 0, DateTimeKind.Utc), Bool = false, Enum = MyEnum.Value2, - WrappedId = new(22), + WrappedId = new WrappedId(22), NullableInt = null, NullableString = null, NullableWrappedId = null, @@ -1427,11 +1320,11 @@ private static IReadOnlyList CreatePrimitiveArrayEnt DateTime = new DateTime(2022, 1, 10, 12, 30, 0, DateTimeKind.Utc), Bool = true, Enum = MyEnum.Value1, - WrappedId = new(22), + WrappedId = new WrappedId(22), NullableInt = 20, NullableString = "20", - NullableWrappedId = new(22), - NullableWrappedIdWithNullableComparer = new(22), + NullableWrappedId = new WrappedId(22), + NullableWrappedIdWithNullableComparer = new WrappedId(22), Ints = [1, 1, 10, 10, 10, 1, 10], Strings = ["1", "10", "10", "1", "1"], DateTimes = @@ -1455,7 +1348,7 @@ private static IReadOnlyList CreatePrimitiveArrayEnt DateTime = new DateTime(2024, 1, 11, 12, 30, 0, DateTimeKind.Utc), Bool = false, Enum = MyEnum.Value2, - WrappedId = new(22), + WrappedId = new WrappedId(22), NullableInt = null, NullableString = null, NullableWrappedId = null, @@ -1486,7 +1379,7 @@ private static IReadOnlyList CreatePrimitiveArrayEnt DateTime = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc), Bool = false, Enum = MyEnum.Value1, - WrappedId = new(22), + WrappedId = new WrappedId(22), NullableWrappedIdWithNullableComparer = null, NullableInt = null, NullableString = null, diff --git a/test/EFCore.Specification.Tests/Query/QueryFilterFuncletizationTestBase.cs b/test/EFCore.Specification.Tests/Query/QueryFilterFuncletizationTestBase.cs index cb14bc9dbde..2b20ff5c23b 100644 --- a/test/EFCore.Specification.Tests/Query/QueryFilterFuncletizationTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/QueryFilterFuncletizationTestBase.cs @@ -312,8 +312,7 @@ public virtual void Local_variable_from_OnModelCreating_can_throw_exception() Assert.Equal( CoreStrings.ExpressionParameterizationExceptionSensitive( "value(Microsoft.EntityFrameworkCore.Query.QueryFilterFuncletizationContext+<>c__DisplayClass29_0).flag.Enabled"), - Assert.Throws( - () => context.Set().ToList()).Message); + Assert.Throws(() => context.Set().ToList()).Message); } [ConditionalFact] diff --git a/test/EFCore.Specification.Tests/Query/QueryTestBase.cs b/test/EFCore.Specification.Tests/Query/QueryTestBase.cs index 8f452a5e099..a35c8f87f02 100644 --- a/test/EFCore.Specification.Tests/Query/QueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/QueryTestBase.cs @@ -18,7 +18,9 @@ protected QueryTestBase(TFixture fixture) } protected TFixture Fixture { get; } - protected QueryAsserter QueryAsserter => _queryAsserterCache.Value; + + protected QueryAsserter QueryAsserter + => _queryAsserterCache.Value; private QueryAsserter CreateQueryAsserter() => CreateQueryAsserter(Fixture); @@ -55,7 +57,8 @@ public Task AssertQuery( bool assertEmpty = false, QueryTrackingBehavior? queryTrackingBehavior = null, [CallerMemberName] string testMethodName = "") - => AssertQuery(async: true, query, query, elementSorter, elementAsserter, assertOrder, assertEmpty, queryTrackingBehavior, testMethodName); + => AssertQuery( + async: true, query, query, elementSorter, elementAsserter, assertOrder, assertEmpty, queryTrackingBehavior, testMethodName); public Task AssertQuery( Func> actualQuery, @@ -66,9 +69,9 @@ public Task AssertQuery( bool assertEmpty = false, QueryTrackingBehavior? queryTrackingBehavior = null, [CallerMemberName] string testMethodName = "") - => TestOutputWrapper( - () => QueryAsserter.AssertQuery( - actualQuery, expectedQuery, elementSorter, elementAsserter, assertOrder, assertEmpty, async: true, queryTrackingBehavior, testMethodName)); + => TestOutputWrapper(() => QueryAsserter.AssertQuery( + actualQuery, expectedQuery, elementSorter, elementAsserter, assertOrder, assertEmpty, async: true, queryTrackingBehavior, + testMethodName)); public Task AssertQuery( bool async, @@ -79,7 +82,8 @@ public Task AssertQuery( bool assertEmpty = false, QueryTrackingBehavior? queryTrackingBehavior = null, [CallerMemberName] string testMethodName = "") - => AssertQuery(async, query, query, elementSorter, elementAsserter, assertOrder, assertEmpty, queryTrackingBehavior, testMethodName); + => AssertQuery( + async, query, query, elementSorter, elementAsserter, assertOrder, assertEmpty, queryTrackingBehavior, testMethodName); public Task AssertQuery( bool async, @@ -91,9 +95,9 @@ public Task AssertQuery( bool assertEmpty = false, QueryTrackingBehavior? queryTrackingBehavior = null, [CallerMemberName] string testMethodName = "") - => TestOutputWrapper( - () => QueryAsserter.AssertQuery( - actualQuery, expectedQuery, elementSorter, elementAsserter, assertOrder, assertEmpty, async, queryTrackingBehavior, testMethodName)); + => TestOutputWrapper(() => QueryAsserter.AssertQuery( + actualQuery, expectedQuery, elementSorter, elementAsserter, assertOrder, assertEmpty, async, queryTrackingBehavior, + testMethodName)); public Task AssertQueryScalar( Func> query, @@ -122,8 +126,8 @@ public Task AssertQueryScalar( bool assertEmpty = false, [CallerMemberName] string testMethodName = "") where TResult : struct - => TestOutputWrapper( - () => AssertQueryScalar(async: true, actualQuery, expectedQuery, asserter, assertOrder, assertEmpty, testMethodName)); + => TestOutputWrapper(() => AssertQueryScalar( + async: true, actualQuery, expectedQuery, asserter, assertOrder, assertEmpty, testMethodName)); public Task AssertQueryScalar( bool async, @@ -134,8 +138,8 @@ public Task AssertQueryScalar( bool assertEmpty = false, [CallerMemberName] string testMethodName = "") where TResult : struct - => TestOutputWrapper( - () => QueryAsserter.AssertQueryScalar(actualQuery, expectedQuery, asserter, assertOrder, assertEmpty, async, testMethodName)); + => TestOutputWrapper(() => QueryAsserter.AssertQueryScalar( + actualQuery, expectedQuery, asserter, assertOrder, assertEmpty, async, testMethodName)); public Task AssertQueryScalar( bool async, @@ -156,8 +160,8 @@ public Task AssertQueryScalar( bool assertEmpty = false, [CallerMemberName] string testMethodName = "") where TResult : struct - => TestOutputWrapper( - () => QueryAsserter.AssertQueryScalar(actualQuery, expectedQuery, asserter, assertOrder, assertEmpty, async, testMethodName)); + => TestOutputWrapper(() => QueryAsserter.AssertQueryScalar( + actualQuery, expectedQuery, asserter, assertOrder, assertEmpty, async, testMethodName)); protected Task AssertSingleResult( bool async, @@ -245,8 +249,8 @@ protected Task AssertElementAtOrDefault( Func actualIndex, Func expectedIndex, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertElementAtOrDefault(actualQuery, expectedQuery, actualIndex, expectedIndex, asserter, async)); + => TestOutputWrapper(() + => QueryAsserter.AssertElementAtOrDefault(actualQuery, expectedQuery, actualIndex, expectedIndex, asserter, async)); protected Task AssertFirst( Func> query, @@ -280,8 +284,8 @@ protected Task AssertFirst( Expression> actualPredicate, Expression> expectedPredicate, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertFirst(actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertFirst( + actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); protected Task AssertFirstOrDefault( Func> query, @@ -316,8 +320,8 @@ protected Task AssertFirstOrDefault( Expression> actualPredicate, Expression> expectedPredicate, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertFirstOrDefault(actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertFirstOrDefault( + actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); protected Task AssertSingle( bool async, @@ -346,8 +350,8 @@ protected Task AssertSingle( Expression> actualPredicate, Expression> expectedPredicate, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertSingle(actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertSingle( + actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); protected Task AssertSingleOrDefault( bool async, @@ -376,8 +380,8 @@ protected Task AssertSingleOrDefault( Expression> actualPredicate, Expression> expectedPredicate, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertSingleOrDefault(actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertSingleOrDefault( + actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); protected Task AssertLast( bool async, @@ -406,8 +410,8 @@ protected Task AssertLast( Expression> actualPredicate, Expression> expectedPredicate, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertLast(actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertLast( + actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); protected Task AssertLastOrDefault( bool async, @@ -436,8 +440,8 @@ protected Task AssertLastOrDefault( Expression> actualPredicate, Expression> expectedPredicate, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertLastOrDefault(actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertLastOrDefault( + actualQuery, expectedQuery, actualPredicate, expectedPredicate, asserter, async)); protected Task AssertCount( Func> query) @@ -997,8 +1001,8 @@ protected Task AssertAverage( Expression> actualSelector, Expression> expectedSelector, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertAverage( + actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); protected Task AssertAverage( bool async, @@ -1014,8 +1018,8 @@ protected Task AssertAverage( Expression> actualSelector, Expression> expectedSelector, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertAverage( + actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); protected Task AssertAverage( bool async, @@ -1031,8 +1035,8 @@ protected Task AssertAverage( Expression> actualSelector, Expression> expectedSelector, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertAverage( + actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); protected Task AssertAverage( bool async, @@ -1048,8 +1052,8 @@ protected Task AssertAverage( Expression> actualSelector, Expression> expectedSelector, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertAverage( + actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); protected Task AssertAverage( bool async, @@ -1065,8 +1069,8 @@ protected Task AssertAverage( Expression> actualSelector, Expression> expectedSelector, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertAverage( + actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); protected Task AssertAverage( bool async, @@ -1082,8 +1086,8 @@ protected Task AssertAverage( Expression> actualSelector, Expression> expectedSelector, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertAverage( + actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); protected Task AssertAverage( bool async, @@ -1099,8 +1103,8 @@ protected Task AssertAverage( Expression> actualSelector, Expression> expectedSelector, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertAverage( + actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); protected Task AssertAverage( bool async, @@ -1116,8 +1120,8 @@ protected Task AssertAverage( Expression> actualSelector, Expression> expectedSelector, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertAverage( + actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); protected Task AssertAverage( bool async, @@ -1133,8 +1137,8 @@ protected Task AssertAverage( Expression> actualSelector, Expression> expectedSelector, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertAverage( + actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); protected Task AssertAverage( bool async, @@ -1150,8 +1154,8 @@ protected Task AssertAverage( Expression> actualSelector, Expression> expectedSelector, Action? asserter = null) - => TestOutputWrapper( - () => QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); + => TestOutputWrapper(() => QueryAsserter.AssertAverage( + actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, async)); #endregion diff --git a/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesFixtureBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesFixtureBase.cs index 45537b199a5..7bcd3fbfe8f 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesFixtureBase.cs @@ -5,7 +5,8 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.ComplexProperties; public abstract class ComplexPropertiesFixtureBase : RelationshipsQueryFixtureBase { - protected override string StoreName => "ComplexRelationshipsQueryTest"; + protected override string StoreName + => "ComplexRelationshipsQueryTest"; protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { @@ -13,26 +14,29 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(b => { - b.ComplexProperty(e => e.RequiredRelated, rrb => - { - rrb.ComplexProperty(r => r.RequiredNested); - rrb.ComplexProperty(r => r.OptionalNested); - rrb.ComplexCollection(r => r.NestedCollection); - }); - - b.ComplexProperty(e => e.OptionalRelated, orb => - { - orb.ComplexProperty(r => r.RequiredNested); - orb.ComplexProperty(r => r.OptionalNested); - orb.ComplexCollection(r => r.NestedCollection); - }); - - b.ComplexCollection(e => e.RelatedCollection, rcb => - { - rcb.ComplexProperty(r => r.RequiredNested); - rcb.ComplexProperty(r => r.OptionalNested); - rcb.ComplexCollection(r => r.NestedCollection); - }); + b.ComplexProperty( + e => e.RequiredRelated, rrb => + { + rrb.ComplexProperty(r => r.RequiredNested); + rrb.ComplexProperty(r => r.OptionalNested); + rrb.ComplexCollection(r => r.NestedCollection); + }); + + b.ComplexProperty( + e => e.OptionalRelated, orb => + { + orb.ComplexProperty(r => r.RequiredNested); + orb.ComplexProperty(r => r.OptionalNested); + orb.ComplexCollection(r => r.NestedCollection); + }); + + b.ComplexCollection( + e => e.RelatedCollection, rcb => + { + rcb.ComplexProperty(r => r.RequiredNested); + rcb.ComplexProperty(r => r.OptionalNested); + rcb.ComplexCollection(r => r.NestedCollection); + }); }); } @@ -42,4 +46,3 @@ public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder build => builder.ConfigureWarnings(b => b.Default(WarningBehavior.Ignore).Log(CoreEventId.MappedComplexPropertyIgnoredWarning)); } - diff --git a/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesMiscellaneousTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesMiscellaneousTestBase.cs index bfae04d82e0..ec85f9610e4 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesMiscellaneousTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesMiscellaneousTestBase.cs @@ -5,4 +5,4 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.ComplexProperties; public abstract class ComplexPropertiesMiscellaneousTestBase(TFixture fixture) : RelationshipsMiscellaneousTestBase(fixture) - where TFixture : ComplexPropertiesFixtureBase, new(); + where TFixture : ComplexPropertiesFixtureBase, new(); diff --git a/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesProjectionTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesProjectionTestBase.cs index 1985febdb1e..c68684a4e5d 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesProjectionTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesProjectionTestBase.cs @@ -5,4 +5,4 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.ComplexProperties; public abstract class ComplexPropertiesProjectionTestBase(TFixture fixture) : RelationshipsProjectionTestBase(fixture) - where TFixture : ComplexPropertiesFixtureBase, new(); + where TFixture : ComplexPropertiesFixtureBase, new(); diff --git a/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesStructuralEqualityTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesStructuralEqualityTestBase.cs index e4618cdd783..6af47ef6e15 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesStructuralEqualityTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/ComplexPropertiesStructuralEqualityTestBase.cs @@ -29,13 +29,33 @@ public override Task Not_equals() public override Task Nested_with_inline() => AssertQuery( ss => ss.Set() - .Where(e => e.RequiredRelated.RequiredNested == new NestedType { Id = 1000, Name = "Root1_RequiredRelated_RequiredNested", Int = 8, String = "foo" }), + .Where(e => e.RequiredRelated.RequiredNested + == new NestedType + { + Id = 1000, + Name = "Root1_RequiredRelated_RequiredNested", + Int = 8, + String = "foo" + }), ss => ss.Set() - .Where(e => e.RequiredRelated.RequiredNested.Equals(new NestedType { Id = 1000, Name = "Root1_RequiredRelated_RequiredNested", Int = 8, String = "foo" }))); + .Where(e => e.RequiredRelated.RequiredNested.Equals( + new NestedType + { + Id = 1000, + Name = "Root1_RequiredRelated_RequiredNested", + Int = 8, + String = "foo" + }))); public override async Task Nested_with_parameter() { - var nested = new NestedType { Id = 1000, Name = "Root1_RequiredRelated_RequiredNested", Int = 8, String = "foo" }; + var nested = new NestedType + { + Id = 1000, + Name = "Root1_RequiredRelated_RequiredNested", + Int = 8, + String = "foo" + }; await AssertQuery( ss => ss.Set().Where(e => e.RequiredRelated.RequiredNested == nested), @@ -45,29 +65,68 @@ await AssertQuery( public override Task Two_nested_collections() => AssertQuery( ss => ss.Set().Where(e => e.RequiredRelated.NestedCollection == e.OptionalRelated!.NestedCollection), - ss => ss.Set().Where(e => e.OptionalRelated != null && e.RequiredRelated.NestedCollection.SequenceEqual(e.OptionalRelated!.NestedCollection))); + ss => ss.Set().Where(e + => e.OptionalRelated != null && e.RequiredRelated.NestedCollection.SequenceEqual(e.OptionalRelated!.NestedCollection))); public override Task Nested_collection_with_inline() => AssertQuery( ss => ss.Set() - .Where(e => e.RequiredRelated.NestedCollection == new List - { - new() { Id = 1002, Name = "Root1_RequiredRelated_NestedCollection_1", Int = 8, String = "foo" }, - new() { Id = 1003, Name = "Root1_RequiredRelated_NestedCollection_2", Int = 8, String = "foo" } - }), + .Where(e => e.RequiredRelated.NestedCollection + == new List + { + new() + { + Id = 1002, + Name = "Root1_RequiredRelated_NestedCollection_1", + Int = 8, + String = "foo" + }, + new() + { + Id = 1003, + Name = "Root1_RequiredRelated_NestedCollection_2", + Int = 8, + String = "foo" + } + }), ss => ss.Set() - .Where(e => e.RequiredRelated.NestedCollection.SequenceEqual(new List - { - new() { Id = 1002, Name = "Root1_RequiredRelated_NestedCollection_1", Int = 8, String = "foo" }, - new() { Id = 1003, Name = "Root1_RequiredRelated_NestedCollection_2", Int = 8, String = "foo" } - }))); + .Where(e => e.RequiredRelated.NestedCollection.SequenceEqual( + new List + { + new() + { + Id = 1002, + Name = "Root1_RequiredRelated_NestedCollection_1", + Int = 8, + String = "foo" + }, + new() + { + Id = 1003, + Name = "Root1_RequiredRelated_NestedCollection_2", + Int = 8, + String = "foo" + } + }))); public override async Task Nested_collection_with_parameter() { var nestedCollection = new List { - new() { Id = 1002, Name = "Root1_RequiredRelated_NestedCollection_1", Int = 8, String = "foo" }, - new() { Id = 1003, Name = "Root1_RequiredRelated_NestedCollection_2", Int = 8, String = "foo" } + new() + { + Id = 1002, + Name = "Root1_RequiredRelated_NestedCollection_1", + Int = 8, + String = "foo" + }, + new() + { + Id = 1003, + Name = "Root1_RequiredRelated_NestedCollection_2", + Int = 8, + String = "foo" + } }; await AssertQuery( diff --git a/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/TrackingRewriter.cs b/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/TrackingRewriter.cs index 68e21fb6c57..91005899021 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/TrackingRewriter.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/ComplexProperties/TrackingRewriter.cs @@ -6,10 +6,12 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.ComplexProperties; internal class TrackingRewriter(QueryTrackingBehavior queryTrackingBehavior) : ExpressionVisitor { private static readonly MethodInfo AsNoTrackingMethodInfo - = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo().GetDeclaredMethod(nameof(EntityFrameworkQueryableExtensions.AsNoTracking))!; + = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo() + .GetDeclaredMethod(nameof(EntityFrameworkQueryableExtensions.AsNoTracking))!; private static readonly MethodInfo AsNoTrackingWithIdentityResolutionMethodInfo - = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo().GetDeclaredMethod(nameof(EntityFrameworkQueryableExtensions.AsNoTrackingWithIdentityResolution))!; + = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo() + .GetDeclaredMethod(nameof(EntityFrameworkQueryableExtensions.AsNoTrackingWithIdentityResolution))!; protected override Expression VisitExtension(Expression expression) => expression is EntityQueryRootExpression root diff --git a/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsCollectionTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsCollectionTestBase.cs index 953d1cc7477..ce9fd4df22c 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsCollectionTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsCollectionTestBase.cs @@ -4,6 +4,6 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; public abstract class NavigationsCollectionTestBase(TFixture fixture) : RelationshipsCollectionTestBase(fixture) - where TFixture : NavigationsFixtureBase, new() + where TFixture : NavigationsFixtureBase, new() { } diff --git a/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsFixtureBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsFixtureBase.cs index 607916224ef..2991bae9692 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsFixtureBase.cs @@ -5,9 +5,11 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; public abstract class NavigationsFixtureBase : RelationshipsQueryFixtureBase { - protected override string StoreName => "NavigationsQueryTest"; + protected override string StoreName + => "NavigationsQueryTest"; - public override bool AreCollectionsOrdered => false; + public override bool AreCollectionsOrdered + => false; protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { @@ -22,7 +24,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con b.HasOne(r => r.RequiredRelated) .WithOne(r => r.RequiredRelatedInverse) .HasForeignKey(r => r.RequiredRelatedId) - .IsRequired(true) + .IsRequired() .OnDelete(DeleteBehavior.NoAction); // TODO: Move to SQL Server b.HasOne(r => r.OptionalRelated) @@ -41,7 +43,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con b.HasOne(r => r.RequiredNested) .WithOne(r => r.RequiredNestedInverse) .HasForeignKey(r => r.RequiredNestedId) - .IsRequired(true) + .IsRequired() .OnDelete(DeleteBehavior.NoAction); // TODO: Move to SQL Server b.HasOne(e => e.OptionalNested) diff --git a/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsIncludeTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsIncludeTestBase.cs index 7b0206016d5..84811343e12 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsIncludeTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsIncludeTestBase.cs @@ -6,32 +6,28 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; public abstract class NavigationsIncludeTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : NavigationsFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_required(bool async) => AssertQuery( async, ss => ss.Set().Include(x => x.RequiredRelated), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.RequiredRelated))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_optional(bool async) => AssertQuery( async, ss => ss.Set().Include(x => x.OptionalRelated), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.OptionalRelated!))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_collection(bool async) => AssertQuery( async, ss => ss.Set().Include(x => x.RelatedCollection), elementAsserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(x => x.RelatedCollection))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_required_optional_and_collection(bool async) => AssertQuery( async, @@ -47,8 +43,7 @@ public virtual Task Include_required_optional_and_collection(bool async) new ExpectedInclude(x => x.OptionalRelated!), new ExpectedInclude(x => x.RelatedCollection))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_nested(bool async) => AssertQuery( async, @@ -59,8 +54,7 @@ public virtual Task Include_nested(bool async) new ExpectedInclude(x => x.RequiredRelated), new ExpectedInclude(x => x.RequiredNested, "RequiredRelated"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_nested_optional(bool async) => AssertQuery( async, @@ -71,8 +65,7 @@ public virtual Task Include_nested_optional(bool async) new ExpectedInclude(x => x.OptionalRelated!), new ExpectedInclude(x => x.OptionalNested!, "OptionalRelated"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_nested_collection(bool async) => AssertQuery( async, @@ -83,8 +76,7 @@ public virtual Task Include_nested_collection(bool async) new ExpectedInclude(x => x.RequiredRelated), new ExpectedInclude(x => x.NestedCollection, "RequiredRelated"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_nested_collection_on_optional(bool async) => AssertQuery( async, @@ -95,8 +87,7 @@ public virtual Task Include_nested_collection_on_optional(bool async) new ExpectedInclude(x => x.OptionalRelated!), new ExpectedInclude(x => x.NestedCollection, "OptionalRelated"))); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Include_nested_collection_on_collection(bool async) => AssertQuery( async, diff --git a/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsMiscellaneousTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsMiscellaneousTestBase.cs index 25615f24f66..dfa978f48ca 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsMiscellaneousTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsMiscellaneousTestBase.cs @@ -5,6 +5,6 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; public abstract class NavigationsMiscellaneousTestBase(TFixture fixture) : RelationshipsMiscellaneousTestBase(fixture) - where TFixture : NavigationsFixtureBase, new() + where TFixture : NavigationsFixtureBase, new() { } diff --git a/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsProjectionTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsProjectionTestBase.cs index 66ad5d0c5bf..48e88329f42 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsProjectionTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/Navigations/NavigationsProjectionTestBase.cs @@ -5,6 +5,6 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; public abstract class NavigationsProjectionTestBase(TFixture fixture) : RelationshipsProjectionTestBase(fixture) - where TFixture : NavigationsFixtureBase, new() + where TFixture : NavigationsFixtureBase, new() { } diff --git a/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsCollectionTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsCollectionTestBase.cs index f0239ba139f..293ac767559 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsCollectionTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsCollectionTestBase.cs @@ -4,7 +4,7 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.OwnedNavigations; public abstract class OwnedNavigationsCollectionTestBase(TFixture fixture) : RelationshipsCollectionTestBase(fixture) - where TFixture : OwnedNavigationsFixtureBase, new() + where TFixture : OwnedNavigationsFixtureBase, new() { public override Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) => AssertOwnedTrackingQuery(queryTrackingBehavior, () => base.Distinct_projected(queryTrackingBehavior)); diff --git a/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsFixtureBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsFixtureBase.cs index 675b58d7be5..3143c063549 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsFixtureBase.cs @@ -5,7 +5,8 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.OwnedNavigations; public abstract class OwnedNavigationsFixtureBase : RelationshipsQueryFixtureBase { - protected override string StoreName => "OwnedNavigationsQueryTest"; + protected override string StoreName + => "OwnedNavigationsQueryTest"; protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { @@ -13,48 +14,51 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(b => { - b.OwnsOne(e => e.RequiredRelated, rrb => - { - rrb.Property(x => x.Id).ValueGeneratedNever(); + b.OwnsOne( + e => e.RequiredRelated, rrb => + { + rrb.Property(x => x.Id).ValueGeneratedNever(); - rrb.OwnsOne(r => r.RequiredNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); - rrb.Navigation(x => x.RequiredNested).IsRequired(true); + rrb.OwnsOne(r => r.RequiredNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); + rrb.Navigation(x => x.RequiredNested).IsRequired(); - rrb.OwnsOne(r => r.OptionalNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); - rrb.Navigation(x => x.RequiredNested).IsRequired(false); + rrb.OwnsOne(r => r.OptionalNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); + rrb.Navigation(x => x.RequiredNested).IsRequired(false); - rrb.OwnsMany(r => r.NestedCollection, rcb => rcb.Property(x => x.Id).ValueGeneratedNever()); - }); - b.Navigation(x => x.RequiredRelated).IsRequired(true); + rrb.OwnsMany(r => r.NestedCollection, rcb => rcb.Property(x => x.Id).ValueGeneratedNever()); + }); + b.Navigation(x => x.RequiredRelated).IsRequired(); - b.OwnsOne(e => e.OptionalRelated, orb => - { - orb.Property(x => x.Id).ValueGeneratedNever(); + b.OwnsOne( + e => e.OptionalRelated, orb => + { + orb.Property(x => x.Id).ValueGeneratedNever(); - orb.OwnsOne(r => r.RequiredNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); - orb.Navigation(x => x.RequiredNested).IsRequired(true); + orb.OwnsOne(r => r.RequiredNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); + orb.Navigation(x => x.RequiredNested).IsRequired(); - orb.OwnsOne(r => r.OptionalNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); - orb.Navigation(x => x.RequiredNested).IsRequired(false); + orb.OwnsOne(r => r.OptionalNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); + orb.Navigation(x => x.RequiredNested).IsRequired(false); - orb.Ignore(r => r.NestedCollection); + orb.Ignore(r => r.NestedCollection); - orb.OwnsMany(r => r.NestedCollection, rcb => rcb.Property(x => x.Id).ValueGeneratedNever()); - }); + orb.OwnsMany(r => r.NestedCollection, rcb => rcb.Property(x => x.Id).ValueGeneratedNever()); + }); b.Navigation(x => x.OptionalRelated).IsRequired(false); - b.OwnsMany(e => e.RelatedCollection, rcb => - { - rcb.Property(x => x.Id).ValueGeneratedNever(); + b.OwnsMany( + e => e.RelatedCollection, rcb => + { + rcb.Property(x => x.Id).ValueGeneratedNever(); - rcb.OwnsOne(r => r.RequiredNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); - rcb.Navigation(x => x.RequiredNested).IsRequired(true); + rcb.OwnsOne(r => r.RequiredNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); + rcb.Navigation(x => x.RequiredNested).IsRequired(); - rcb.OwnsOne(r => r.OptionalNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); - rcb.Navigation(x => x.RequiredNested).IsRequired(false); + rcb.OwnsOne(r => r.OptionalNested, rnb => rnb.Property(x => x.Id).ValueGeneratedNever()); + rcb.Navigation(x => x.RequiredNested).IsRequired(false); - rcb.OwnsMany(r => r.NestedCollection, rcb => rcb.Property(x => x.Id).ValueGeneratedNever()); - }); + rcb.OwnsMany(r => r.NestedCollection, rcb => rcb.Property(x => x.Id).ValueGeneratedNever()); + }); }); } diff --git a/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsMiscellaneousTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsMiscellaneousTestBase.cs index 2b0fd402a7f..2ba71b33951 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsMiscellaneousTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsMiscellaneousTestBase.cs @@ -5,6 +5,6 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.OwnedNavigations; public abstract class OwnedNavigationsMiscellaneousTestBase(TFixture fixture) : RelationshipsMiscellaneousTestBase(fixture) - where TFixture : OwnedNavigationsFixtureBase, new() + where TFixture : OwnedNavigationsFixtureBase, new() { } diff --git a/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsProjectionTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsProjectionTestBase.cs index f48c0ad7348..a3b901f1782 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsProjectionTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/OwnedNavigations/OwnedNavigationsProjectionTestBase.cs @@ -43,10 +43,12 @@ public override Task SelectMany_related_collection(QueryTrackingBehavior queryTr => AssertOwnedTrackingQuery(queryTrackingBehavior, () => base.SelectMany_related_collection(queryTrackingBehavior)); public override Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) - => AssertOwnedTrackingQuery(queryTrackingBehavior, () => base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior)); + => AssertOwnedTrackingQuery( + queryTrackingBehavior, () => base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior)); public override Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) - => AssertOwnedTrackingQuery(queryTrackingBehavior, () => base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior)); + => AssertOwnedTrackingQuery( + queryTrackingBehavior, () => base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior)); #endregion Collection @@ -156,10 +158,12 @@ public override Task SelectMany_nested_collection_on_optional_related(QueryTrack #region Subquery public override Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) - => AssertOwnedTrackingQuery(queryTrackingBehavior, () => base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior)); + => AssertOwnedTrackingQuery( + queryTrackingBehavior, () => base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior)); public override Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) - => AssertOwnedTrackingQuery(queryTrackingBehavior, () => base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior)); + => AssertOwnedTrackingQuery( + queryTrackingBehavior, () => base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior)); // [ConditionalTheory] // [MemberData(nameof(AsyncAndTrackingData))] diff --git a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsCollectionTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsCollectionTestBase.cs index 9affe3b74e0..1d4ac99c9dd 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsCollectionTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsCollectionTestBase.cs @@ -9,8 +9,7 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships; public abstract class RelationshipsCollectionTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : RelationshipsQueryFixtureBase, new() { - [ConditionalFact] - [MemberData(nameof(IsAsyncData))] + [ConditionalFact, MemberData(nameof(IsAsyncData))] public virtual Task Count() => AssertQuery(ss => ss.Set().Where(e => e.RelatedCollection.Count == 2)); @@ -21,8 +20,7 @@ public virtual Task Where() [ConditionalFact] public virtual Task OrderBy_ElementAt() => AssertQuery( - ss => ss.Set().Where( - e => e.RelatedCollection.OrderBy(r => r.Id).ElementAt(0).Int == 8), + ss => ss.Set().Where(e => e.RelatedCollection.OrderBy(r => r.Id).ElementAt(0).Int == 8), ss => ss.Set().Where(e => e.RelatedCollection.Count > 0 && e.RelatedCollection.OrderBy(r => r.Id).ElementAt(0).Int == 8)); @@ -32,8 +30,7 @@ public virtual Task OrderBy_ElementAt() public virtual Task Distinct() => AssertQuery(ss => ss.Set().Where(e => e.RelatedCollection.Distinct().Count() == 2)); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().OrderBy(e => e.Id).Select(e => e.RelatedCollection.Distinct().ToList()), @@ -57,44 +54,40 @@ public virtual Task Distinct_over_projected_filtered_nested_collection() [ConditionalFact] public virtual Task Index_constant() - => AssertOrderedCollectionQuery( - () => AssertQuery( - ss => ss.Set().Where(e => e.RelatedCollection[0].Int == 8), - ss => ss.Set().Where(e => e.RelatedCollection.Count > 0 && e.RelatedCollection[0].Int == 8))); + => AssertOrderedCollectionQuery(() => AssertQuery( + ss => ss.Set().Where(e => e.RelatedCollection[0].Int == 8), + ss => ss.Set().Where(e => e.RelatedCollection.Count > 0 && e.RelatedCollection[0].Int == 8))); [ConditionalFact] public virtual Task Index_parameter() => AssertOrderedCollectionQuery(() => - { - var i = 0; + { + var i = 0; - return AssertQuery( - ss => ss.Set().Where(e => e.RelatedCollection[i].Int == 8), - ss => ss.Set().Where(e => e.RelatedCollection.Count > 0 && e.RelatedCollection[i].Int == 8)); - }); + return AssertQuery( + ss => ss.Set().Where(e => e.RelatedCollection[i].Int == 8), + ss => ss.Set().Where(e => e.RelatedCollection.Count > 0 && e.RelatedCollection[i].Int == 8)); + }); [ConditionalFact] public virtual Task Index_column() - => AssertOrderedCollectionQuery( - () => AssertQuery( - ss => ss.Set().Where(e => e.RelatedCollection[e.Id - 1].Int == 8), - ss => ss.Set().Where(e => e.RelatedCollection.Count > e.Id - 1 && e.RelatedCollection[e.Id - 1].Int == 8))); + => AssertOrderedCollectionQuery(() => AssertQuery( + ss => ss.Set().Where(e => e.RelatedCollection[e.Id - 1].Int == 8), + ss => ss.Set().Where(e => e.RelatedCollection.Count > e.Id - 1 && e.RelatedCollection[e.Id - 1].Int == 8))); [ConditionalFact] public virtual Task Index_out_of_bounds() - => AssertOrderedCollectionQuery( - () => AssertQuery( - ss => ss.Set().Where(e => e.RelatedCollection[9999].Int == 8), - ss => ss.Set().Where(e => false), - assertEmpty: true)); + => AssertOrderedCollectionQuery(() => AssertQuery( + ss => ss.Set().Where(e => e.RelatedCollection[9999].Int == 8), + ss => ss.Set().Where(e => false), + assertEmpty: true)); #endregion Index [ConditionalFact] public virtual Task Select_within_Select_within_Select_with_aggregates() - => AssertQuery( - ss => ss.Set().Select(e => - e.RelatedCollection.Select(r => r.NestedCollection.Select(n => n.Int).Max()).Sum())); + => AssertQuery(ss => ss.Set().Select(e => + e.RelatedCollection.Select(r => r.NestedCollection.Select(n => n.Int).Max()).Sum())); /// /// Utility for tests that depend on the collection being naturally ordered diff --git a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsData.cs b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsData.cs index 50f90b7c9ca..abda0c886b5 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsData.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsData.cs @@ -31,104 +31,109 @@ public static List CreateRootEntities() CreateRootEntity(id++, description: null), // Second basic entity with all properties set to other values (but same across all properties) - CreateRootEntity(id++, description: "With_other_values", e => - { - SetRelatedValues(e.RequiredRelated); - - if (e.OptionalRelated is not null) + CreateRootEntity( + id++, description: "With_other_values", e => { - SetRelatedValues(e.OptionalRelated); - } + SetRelatedValues(e.RequiredRelated); - foreach (var related in e.RelatedCollection) - { - SetRelatedValues(related); - } + if (e.OptionalRelated is not null) + { + SetRelatedValues(e.OptionalRelated); + } - void SetRelatedValues(RelatedType related) - { - related.Int = 9; - related.String = "bar"; - related.RequiredNested.Int = 9; - related.RequiredNested.String = "bar"; - related.OptionalNested?.Int = 9; - related.OptionalNested?.String = "bar"; - - foreach (var nested in related.NestedCollection) + foreach (var related in e.RelatedCollection) + { + SetRelatedValues(related); + } + + void SetRelatedValues(RelatedType related) { - nested.Int = 9; - nested.String = "bar"; + related.Int = 9; + related.String = "bar"; + related.RequiredNested.Int = 9; + related.RequiredNested.String = "bar"; + related.OptionalNested?.Int = 9; + related.OptionalNested?.String = "bar"; + + foreach (var nested in related.NestedCollection) + { + nested.Int = 9; + nested.String = "bar"; + } } - } - }), + }), // Third basic entity with all properties set to completely different values - CreateRootEntity(id++, description: "With_different_values", e => - { - var intValue = 100; - var stringValue = 100; + CreateRootEntity( + id++, description: "With_different_values", e => + { + var intValue = 100; + var stringValue = 100; - SetRelatedValues(e.RequiredRelated); + SetRelatedValues(e.RequiredRelated); - if (e.OptionalRelated is not null) - { - SetRelatedValues(e.OptionalRelated); - } + if (e.OptionalRelated is not null) + { + SetRelatedValues(e.OptionalRelated); + } - foreach (var related in e.RelatedCollection) - { - SetRelatedValues(related); - } + foreach (var related in e.RelatedCollection) + { + SetRelatedValues(related); + } - void SetRelatedValues(RelatedType related) - { - related.Int = intValue++; - related.String = $"foo{stringValue++}"; - related.RequiredNested.Int = intValue++; - related.RequiredNested.String = $"foo{stringValue++}"; - related.OptionalNested?.Int = intValue++; - related.OptionalNested?.String = $"foo{stringValue++}"; - - foreach (var nested in related.NestedCollection) + void SetRelatedValues(RelatedType related) { - nested.Int = intValue++; - nested.String = $"foo{stringValue++}"; + related.Int = intValue++; + related.String = $"foo{stringValue++}"; + related.RequiredNested.Int = intValue++; + related.RequiredNested.String = $"foo{stringValue++}"; + related.OptionalNested?.Int = intValue++; + related.OptionalNested?.String = $"foo{stringValue++}"; + + foreach (var nested in related.NestedCollection) + { + nested.Int = intValue++; + nested.String = $"foo{stringValue++}"; + } } - } - }), + }), // Entity where values are referentially identical to each other across required/optional, to test various equality sceanarios. // Note that this gets overridden for owned navigations . - CreateRootEntity(id++, description: "With_referential_identity", e => - { - e.OptionalRelated = e.RequiredRelated; - e.RequiredRelated.OptionalNested = e.RequiredRelated.RequiredNested; - e.OptionalRelated.OptionalNested = e.RequiredRelated.RequiredNested; + CreateRootEntity( + id++, description: "With_referential_identity", e => + { + e.OptionalRelated = e.RequiredRelated; + e.RequiredRelated.OptionalNested = e.RequiredRelated.RequiredNested; + e.OptionalRelated.OptionalNested = e.RequiredRelated.RequiredNested; - e.RelatedCollection.Clear(); - e.RequiredRelated.NestedCollection.Clear(); - e.OptionalRelated.NestedCollection.Clear(); - }), + e.RelatedCollection.Clear(); + e.RequiredRelated.NestedCollection.Clear(); + e.OptionalRelated.NestedCollection.Clear(); + }), // Entity where everything optional is null - CreateRootEntity(id++, description: "All_optionals_null", e => - { - e.RequiredRelated.OptionalNested = null; - e.OptionalRelated = null; - - foreach (var related in e.RelatedCollection) + CreateRootEntity( + id++, description: "All_optionals_null", e => { - related.OptionalNested = null; - } - }), + e.RequiredRelated.OptionalNested = null; + e.OptionalRelated = null; + + foreach (var related in e.RelatedCollection) + { + related.OptionalNested = null; + } + }), // Entity where all collections are empty - CreateRootEntity(id++, description: "All_collections_empty", e => - { - e.RelatedCollection.Clear(); - e.RequiredRelated.NestedCollection.Clear(); - e.OptionalRelated!.NestedCollection.Clear(); - }) + CreateRootEntity( + id++, description: "All_collections_empty", e => + { + e.RelatedCollection.Clear(); + e.RequiredRelated.NestedCollection.Clear(); + e.OptionalRelated!.NestedCollection.Clear(); + }) ]; return rootEntities; @@ -146,20 +151,16 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = id, Name = description is null ? shortName : $"{shortName}_{description}", - RequiredRelated = new RelatedType { Id = relatedId++, Name = $"{shortName}_RequiredRelated", - Int = intValue, String = stringValue, - RequiredNested = new NestedType { Id = nestedId++, Name = $"{shortName}_RequiredRelated_RequiredNested", - Int = intValue, String = stringValue }, @@ -167,7 +168,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_RequiredRelated_OptionalNested", - Int = intValue, String = stringValue }, @@ -177,7 +177,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_RequiredRelated_NestedCollection_1", - Int = intValue, String = stringValue }, @@ -185,7 +184,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_RequiredRelated_NestedCollection_2", - Int = intValue, String = stringValue } @@ -195,15 +193,12 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = relatedId++, Name = $"{shortName}_OptionalRelated", - Int = intValue, String = stringValue, - RequiredNested = new NestedType { Id = nestedId++, Name = $"{shortName}_OptionalRelated_RequiredNested", - Int = intValue, String = stringValue }, @@ -211,7 +206,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_OptionalRelated_OptionalNested", - Int = intValue, String = stringValue }, @@ -221,7 +215,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_OptionalRelated_NestedCollection_1", - Int = intValue, String = stringValue }, @@ -229,7 +222,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_OptionalRelated_NestedCollection_2", - Int = intValue, String = stringValue } @@ -241,15 +233,12 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = relatedId++, Name = $"{shortName}_RelatedCollection_1", - Int = intValue, String = stringValue, - RequiredNested = new NestedType { Id = nestedId++, Name = $"{shortName}_RelatedCollection_1_RequiredNested", - Int = intValue, String = stringValue }, @@ -257,7 +246,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_RelatedCollection_1_OptionalNested", - Int = intValue, String = stringValue }, @@ -267,7 +255,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_RelatedCollection_1_NestedCollection_1", - Int = intValue, String = stringValue }, @@ -275,7 +262,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_RelatedCollection_1_NestedCollection_2", - Int = intValue, String = stringValue } @@ -285,15 +271,12 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = relatedId++, Name = $"{shortName}_RelatedCollection_2", - Int = intValue, String = stringValue, - RequiredNested = new NestedType { Id = nestedId++, Name = $"{shortName}_RelatedCollection_2_RequiredNested", - Int = intValue, String = stringValue }, @@ -301,7 +284,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_RelatedCollection_2_OptionalNested", - Int = intValue, String = stringValue }, @@ -311,7 +293,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_RelatedCollection_2_NestedCollection_1", - Int = intValue, String = stringValue }, @@ -319,7 +300,6 @@ RootEntity CreateRootEntity(int id, string? description, Action? cus { Id = nestedId++, Name = $"{shortName}_Root1_RelatedCollection_2_NestedCollection_2", - Int = intValue, String = stringValue } @@ -340,7 +320,7 @@ public static List CreateRootReferencingEntities(IEnumera var id = 1; - rootReferencingEntities.Add(new() { Id = id++, Root = null }); + rootReferencingEntities.Add(new RootReferencingEntity { Id = id++, Root = null }); foreach (var rootEntity in rootEntities) { var rootReferencingEntity = new RootReferencingEntity { Id = id++, Root = rootEntity }; diff --git a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsModel.cs b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsModel.cs index 6989ee32d50..25b91ffdf74 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsModel.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsModel.cs @@ -6,8 +6,8 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships; /// -/// Main entity type used as the root for most test queries. -/// References , which represents the main type/relationship to be tested. +/// Main entity type used as the root for most test queries. +/// References , which represents the main type/relationship to be tested. /// public class RootEntity { @@ -24,15 +24,17 @@ public class RootEntity // the Fluent API for navigation tests only. [NotMapped] // Explicitly mapped via Fluent API for navigation tests only public int RequiredRelatedId { get; set; } + [NotMapped] // Explicitly mapped via Fluent API for navigation tests only public int? OptionalRelatedId { get; set; } - public override string ToString() => Name; + public override string ToString() + => Name; } /// -/// The main type to be tested; mapped differently (entity type, complex type...) across -/// different test variations. +/// The main type to be tested; mapped differently (entity type, complex type...) across +/// different test variations. /// public class RelatedType : IEquatable { @@ -50,27 +52,31 @@ public class RelatedType : IEquatable // the Fluent API for navigation tests only. [NotMapped] public int RequiredNestedId { get; set; } + [NotMapped] public int? OptionalNestedId { get; set; } [NotMapped] public RootEntity RequiredRelatedInverse { get; set; } = null!; + [NotMapped] public RootEntity OptionalRelatedInverse { get; set; } = null!; + [NotMapped] public RootEntity RelatedCollectionInverse { get; set; } = null!; + [NotMapped] public int? CollectionRootId { get; set; } public bool Equals(RelatedType? other) => other is not null - && Id == other.Id - && Name == other.Name - && Int == other.Int - && String == other.String - && RequiredNested.Equals(other.RequiredNested) - && (OptionalNested is null && other.OptionalNested is null || OptionalNested?.Equals(other.RequiredNested) == true) - && NestedCollection.SequenceEqual(other.NestedCollection); + && Id == other.Id + && Name == other.Name + && Int == other.Int + && String == other.String + && RequiredNested.Equals(other.RequiredNested) + && (OptionalNested is null && other.OptionalNested is null || OptionalNested?.Equals(other.RequiredNested) == true) + && NestedCollection.SequenceEqual(other.NestedCollection); public RelatedType DeepClone() => new() @@ -79,19 +85,18 @@ public RelatedType DeepClone() Name = Name, Int = Int, String = String, - RequiredNested = RequiredNested.DeepClone(), OptionalNested = OptionalNested?.DeepClone(), - NestedCollection = NestedCollection.Select(n => n.DeepClone()).ToList() }; - public override string ToString() => Name; + public override string ToString() + => Name; } /// -/// An additional nested type contained within , for tests which exercise -/// nested relationships. +/// An additional nested type contained within , for tests which exercise +/// nested relationships. /// public class NestedType : IEquatable { @@ -105,19 +110,22 @@ public class NestedType : IEquatable // the Fluent API for navigation tests only. [NotMapped] public RelatedType RequiredNestedInverse { get; set; } = null!; + [NotMapped] public RelatedType OptionalNestedInverse { get; set; } = null!; + [NotMapped] public RelatedType NestedCollectionInverse { get; set; } = null!; + [NotMapped] public int? CollectionRelatedId { get; set; } public bool Equals(NestedType? other) => other is not null - && Id == other.Id - && Name == other.Name - && Int == other.Int - && String == other.String; + && Id == other.Id + && Name == other.Name + && Int == other.Int + && String == other.String; public NestedType DeepClone() => new() @@ -128,7 +136,8 @@ public NestedType DeepClone() String = String }; - public override string ToString() => Name; + public override string ToString() + => Name; } /// diff --git a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsProjectionTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsProjectionTestBase.cs index efa3310802f..a3ee602f53f 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsProjectionTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsProjectionTestBase.cs @@ -6,8 +6,7 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships; public abstract class RelationshipsProjectionTestBase(TFixture fixture) : QueryTestBase(fixture) where TFixture : RelationshipsQueryFixtureBase, new() { - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_root(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set(), @@ -15,22 +14,19 @@ public virtual Task Select_root(QueryTrackingBehavior queryTrackingBehavior) #region Simple properties - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(x => x.RequiredRelated.String), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(x => x.OptionalRelated!.String), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) // We have an entity with OptionalRelated null, so projecting a value type property from that throws // "Nullable object must have a value" @@ -39,8 +35,7 @@ public virtual Task Select_value_type_property_on_null_related_throws(QueryTrack ss => ss.Set().Select(x => x.OptionalRelated!.Int), queryTrackingBehavior: queryTrackingBehavior)); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(x => (int?)x.OptionalRelated!.Int), @@ -50,50 +45,43 @@ public virtual Task Select_nullable_value_type_property_on_null_related(QueryTra #region Non-collection - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(x => x.RequiredRelated), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(x => x.OptionalRelated), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(x => x.RequiredRelated.RequiredNested), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(x => x.RequiredRelated.OptionalNested), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(x => x.OptionalRelated!.RequiredNested), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(x => x.OptionalRelated!.OptionalNested), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(e => e.Root!.RequiredRelated), @@ -106,8 +94,7 @@ public virtual Task Select_required_related_via_optional_navigation(QueryTrackin // Note we order via the Id (server-side) to ensure the collections come back in deterministic order, // otherwise it's difficult/unreliable to compare client-side. - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().OrderBy(e => e.Id).Select(x => x.RelatedCollection), @@ -115,8 +102,7 @@ public virtual Task Select_related_collection(QueryTrackingBehavior queryTrackin elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: r => r.Id), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().OrderBy(e => e.Id).Select(x => x.RequiredRelated.NestedCollection), @@ -124,8 +110,7 @@ public virtual Task Select_nested_collection_on_required_related(QueryTrackingBe elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: r => r.Id), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().OrderBy(e => e.Id).Select(x => x.OptionalRelated!.NestedCollection), @@ -133,22 +118,19 @@ public virtual Task Select_nested_collection_on_optional_related(QueryTrackingBe elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: r => r.Id), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().SelectMany(x => x.RelatedCollection), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().SelectMany(x => x.RequiredRelated.NestedCollection), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set() @@ -161,8 +143,7 @@ public virtual Task SelectMany_nested_collection_on_optional_related(QueryTracki #region Multiple - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(x => new { First = x, Second = x }), @@ -273,28 +254,24 @@ public virtual Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBe #region Subquery - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set() - .Select( - x => ss.Set() - .OrderBy(e => e.Id) - .Select(e => e.RequiredRelated) - .FirstOrDefault()!.RequiredNested), + .Select(x => ss.Set() + .OrderBy(e => e.Id) + .Select(e => e.RequiredRelated) + .FirstOrDefault()!.RequiredNested), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set() - .Select( - x => ss.Set() - .OrderBy(e => e.Id) - .Select(e => e.OptionalRelated) - .FirstOrDefault()!.RequiredNested), + .Select(x => ss.Set() + .OrderBy(e => e.Id) + .Select(e => e.OptionalRelated) + .FirstOrDefault()!.RequiredNested), queryTrackingBehavior: queryTrackingBehavior); // [ConditionalTheory] diff --git a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsQueryFixtureBase.cs index 680db19a12e..e382f163320 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsQueryFixtureBase.cs @@ -5,7 +5,8 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships; public abstract class RelationshipsQueryFixtureBase : SharedStoreFixtureBase, IQueryFixtureBase { - public virtual bool AreCollectionsOrdered => true; + public virtual bool AreCollectionsOrdered + => true; private readonly RelationshipsData _data; diff --git a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsSetOperationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsSetOperationsTestBase.cs index cf16c6b9ce2..2e4108e1727 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsSetOperationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsSetOperationsTestBase.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Linq; - namespace Microsoft.EntityFrameworkCore.Query.Relationships; public abstract class RelationshipsSetOperationsTestBase(TFixture fixture) : QueryTestBase(fixture) @@ -10,22 +8,20 @@ public abstract class RelationshipsSetOperationsTestBase(TFixture fixt { [ConditionalFact] public virtual Task On_related() - => AssertQuery( - ss => ss.Set().Where(e => - e.RelatedCollection.Where(r => r.Int == 8) - .Concat(e.RelatedCollection.Where(r => r.String == "foo")) - .Count() == 4)); + => AssertQuery(ss => ss.Set().Where(e => + e.RelatedCollection.Where(r => r.Int == 8) + .Concat(e.RelatedCollection.Where(r => r.String == "foo")) + .Count() + == 4)); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task On_related_projected(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(e => e.RelatedCollection.Where(r => r.Int == 8).Concat(e.RelatedCollection.Where(r => r.String == "foo"))), queryTrackingBehavior: queryTrackingBehavior); - [ConditionalTheory] - [MemberData(nameof(TrackingData))] + [ConditionalTheory, MemberData(nameof(TrackingData))] public virtual Task On_related_Select_nested_with_aggregates(QueryTrackingBehavior queryTrackingBehavior) => AssertQuery( ss => ss.Set().Select(e => @@ -37,11 +33,11 @@ public virtual Task On_related_Select_nested_with_aggregates(QueryTrackingBehavi [ConditionalFact] public virtual Task On_nested() - => AssertQuery( - ss => ss.Set().Where(e => - e.RequiredRelated.NestedCollection.Where(r => r.Int == 8) - .Concat(e.RequiredRelated.NestedCollection.Where(r => r.String == "foo")) - .Count() == 4)); + => AssertQuery(ss => ss.Set().Where(e => + e.RequiredRelated.NestedCollection.Where(r => r.Int == 8) + .Concat(e.RequiredRelated.NestedCollection.Where(r => r.String == "foo")) + .Count() + == 4)); [ConditionalFact] public virtual Task Over_different_collection_properties() @@ -49,5 +45,7 @@ public virtual Task Over_different_collection_properties() ss => ss.Set().Where(e => e.RequiredRelated.NestedCollection.Concat(e.OptionalRelated!.NestedCollection).Count() == 4), ss => ss.Set().Where(e => - e.RequiredRelated.NestedCollection.Concat(e.OptionalRelated == null ? new() : e.OptionalRelated.NestedCollection).Count() == 4)); + e.RequiredRelated.NestedCollection + .Concat(e.OptionalRelated == null ? new List() : e.OptionalRelated.NestedCollection).Count() + == 4)); } diff --git a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsStructuralEqualityTestBase.cs b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsStructuralEqualityTestBase.cs index 7ebd34163eb..54a9e913f75 100644 --- a/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsStructuralEqualityTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Relationships/RelationshipsStructuralEqualityTestBase.cs @@ -10,19 +10,25 @@ public abstract class RelationshipsStructuralEqualityTestBase(TFixture public virtual Task Two_related() => AssertQuery( ss => ss.Set().Where(e => e.RequiredRelated == e.OptionalRelated), - ss => ss.Set().Where(e => e.RequiredRelated.Equals(e.OptionalRelated))); // TODO: Rewrite equality to Equals for the entire test suite for complex + ss => ss.Set() + .Where(e => e.RequiredRelated.Equals( + e.OptionalRelated))); // TODO: Rewrite equality to Equals for the entire test suite for complex [ConditionalFact] public virtual Task Two_nested() => AssertQuery( ss => ss.Set().Where(e => e.RequiredRelated.RequiredNested == e.OptionalRelated!.RequiredNested), - ss => ss.Set().Where(e => e.RequiredRelated.RequiredNested.Equals(e.OptionalRelated!.RequiredNested))); // TODO: Rewrite equality to Equals for the entire test suite for complex + ss => ss.Set() + .Where(e => e.RequiredRelated.RequiredNested.Equals( + e.OptionalRelated!.RequiredNested))); // TODO: Rewrite equality to Equals for the entire test suite for complex [ConditionalFact] public virtual Task Not_equals() => AssertQuery( ss => ss.Set().Where(e => e.RequiredRelated != e.OptionalRelated), - ss => ss.Set().Where(e => !e.RequiredRelated.Equals(e.OptionalRelated))); // TODO: Rewrite equality to Equals for the entire test suite for complex + ss => ss.Set() + .Where(e => !e.RequiredRelated.Equals( + e.OptionalRelated))); // TODO: Rewrite equality to Equals for the entire test suite for complex [ConditionalFact] public virtual Task Related_with_inline_null() @@ -44,54 +50,119 @@ public virtual Task Nested_with_inline_null() public virtual Task Nested_with_inline() => AssertQuery( ss => ss.Set() - .Where(e => e.RequiredRelated.RequiredNested == new NestedType { Id = 1000, Name = "Root1_RequiredRelated_RequiredNested", Int = 8, String = "foo" }), + .Where(e => e.RequiredRelated.RequiredNested + == new NestedType + { + Id = 1000, + Name = "Root1_RequiredRelated_RequiredNested", + Int = 8, + String = "foo" + }), ss => ss.Set() - .Where(e => e.RequiredRelated.RequiredNested.Equals(new NestedType { Id = 1000, Name = "Root1_RequiredRelated_RequiredNested", Int = 8, String = "foo" }))); // TODO: Rewrite equality to Equals for the entire test suite for complex + .Where(e => e.RequiredRelated.RequiredNested.Equals( + new NestedType + { + Id = 1000, + Name = "Root1_RequiredRelated_RequiredNested", + Int = 8, + String = "foo" + }))); // TODO: Rewrite equality to Equals for the entire test suite for complex [ConditionalFact] public virtual async Task Nested_with_parameter() { - var nested = new NestedType { Id = 1000, Name = "Root1_RequiredRelated_RequiredNested", Int = 8, String = "foo" }; + var nested = new NestedType + { + Id = 1000, + Name = "Root1_RequiredRelated_RequiredNested", + Int = 8, + String = "foo" + }; await AssertQuery( ss => ss.Set().Where(e => e.RequiredRelated.RequiredNested == nested), - ss => ss.Set().Where(e => e.RequiredRelated.RequiredNested.Equals(nested))); // TODO: Rewrite equality to Equals for the entire test suite for complex + ss => ss.Set() + .Where(e => e.RequiredRelated.RequiredNested + .Equals(nested))); // TODO: Rewrite equality to Equals for the entire test suite for complex } [ConditionalFact] public virtual Task Two_nested_collections() => AssertQuery( ss => ss.Set().Where(e => e.RequiredRelated.NestedCollection == e.OptionalRelated!.NestedCollection), - ss => ss.Set().Where(e => e.OptionalRelated != null && e.RequiredRelated.NestedCollection.SequenceEqual(e.OptionalRelated!.NestedCollection))); // TODO: Rewrite equality to Equals for the entire test suite for complex + ss => ss.Set().Where(e + => e.OptionalRelated != null + && e.RequiredRelated.NestedCollection.SequenceEqual( + e.OptionalRelated!.NestedCollection))); // TODO: Rewrite equality to Equals for the entire test suite for complex [ConditionalFact] public virtual Task Nested_collection_with_inline() => AssertQuery( ss => ss.Set() - .Where(e => e.RequiredRelated.NestedCollection == new List - { - new() { Id = 1002, Name = "Root1_RequiredRelated_NestedCollection_1", Int = 8, String = "foo" }, - new() { Id = 1003, Name = "Root1_RequiredRelated_NestedCollection_2", Int = 8, String = "foo" } - }), + .Where(e => e.RequiredRelated.NestedCollection + == new List + { + new() + { + Id = 1002, + Name = "Root1_RequiredRelated_NestedCollection_1", + Int = 8, + String = "foo" + }, + new() + { + Id = 1003, + Name = "Root1_RequiredRelated_NestedCollection_2", + Int = 8, + String = "foo" + } + }), ss => ss.Set() - .Where(e => e.RequiredRelated.NestedCollection.SequenceEqual(new List - { - new() { Id = 1002, Name = "Root1_RequiredRelated_NestedCollection_1", Int = 8, String = "foo" }, - new() { Id = 1003, Name = "Root1_RequiredRelated_NestedCollection_2", Int = 8, String = "foo" } - }))); // TODO: Rewrite equality to Equals for the entire test suite for complex + .Where(e => e.RequiredRelated.NestedCollection.SequenceEqual( + new List + { + new() + { + Id = 1002, + Name = "Root1_RequiredRelated_NestedCollection_1", + Int = 8, + String = "foo" + }, + new() + { + Id = 1003, + Name = "Root1_RequiredRelated_NestedCollection_2", + Int = 8, + String = "foo" + } + }))); // TODO: Rewrite equality to Equals for the entire test suite for complex [ConditionalFact] public virtual async Task Nested_collection_with_parameter() { var nestedCollection = new List { - new() { Id = 1002, Name = "Root1_RequiredRelated_NestedCollection_1", Int = 8, String = "foo" }, - new() { Id = 1003, Name = "Root1_RequiredRelated_NestedCollection_2", Int = 8, String = "foo" } + new() + { + Id = 1002, + Name = "Root1_RequiredRelated_NestedCollection_1", + Int = 8, + String = "foo" + }, + new() + { + Id = 1003, + Name = "Root1_RequiredRelated_NestedCollection_2", + Int = 8, + String = "foo" + } }; await AssertQuery( ss => ss.Set().Where(e => e.RequiredRelated.NestedCollection == nestedCollection), - ss => ss.Set().Where(e => e.RequiredRelated.NestedCollection.SequenceEqual(nestedCollection))); // TODO: Rewrite equality to Equals for the entire test suite for complex + ss => ss.Set() + .Where(e => e.RequiredRelated.NestedCollection.SequenceEqual( + nestedCollection))); // TODO: Rewrite equality to Equals for the entire test suite for complex } // TODO: Equality on subquery diff --git a/test/EFCore.Specification.Tests/Query/SharedTypeQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/SharedTypeQueryTestBase.cs index f3ebba9559b..64cd1979516 100644 --- a/test/EFCore.Specification.Tests/Query/SharedTypeQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/SharedTypeQueryTestBase.cs @@ -10,8 +10,7 @@ public abstract class SharedTypeQueryTestBase(NonSharedFixture fixture) : NonSha protected override string StoreName => "SharedTypeQueryTests"; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Can_use_shared_type_entity_type_in_query_filter(bool async) { var contextFactory = await InitializeAsync( diff --git a/test/EFCore.Specification.Tests/Query/SpatialQueryFixtureBase.cs b/test/EFCore.Specification.Tests/Query/SpatialQueryFixtureBase.cs index a1de203544d..4c82aac933e 100644 --- a/test/EFCore.Specification.Tests/Query/SpatialQueryFixtureBase.cs +++ b/test/EFCore.Specification.Tests/Query/SpatialQueryFixtureBase.cs @@ -144,12 +144,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.Location).HasConversion(new GeoPointConverter(GeometryFactory)); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.Location).HasConversion(new GeoPointConverter(GeometryFactory)); + }); } protected override Task SeedAsync(SpatialContext context) diff --git a/test/EFCore.Specification.Tests/Query/SpatialQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/SpatialQueryTestBase.cs index b97821604b2..25da99dabd5 100644 --- a/test/EFCore.Specification.Tests/Query/SpatialQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/SpatialQueryTestBase.cs @@ -16,8 +16,7 @@ public abstract class SpatialQueryTestBase(TFixture fixture) : QueryTe protected virtual bool AssertDistances => true; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task SimpleSelect(bool async) { await AssertQuery( @@ -37,15 +36,13 @@ await AssertQuery( ss => ss.Set()); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task WithConversion(bool async) => AssertQuery( async, ss => ss.Set()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Area(bool async) => AssertQuery( async, @@ -65,8 +62,7 @@ public virtual Task Area(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task AsBinary(bool async) => AssertQuery( async, @@ -79,8 +75,7 @@ public virtual Task AsBinary(bool async) Assert.Equal(e.Binary, a.Binary); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task AsBinary_with_null_check(bool async) => AssertQuery( async, @@ -92,8 +87,7 @@ public virtual Task AsBinary_with_null_check(bool async) Assert.Equal(e.Binary, a.Binary); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task AsText(bool async) => AssertQuery( async, @@ -106,8 +100,7 @@ public virtual Task AsText(bool async) Assert.Equal(e.Text, a.Text, WktComparer.Instance); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Boundary(bool async) => AssertQuery( async, @@ -119,8 +112,7 @@ public virtual Task Boundary(bool async) Assert.Equal(e.Boundary, a.Boundary, GeometryComparer.Instance); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Buffer(bool async) => AssertQuery( async, @@ -142,8 +134,7 @@ public virtual Task Buffer(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Buffer_quadrantSegments(bool async) => AssertQuery( async, @@ -165,8 +156,7 @@ public virtual Task Buffer_quadrantSegments(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Centroid(bool async) => AssertQuery( async, @@ -178,8 +168,7 @@ public virtual Task Centroid(bool async) Assert.Equal(e.Centroid, a.Centroid, GeometryComparer.Instance); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Combine_aggregate(bool async) => AssertQuery( async, @@ -200,8 +189,7 @@ public virtual Task Combine_aggregate(bool async) Assert.Equal(eCollection.Geometries, aCollection.Geometries); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EnvelopeCombine_aggregate(bool async) => AssertQuery( async, @@ -216,8 +204,7 @@ public virtual Task EnvelopeCombine_aggregate(bool async) Assert.Equal(e.Combined, a.Combined, GeometryComparer.Instance); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Contains(bool async) { var point = Fixture.GeometryFactory.CreatePoint(new Coordinate(0.25, 0.25)); @@ -230,8 +217,7 @@ public virtual Task Contains(bool async) elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ConvexHull(bool async) => AssertQuery( async, @@ -244,8 +230,7 @@ public virtual Task ConvexHull(bool async) Assert.Equal(e.ConvexHull, a.ConvexHull, GeometryComparer.Instance); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ConvexHull_aggregate(bool async) => AssertQuery( async, @@ -260,26 +245,22 @@ public virtual Task ConvexHull_aggregate(bool async) Assert.Equal(e.ConvexHull, a.ConvexHull, GeometryComparer.Instance); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IGeometryCollection_Count(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, Count = e.MultiLineString == null ? (int?)null : e.MultiLineString.Count }), + ss => ss.Set() + .Select(e => new { e.Id, Count = e.MultiLineString == null ? (int?)null : e.MultiLineString.Count }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task LineString_Count(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, Count = e.LineString == null ? (int?)null : e.LineString.Count }), + ss => ss.Set().Select(e => new { e.Id, Count = e.LineString == null ? (int?)null : e.LineString.Count }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task CoveredBy(bool async) { var polygon = Fixture.GeometryFactory.CreatePolygon( @@ -293,8 +274,7 @@ public virtual Task CoveredBy(bool async) elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Covers(bool async) { var point = Fixture.GeometryFactory.CreatePoint(new Coordinate(0.25, 0.25)); @@ -306,8 +286,7 @@ public virtual Task Covers(bool async) elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Crosses(bool async) { var lineString = Fixture.GeometryFactory.CreateLineString([new Coordinate(0.5, -0.5), new Coordinate(0.5, 0.5)]); @@ -315,13 +294,12 @@ public virtual Task Crosses(bool async) return AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, Crosses = (bool?)e.LineString.Crosses(lineString) }), - ss => ss.Set().Select( - e => new { e.Id, Crosses = e.LineString == null ? (bool?)null : e.LineString.Crosses(lineString) }), + ss => ss.Set() + .Select(e => new { e.Id, Crosses = e.LineString == null ? (bool?)null : e.LineString.Crosses(lineString) }), elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Difference(bool async) { var polygon = Fixture.GeometryFactory.CreatePolygon( @@ -340,16 +318,14 @@ public virtual Task Difference(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Dimension(bool async) => AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, Dimension = e.Point == null ? (Dimension?)null : e.Point.Dimension }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Disjoint_with_cast_to_nullable(bool async) { var point = Fixture.GeometryFactory.CreatePoint(new Coordinate(1, 1)); @@ -362,8 +338,7 @@ public virtual Task Disjoint_with_cast_to_nullable(bool async) elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Disjoint_with_null_check(bool async) { var point = Fixture.GeometryFactory.CreatePoint(new Coordinate(1, 1)); @@ -375,8 +350,7 @@ public virtual Task Disjoint_with_null_check(bool async) elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distance_with_null_check(bool async) { var point = Fixture.GeometryFactory.CreatePoint(new Coordinate(0, 1)); @@ -402,8 +376,7 @@ public virtual Task Distance_with_null_check(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distance_with_cast_to_nullable(bool async) { var point = Fixture.GeometryFactory.CreatePoint(new Coordinate(0, 1)); @@ -428,8 +401,7 @@ public virtual Task Distance_with_cast_to_nullable(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distance_geometry(bool async) { var point = Fixture.GeometryFactory.CreatePoint(new Coordinate(0, 1)); @@ -437,8 +409,8 @@ public virtual Task Distance_geometry(bool async) return AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, Distance = (double?)e.Geometry.Distance(point) }), - ss => ss.Set().Select( - e => new { e.Id, Distance = e.Geometry == null ? (double?)null : e.Geometry.Distance(point) }), + ss => ss.Set() + .Select(e => new { e.Id, Distance = e.Geometry == null ? (double?)null : e.Geometry.Distance(point) }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -455,14 +427,13 @@ public virtual Task Distance_geometry(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distance_constant(bool async) => AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, Distance = (double?)e.Point.Distance(new Point(0, 1)) }), - ss => ss.Set().Select( - e => new { e.Id, Distance = e.Point == null ? (double?)null : e.Point.Distance(new Point(0, 1)) }), + ss => ss.Set() + .Select(e => new { e.Id, Distance = e.Point == null ? (double?)null : e.Point.Distance(new Point(0, 1)) }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -478,15 +449,14 @@ public virtual Task Distance_constant(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distance_constant_srid_4326(bool async) => AssertQuery( async, ss => ss.Set() .Select(e => new { e.Id, Distance = (double?)e.Point.Distance(new Point(1, 1) { SRID = 4326 }) }), - ss => ss.Set().Select( - e => new { e.Id, Distance = e.Point == null ? (double?)null : e.Point.Distance(new Point(1, 1) { SRID = 4326 }) }), + ss => ss.Set().Select(e + => new { e.Id, Distance = e.Point == null ? (double?)null : e.Point.Distance(new Point(1, 1) { SRID = 4326 }) }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -502,14 +472,13 @@ public virtual Task Distance_constant_srid_4326(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distance_constant_lhs(bool async) => AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, Distance = (double?)new Point(0, 1).Distance(e.Point) }), - ss => ss.Set().Select( - e => new { e.Id, Distance = e.Point == null ? (double?)null : new Point(0, 1).Distance(e.Point) }), + ss => ss.Set() + .Select(e => new { e.Id, Distance = e.Point == null ? (double?)null : new Point(0, 1).Distance(e.Point) }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -525,41 +494,35 @@ public virtual Task Distance_constant_lhs(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distance_on_converted_geometry_type(bool async) { var point = new GeoPoint(1, 0); return AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, Distance = e.Location.Distance(point) }), + ss => ss.Set().Select(e => new { e.Id, Distance = e.Location.Distance(point) }), elementSorter: e => e.Id, elementAsserter: (e, a) => { Assert.Equal(e.Id, a.Id); }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distance_on_converted_geometry_type_lhs(bool async) { var point = new GeoPoint(1, 0); return AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, Distance = point.Distance(e.Location) }), + ss => ss.Set().Select(e => new { e.Id, Distance = point.Distance(e.Location) }), elementSorter: e => e.Id, elementAsserter: (e, a) => { Assert.Equal(e.Id, a.Id); }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distance_on_converted_geometry_type_constant(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, Distance = e.Location.Distance(new GeoPoint(1, 0)) }), + ss => ss.Set().Select(e => new { e.Id, Distance = e.Location.Distance(new GeoPoint(1, 0)) }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -570,13 +533,11 @@ public virtual Task Distance_on_converted_geometry_type_constant(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Distance_on_converted_geometry_type_constant_lhs(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, Distance = new GeoPoint(1, 0).Distance(e.Location) }), + ss => ss.Set().Select(e => new { e.Id, Distance = new GeoPoint(1, 0).Distance(e.Location) }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -587,16 +548,14 @@ public virtual Task Distance_on_converted_geometry_type_constant_lhs(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EndPoint(bool async) => AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, EndPoint = e.LineString == null ? null : e.LineString.EndPoint }), elementSorter: e => e.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Envelope(bool async) => AssertQuery( async, @@ -608,8 +567,7 @@ public virtual Task Envelope(bool async) Assert.Equal(e.Envelope, a.Envelope, GeometryComparer.Instance); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task EqualsTopologically(bool async) { var point = Fixture.GeometryFactory.CreatePoint(new Coordinate(0, 0)); @@ -617,77 +575,66 @@ public virtual Task EqualsTopologically(bool async) return AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, EqualsTopologically = (bool?)e.Point.EqualsTopologically(point) }), - ss => ss.Set().Select( - e => new { e.Id, EqualsTopologically = e.Point == null ? (bool?)null : e.Point.EqualsTopologically(point) }), + ss => ss.Set().Select(e + => new { e.Id, EqualsTopologically = e.Point == null ? (bool?)null : e.Point.EqualsTopologically(point) }), elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ExteriorRing(bool async) => AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, ExteriorRing = e.Polygon == null ? null : e.Polygon.ExteriorRing }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GeometryType(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, GeometryType = e.Point == null ? null : e.Point.GeometryType }), + ss => ss.Set().Select(e => new { e.Id, GeometryType = e.Point == null ? null : e.Point.GeometryType }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetGeometryN(bool async) => AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, Geometry0 = e.MultiLineString.GetGeometryN(0) }), - ss => ss.Set().Select( - e => new { e.Id, Geometry0 = e.MultiLineString == null ? null : e.MultiLineString.GetGeometryN(0) }), + ss => ss.Set().Select(e + => new { e.Id, Geometry0 = e.MultiLineString == null ? null : e.MultiLineString.GetGeometryN(0) }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetGeometryN_with_null_argument(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new - { - e.Id, - Geometry0 = e.MultiLineString.GetGeometryN(ss.Set().Where(ee => false).Max(ee => ee.Id)) - }), + ss => ss.Set().Select(e => new + { + e.Id, Geometry0 = e.MultiLineString.GetGeometryN(ss.Set().Where(ee => false).Max(ee => ee.Id)) + }), ss => ss.Set().Select(e => new { e.Id, Geometry0 = default(Geometry) }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetInteriorRingN(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new - { - e.Id, - InteriorRing0 = e.Polygon.NumInteriorRings == 0 - ? null - : e.Polygon.GetInteriorRingN(0) - }), - ss => ss.Set().Select( - e => new - { - e.Id, - InteriorRing0 = e.Polygon == null || e.Polygon.NumInteriorRings == 0 - ? null - : e.Polygon.GetInteriorRingN(0) - }), + ss => ss.Set().Select(e => new + { + e.Id, + InteriorRing0 = e.Polygon.NumInteriorRings == 0 + ? null + : e.Polygon.GetInteriorRingN(0) + }), + ss => ss.Set().Select(e => new + { + e.Id, + InteriorRing0 = e.Polygon == null || e.Polygon.NumInteriorRings == 0 + ? null + : e.Polygon.GetInteriorRingN(0) + }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task GetPointN(bool async) => AssertQuery( async, @@ -696,18 +643,16 @@ public virtual Task GetPointN(bool async) .Select(e => new { e.Id, Point0 = e.LineString == null ? null : e.LineString.GetPointN(0) }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task InteriorPoint(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new - { - e.Id, - InteriorPoint = e.Polygon == null ? null : e.Polygon.InteriorPoint, - e.Polygon - }), + ss => ss.Set().Select(e => new + { + e.Id, + InteriorPoint = e.Polygon == null ? null : e.Polygon.InteriorPoint, + e.Polygon + }), elementSorter: x => x.Id, elementAsserter: (e, a) => { @@ -723,8 +668,7 @@ public virtual Task InteriorPoint(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Intersection(bool async) { var polygon = Fixture.GeometryFactory.CreatePolygon( @@ -733,8 +677,8 @@ public virtual Task Intersection(bool async) return AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, Intersection = e.Polygon.Intersection(polygon) }), - ss => ss.Set().Select( - e => new { e.Id, Intersection = e.Polygon == null ? null : e.Polygon.Intersection(polygon) }), + ss => ss.Set() + .Select(e => new { e.Id, Intersection = e.Polygon == null ? null : e.Polygon.Intersection(polygon) }), elementSorter: x => x.Id, elementAsserter: (e, a) => { @@ -743,8 +687,7 @@ public virtual Task Intersection(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Intersects(bool async) { var lineString = Fixture.GeometryFactory.CreateLineString([new Coordinate(0.5, -0.5), new Coordinate(0.5, 0.5)]); @@ -752,40 +695,36 @@ public virtual Task Intersects(bool async) return AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, Intersects = (bool?)e.LineString.Intersects(lineString) }), - ss => ss.Set().Select( - e => new { e.Id, Intersects = e.LineString == null ? (bool?)null : e.LineString.Intersects(lineString) }), + ss => ss.Set().Select(e + => new { e.Id, Intersects = e.LineString == null ? (bool?)null : e.LineString.Intersects(lineString) }), elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ICurve_IsClosed(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, IsClosed = e.LineString == null ? (bool?)null : e.LineString.IsClosed }), + ss => ss.Set() + .Select(e => new { e.Id, IsClosed = e.LineString == null ? (bool?)null : e.LineString.IsClosed }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IMultiCurve_IsClosed(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, IsClosed = e.MultiLineString == null ? (bool?)null : e.MultiLineString.IsClosed }), + ss => ss.Set().Select(e + => new { e.Id, IsClosed = e.MultiLineString == null ? (bool?)null : e.MultiLineString.IsClosed }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IsEmpty(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, IsEmpty = e.MultiLineString == null ? (bool?)null : e.MultiLineString.IsEmpty }), + ss => ss.Set() + .Select(e => new { e.Id, IsEmpty = e.MultiLineString == null ? (bool?)null : e.MultiLineString.IsEmpty }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IsRing(bool async) => AssertQuery( async, @@ -793,18 +732,15 @@ public virtual Task IsRing(bool async) .Select(e => new { e.Id, IsRing = e.LineString == null ? (bool?)null : e.LineString.IsRing }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IsSimple(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => - new { e.Id, IsSimple = e.LineString == null ? (bool?)null : e.LineString.IsSimple }), + ss => ss.Set().Select(e => + new { e.Id, IsSimple = e.LineString == null ? (bool?)null : e.LineString.IsSimple }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IsValid(bool async) => AssertQuery( async, @@ -812,8 +748,7 @@ public virtual Task IsValid(bool async) .Select(e => new { e.Id, IsValid = e.Point == null ? (bool?)null : e.Point.IsValid }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IsWithinDistance(bool async) { var point = Fixture.GeometryFactory.CreatePoint(new Coordinate(0, 1)); @@ -821,8 +756,8 @@ public virtual Task IsWithinDistance(bool async) return AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, IsWithinDistance = (bool?)e.Point.IsWithinDistance(point, 1) }), - ss => ss.Set().Select( - e => new { e.Id, IsWithinDistance = e.Point == null ? (bool?)null : e.Point.IsWithinDistance(point, 1) }), + ss => ss.Set().Select(e + => new { e.Id, IsWithinDistance = e.Point == null ? (bool?)null : e.Point.IsWithinDistance(point, 1) }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -839,8 +774,7 @@ public virtual Task IsWithinDistance(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Item(bool async) => AssertQuery( async, @@ -849,8 +783,7 @@ public virtual Task Item(bool async) .Select(e => new { e.Id, Item0 = e.MultiLineString == null ? null : e.MultiLineString[0] }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Length(bool async) => AssertQuery( async, @@ -871,8 +804,7 @@ public virtual Task Length(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task M(bool async) => AssertQuery( async, @@ -892,8 +824,7 @@ public virtual Task M(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Normalized(bool async) => AssertQuery( async, @@ -906,44 +837,39 @@ public virtual Task Normalized(bool async) Assert.Equal(e.Normalized, a.Normalized, GeometryComparer.Instance); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task NumGeometries(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, NumGeometries = e.MultiLineString == null ? (int?)null : e.MultiLineString.NumGeometries }), + ss => ss.Set().Select(e + => new { e.Id, NumGeometries = e.MultiLineString == null ? (int?)null : e.MultiLineString.NumGeometries }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task NumInteriorRings(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, NumInteriorRings = e.Polygon == null ? (int?)null : e.Polygon.NumInteriorRings }), + ss => ss.Set() + .Select(e => new { e.Id, NumInteriorRings = e.Polygon == null ? (int?)null : e.Polygon.NumInteriorRings }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task NumPoints(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, NumPoints = e.LineString == null ? (int?)null : e.LineString.NumPoints }), + ss => ss.Set() + .Select(e => new { e.Id, NumPoints = e.LineString == null ? (int?)null : e.LineString.NumPoints }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task OgcGeometryType(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, OgcGeometryType = e.Point == null ? (OgcGeometryType?)null : e.Point.OgcGeometryType }), + ss => ss.Set().Select(e + => new { e.Id, OgcGeometryType = e.Point == null ? (OgcGeometryType?)null : e.Point.OgcGeometryType }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Overlaps(bool async) { var polygon = Fixture.GeometryFactory.CreatePolygon( @@ -957,18 +883,16 @@ public virtual Task Overlaps(bool async) elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task PointOnSurface(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new - { - e.Id, - PointOnSurface = e.Polygon == null ? null : e.Polygon.PointOnSurface, - e.Polygon - }), + ss => ss.Set().Select(e => new + { + e.Id, + PointOnSurface = e.Polygon == null ? null : e.Polygon.PointOnSurface, + e.Polygon + }), elementSorter: x => x.Id, elementAsserter: (e, a) => { @@ -984,8 +908,7 @@ public virtual Task PointOnSurface(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Relate(bool async) { var polygon = Fixture.GeometryFactory.CreatePolygon( @@ -994,13 +917,12 @@ public virtual Task Relate(bool async) return AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, Relate = (bool?)e.Polygon.Relate(polygon, "212111212") }), - ss => ss.Set().Select( - e => new { e.Id, Relate = e.Polygon == null ? (bool?)null : e.Polygon.Relate(polygon, "212111212") }), + ss => ss.Set().Select(e + => new { e.Id, Relate = e.Polygon == null ? (bool?)null : e.Polygon.Relate(polygon, "212111212") }), elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Reverse(bool async) => AssertQuery( async, @@ -1008,26 +930,21 @@ public virtual Task Reverse(bool async) ss => ss.Set().Select(e => new { e.Id, Reverse = e.LineString == null ? null : e.LineString.Reverse() }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SRID(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, SRID = e.Point == null ? (int?)null : e.Point.SRID }), + ss => ss.Set().Select(e => new { e.Id, SRID = e.Point == null ? (int?)null : e.Point.SRID }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SRID_geometry(bool async) => AssertQuery( async, - ss => ss.Set().Select( - e => new { e.Id, SRID = e.Geometry == null ? (int?)null : e.Geometry.SRID }), + ss => ss.Set().Select(e => new { e.Id, SRID = e.Geometry == null ? (int?)null : e.Geometry.SRID }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task StartPoint(bool async) => AssertQuery( async, @@ -1035,8 +952,7 @@ public virtual Task StartPoint(bool async) .Select(e => new { e.Id, StartPoint = e.LineString == null ? null : e.LineString.StartPoint }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task SymmetricDifference(bool async) { var polygon = Fixture.GeometryFactory.CreatePolygon( @@ -1045,8 +961,8 @@ public virtual Task SymmetricDifference(bool async) return AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, SymmetricDifference = e.Polygon.SymmetricDifference(polygon) }), - ss => ss.Set().Select( - e => new { e.Id, SymmetricDifference = e.Polygon == null ? null : e.Polygon.SymmetricDifference(polygon) }), + ss => ss.Set().Select(e + => new { e.Id, SymmetricDifference = e.Polygon == null ? null : e.Polygon.SymmetricDifference(polygon) }), elementSorter: x => x.Id, elementAsserter: (e, a) => { @@ -1055,8 +971,7 @@ public virtual Task SymmetricDifference(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToBinary(bool async) => AssertQuery( async, @@ -1069,8 +984,7 @@ public virtual Task ToBinary(bool async) Assert.Equal(e.Binary, a.Binary); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task ToText(bool async) => AssertQuery( async, @@ -1083,8 +997,7 @@ public virtual Task ToText(bool async) Assert.Equal(e.Text, a.Text, WktComparer.Instance); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Touches(bool async) { var polygon = Fixture.GeometryFactory.CreatePolygon( @@ -1098,8 +1011,7 @@ public virtual Task Touches(bool async) elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union(bool async) { var polygon = Fixture.GeometryFactory.CreatePolygon( @@ -1117,8 +1029,7 @@ public virtual Task Union(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_aggregate(bool async) => AssertQuery( async, @@ -1133,8 +1044,7 @@ public virtual Task Union_aggregate(bool async) Assert.Equal(e.Union, a.Union, GeometryComparer.Instance); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Union_void(bool async) => AssertQuery( async, @@ -1143,8 +1053,7 @@ public virtual Task Union_void(bool async) .Select(e => new { e.Id, Union = e.MultiLineString == null ? null : e.MultiLineString.Union() }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Within(bool async) { var polygon = Fixture.GeometryFactory.CreatePolygon( @@ -1157,24 +1066,21 @@ public virtual Task Within(bool async) elementSorter: x => x.Id); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task X(bool async) => AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, X = e.Point == null ? (double?)null : e.Point.X }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Y(bool async) => AssertQuery( async, ss => ss.Set().Select(e => new { e.Id, Y = e.Point == null ? (double?)null : e.Point.Y }), elementSorter: x => x.Id); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Z(bool async) => AssertQuery( async, @@ -1194,20 +1100,18 @@ public virtual Task Z(bool async) } }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task XY_with_collection_join(bool async) => AssertFirstOrDefault( async, ss => ss.Set() .OrderBy(e => e.Id) - .Select( - e => new - { - e.Id, - I = new { X = e.Point == null ? (double?)null : e.Point.X, Y = e.Point == null ? (double?)null : e.Point.Y }, - List = ss.Set().Where(i => i.Id == e.Id).ToList() - }), + .Select(e => new + { + e.Id, + I = new { X = e.Point == null ? (double?)null : e.Point.X, Y = e.Point == null ? (double?)null : e.Point.Y }, + List = ss.Set().Where(i => i.Id == e.Id).ToList() + }), asserter: (e, a) => { AssertEqual(e.Id, a.Id); @@ -1215,8 +1119,7 @@ public virtual Task XY_with_collection_join(bool async) AssertCollection(e.List, a.List); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IsEmpty_equal_to_null(bool async) { return AssertQueryScalar( @@ -1227,8 +1130,7 @@ public virtual Task IsEmpty_equal_to_null(bool async) ss => ss.Set().Where(e => e.Point == null).Select(e => e.Id)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task IsEmpty_not_equal_to_null(bool async) { return AssertQueryScalar( @@ -1239,8 +1141,7 @@ public virtual Task IsEmpty_not_equal_to_null(bool async) ss => ss.Set().Where(e => e.Point != null).Select(e => e.Id)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Intersects_equal_to_null(bool async) { var lineString = Fixture.GeometryFactory.CreateLineString([new Coordinate(0.5, -0.5), new Coordinate(0.5, 0.5)]); @@ -1260,8 +1161,7 @@ await AssertQueryScalar( ss => ss.Set().Where(e => e.LineString == null).Select(e => e.Id)); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Intersects_not_equal_to_null(bool async) { var lineString = Fixture.GeometryFactory.CreateLineString([new Coordinate(0.5, -0.5), new Coordinate(0.5, 0.5)]); diff --git a/test/EFCore.Specification.Tests/Query/Translations/ByteArrayTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/ByteArrayTranslationsTestBase.cs index b60b2494141..dd4a405cf57 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/ByteArrayTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/ByteArrayTranslationsTestBase.cs @@ -10,44 +10,37 @@ public abstract class ByteArrayTranslationsTestBase(TFixture fixture) { [ConditionalFact] public virtual Task Length() - => AssertQuery( - ss => ss.Set().Where(e => e.ByteArray.Length == 4)); + => AssertQuery(ss => ss.Set().Where(e => e.ByteArray.Length == 4)); [ConditionalFact] public virtual Task Index() - => AssertQuery( - ss => ss.Set().Where(e => e.ByteArray.Length >= 3 && e.ByteArray[2] == 0xBE)); + => AssertQuery(ss => ss.Set().Where(e => e.ByteArray.Length >= 3 && e.ByteArray[2] == 0xBE)); [ConditionalFact] public virtual Task First() - => AssertQuery( - ss => ss.Set().Where(e => e.ByteArray.Length >= 1 && e.ByteArray.First() == 0xDE)); + => AssertQuery(ss => ss.Set().Where(e => e.ByteArray.Length >= 1 && e.ByteArray.First() == 0xDE)); [ConditionalFact] public virtual Task Contains_with_constant() - => AssertQuery( - ss => ss.Set().Where(s => s.ByteArray.Contains((byte)1))); + => AssertQuery(ss => ss.Set().Where(s => s.ByteArray.Contains((byte)1))); [ConditionalFact] public virtual Task Contains_with_parameter() { byte someByte = 1; - return AssertQuery( - ss => ss.Set().Where(s => s.ByteArray.Contains(someByte))); + return AssertQuery(ss => ss.Set().Where(s => s.ByteArray.Contains(someByte))); } [ConditionalFact] public virtual Task Contains_with_column() - => AssertQuery( - ss => ss.Set().Where(s => s.ByteArray.Contains(s.Byte))); + => AssertQuery(ss => ss.Set().Where(s => s.ByteArray.Contains(s.Byte))); [ConditionalFact] public virtual Task SequenceEqual() { var byteArrayParam = new byte[] { 0xDE, 0xAD, 0xBE, 0xEF }; - return AssertQuery( - ss => ss.Set().Where(s => s.ByteArray.SequenceEqual(byteArrayParam))); + return AssertQuery(ss => ss.Set().Where(s => s.ByteArray.SequenceEqual(byteArrayParam))); } } diff --git a/test/EFCore.Specification.Tests/Query/Translations/EnumTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/EnumTranslationsTestBase.cs index 739cc3d4503..96c43f9e674 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/EnumTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/EnumTranslationsTestBase.cs @@ -10,86 +10,73 @@ public abstract class EnumTranslationsTestBase(TFixture fixture) : Que { #region Equality - [ConditionalFact] - public virtual Task Equality_to_constant() - => AssertQuery( - ss => ss.Set().Where(b => b.Enum == BasicEnum.One)); - - [ConditionalFact] - public virtual Task Equality_to_parameter() - { - var basicEnum = BasicEnum.One; - - return AssertQuery( - ss => ss.Set().Where(b => b.Enum == basicEnum)); - } - - [ConditionalFact] - public virtual Task Equality_nullable_enum_to_constant() - => AssertQuery( - ss => ss.Set().Where(b => b.Enum == BasicEnum.One)); - - [ConditionalFact] - public virtual Task Equality_nullable_enum_to_parameter() - { - var basicEnum = BasicEnum.One; - - return AssertQuery( - ss => ss.Set().Where(b => b.Enum == basicEnum)); - } - - [ConditionalFact] - public virtual Task Equality_nullable_enum_to_null_constant() - => AssertQuery( - ss => ss.Set().Where(b => b.Enum == null)); - - [ConditionalFact] - public virtual Task Equality_nullable_enum_to_null_parameter() - { - BasicEnum? basicEnum = null; - - return AssertQuery( - ss => ss.Set().Where(b => b.Enum == basicEnum)); - } - - [ConditionalFact] - public virtual Task Equality_nullable_enum_to_nullable_parameter() - { - BasicEnum? basicEnum = BasicEnum.One; - - return AssertQuery( - ss => ss.Set().Where(b => b.Enum == basicEnum)); - } - - #endregion Equality - - [ConditionalFact] - public virtual async Task Bitwise_and_enum_constant() - { - await AssertQuery( - ss => ss.Set().Where(g => (g.FlagsEnum & BasicFlagsEnum.One) > 0)); - - await AssertQuery( - ss => ss.Set().Where(g => (g.FlagsEnum & BasicFlagsEnum.One) == BasicFlagsEnum.One)); - } - - [ConditionalFact] - public virtual async Task Bitwise_and_integral_constant() - { - await AssertQuery( - ss => ss.Set().Where(g => ((int)g.FlagsEnum & 8) == 8)); - - await AssertQuery( - ss => ss.Set().Where(g => ((long)g.FlagsEnum & 8L) == 8L)); - - await AssertQuery( - ss => ss.Set().Where(g => ((short)g.FlagsEnum & 8) == 8)); - } - - [ConditionalFact] - public virtual Task Bitwise_and_nullable_enum_with_constant() - => AssertQuery( - ss => ss.Set().Where(w => (w.FlagsEnum & BasicFlagsEnum.Eight) > 0)); + [ConditionalFact] + public virtual Task Equality_to_constant() + => AssertQuery(ss => ss.Set().Where(b => b.Enum == BasicEnum.One)); + + [ConditionalFact] + public virtual Task Equality_to_parameter() + { + var basicEnum = BasicEnum.One; + + return AssertQuery(ss => ss.Set().Where(b => b.Enum == basicEnum)); + } + + [ConditionalFact] + public virtual Task Equality_nullable_enum_to_constant() + => AssertQuery(ss => ss.Set().Where(b => b.Enum == BasicEnum.One)); + + [ConditionalFact] + public virtual Task Equality_nullable_enum_to_parameter() + { + var basicEnum = BasicEnum.One; + + return AssertQuery(ss => ss.Set().Where(b => b.Enum == basicEnum)); + } + + [ConditionalFact] + public virtual Task Equality_nullable_enum_to_null_constant() + => AssertQuery(ss => ss.Set().Where(b => b.Enum == null)); + + [ConditionalFact] + public virtual Task Equality_nullable_enum_to_null_parameter() + { + BasicEnum? basicEnum = null; + + return AssertQuery(ss => ss.Set().Where(b => b.Enum == basicEnum)); + } + + [ConditionalFact] + public virtual Task Equality_nullable_enum_to_nullable_parameter() + { + BasicEnum? basicEnum = BasicEnum.One; + + return AssertQuery(ss => ss.Set().Where(b => b.Enum == basicEnum)); + } + + #endregion Equality + + [ConditionalFact] + public virtual async Task Bitwise_and_enum_constant() + { + await AssertQuery(ss => ss.Set().Where(g => (g.FlagsEnum & BasicFlagsEnum.One) > 0)); + + await AssertQuery(ss => ss.Set().Where(g => (g.FlagsEnum & BasicFlagsEnum.One) == BasicFlagsEnum.One)); + } + + [ConditionalFact] + public virtual async Task Bitwise_and_integral_constant() + { + await AssertQuery(ss => ss.Set().Where(g => ((int)g.FlagsEnum & 8) == 8)); + + await AssertQuery(ss => ss.Set().Where(g => ((long)g.FlagsEnum & 8L) == 8L)); + + await AssertQuery(ss => ss.Set().Where(g => ((short)g.FlagsEnum & 8) == 8)); + } + + [ConditionalFact] + public virtual Task Bitwise_and_nullable_enum_with_constant() + => AssertQuery(ss => ss.Set().Where(w => (w.FlagsEnum & BasicFlagsEnum.Eight) > 0)); [ConditionalFact] public virtual Task Where_bitwise_and_nullable_enum_with_null_constant() @@ -101,102 +88,88 @@ public virtual Task Where_bitwise_and_nullable_enum_with_null_constant() assertEmpty: true); } - [ConditionalFact] - public virtual Task Where_bitwise_and_nullable_enum_with_non_nullable_parameter() - { - var flagsEnum = BasicFlagsEnum.Eight; - - return AssertQuery( - ss => ss.Set().Where(w => (w.FlagsEnum & flagsEnum) > 0)); - } - - [ConditionalFact] - public virtual async Task Where_bitwise_and_nullable_enum_with_nullable_parameter() - { - BasicFlagsEnum? flagsEnum = BasicFlagsEnum.Eight; - - await AssertQuery( - ss => ss.Set().Where(w => (w.FlagsEnum & flagsEnum) > 0)); - - flagsEnum = null; - - await AssertQuery( - ss => ss.Set().Where(w => (w.FlagsEnum & flagsEnum) > 0), - assertEmpty: true); - } - - [ConditionalFact] - public virtual Task Bitwise_or() - => AssertQuery( - ss => ss.Set().Where(g => (g.FlagsEnum | BasicFlagsEnum.Eight) > 0)); - - [ConditionalFact] - public virtual Task Bitwise_projects_values_in_select() - => AssertFirst( - ss => ss.Set() - .Where(g => (g.FlagsEnum & BasicFlagsEnum.Eight) == BasicFlagsEnum.Eight) - .Select( - b => new - { - BitwiseTrue = (b.FlagsEnum & BasicFlagsEnum.Eight) == BasicFlagsEnum.Eight, - // ReSharper disable once NonConstantEqualityExpressionHasConstantResult - BitwiseFalse = (b.FlagsEnum & BasicFlagsEnum.Eight) == BasicFlagsEnum.Four, - BitwiseValue = b.FlagsEnum & BasicFlagsEnum.Eight - })); - - [ConditionalFact] - public virtual async Task HasFlag() - { - // Constant - await AssertQuery( - ss => ss.Set().Where(b => b.FlagsEnum.HasFlag(BasicFlagsEnum.Eight))); - - // Expression - await AssertQuery( - ss => ss.Set().Where(b => b.FlagsEnum.HasFlag(BasicFlagsEnum.Eight | BasicFlagsEnum.Four)), - assertEmpty: true); - - // Casting - await AssertQuery( - ss => ss.Set().Where(b => b.FlagsEnum.HasFlag((BasicFlagsEnum)8))); - - // Casting to nullable - await AssertQuery( - ss => ss.Set().Where(b => b.FlagsEnum.HasFlag((BasicFlagsEnum?)8))); - - // QuerySource - await AssertQuery( - ss => ss.Set().Where(b => BasicFlagsEnum.Eight.HasFlag(b.FlagsEnum))); - - // Project out - await AssertFirst( - ss => ss.Set() - .Where(b => b.FlagsEnum.HasFlag(BasicFlagsEnum.Eight)) - .Select( - b => new - { - hasFlagTrue = b.FlagsEnum.HasFlag(BasicFlagsEnum.Eight), - hasFlagFalse = b.FlagsEnum.HasFlag(BasicFlagsEnum.Four) - })); - } - - [ConditionalFact] - public virtual Task HasFlag_with_non_nullable_parameter() - { - var flagsEnum = BasicFlagsEnum.Eight; - - return AssertQuery( - ss => ss.Set().Where(b => b.FlagsEnum.HasFlag(flagsEnum))); - } - - [ConditionalFact] - public virtual Task HasFlag_with_nullable_parameter() - { - BasicFlagsEnum? flagsEnum = BasicFlagsEnum.Eight; - - return AssertQuery( - ss => ss.Set().Where(b => b.FlagsEnum.HasFlag(flagsEnum))); - } + [ConditionalFact] + public virtual Task Where_bitwise_and_nullable_enum_with_non_nullable_parameter() + { + var flagsEnum = BasicFlagsEnum.Eight; + + return AssertQuery(ss => ss.Set().Where(w => (w.FlagsEnum & flagsEnum) > 0)); + } + + [ConditionalFact] + public virtual async Task Where_bitwise_and_nullable_enum_with_nullable_parameter() + { + BasicFlagsEnum? flagsEnum = BasicFlagsEnum.Eight; + + await AssertQuery(ss => ss.Set().Where(w => (w.FlagsEnum & flagsEnum) > 0)); + + flagsEnum = null; + + await AssertQuery( + ss => ss.Set().Where(w => (w.FlagsEnum & flagsEnum) > 0), + assertEmpty: true); + } + + [ConditionalFact] + public virtual Task Bitwise_or() + => AssertQuery(ss => ss.Set().Where(g => (g.FlagsEnum | BasicFlagsEnum.Eight) > 0)); + + [ConditionalFact] + public virtual Task Bitwise_projects_values_in_select() + => AssertFirst(ss => ss.Set() + .Where(g => (g.FlagsEnum & BasicFlagsEnum.Eight) == BasicFlagsEnum.Eight) + .Select(b => new + { + BitwiseTrue = (b.FlagsEnum & BasicFlagsEnum.Eight) == BasicFlagsEnum.Eight, + // ReSharper disable once NonConstantEqualityExpressionHasConstantResult + BitwiseFalse = (b.FlagsEnum & BasicFlagsEnum.Eight) == BasicFlagsEnum.Four, + BitwiseValue = b.FlagsEnum & BasicFlagsEnum.Eight + })); + + [ConditionalFact] + public virtual async Task HasFlag() + { + // Constant + await AssertQuery(ss => ss.Set().Where(b => b.FlagsEnum.HasFlag(BasicFlagsEnum.Eight))); + + // Expression + await AssertQuery( + ss => ss.Set().Where(b => b.FlagsEnum.HasFlag(BasicFlagsEnum.Eight | BasicFlagsEnum.Four)), + assertEmpty: true); + + // Casting + await AssertQuery(ss => ss.Set().Where(b => b.FlagsEnum.HasFlag((BasicFlagsEnum)8))); + + // Casting to nullable + await AssertQuery(ss => ss.Set().Where(b => b.FlagsEnum.HasFlag((BasicFlagsEnum?)8))); + + // QuerySource + await AssertQuery(ss => ss.Set().Where(b => BasicFlagsEnum.Eight.HasFlag(b.FlagsEnum))); + + // Project out + await AssertFirst(ss => ss.Set() + .Where(b => b.FlagsEnum.HasFlag(BasicFlagsEnum.Eight)) + .Select(b => new + { + hasFlagTrue = b.FlagsEnum.HasFlag(BasicFlagsEnum.Eight), hasFlagFalse = b.FlagsEnum.HasFlag(BasicFlagsEnum.Four) + })); + } + + [ConditionalFact] + public virtual Task HasFlag_with_non_nullable_parameter() + { + var flagsEnum = BasicFlagsEnum.Eight; + + return AssertQuery(ss => ss.Set().Where(b => b.FlagsEnum.HasFlag(flagsEnum))); + } + + [ConditionalFact] + public virtual Task HasFlag_with_nullable_parameter() + { + BasicFlagsEnum? flagsEnum = BasicFlagsEnum.Eight; + + return AssertQuery(ss => ss.Set().Where(b => b.FlagsEnum.HasFlag(flagsEnum))); + } protected BasicTypesContext CreateContext() => Fixture.CreateContext(); diff --git a/test/EFCore.Specification.Tests/Query/Translations/GuidTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/GuidTranslationsTestBase.cs index 96af0d0e01a..7d104f9044f 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/GuidTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/GuidTranslationsTestBase.cs @@ -10,16 +10,14 @@ public abstract class GuidTranslationsTestBase(TFixture fixture) : Que { [ConditionalFact] public virtual Task New_with_constant() - => AssertQuery( - ss => ss.Set().Where(b => b.Guid == new Guid("DF36F493-463F-4123-83F9-6B135DEEB7BA"))); + => AssertQuery(ss => ss.Set().Where(b => b.Guid == new Guid("DF36F493-463F-4123-83F9-6B135DEEB7BA"))); [ConditionalFact] public virtual async Task New_with_parameter() { var guid = "DF36F493-463F-4123-83F9-6B135DEEB7BA"; - await AssertQuery( - ss => ss.Set().Where(b => b.Guid == new Guid(guid))); + await AssertQuery(ss => ss.Set().Where(b => b.Guid == new Guid(guid))); } [ConditionalFact] @@ -30,6 +28,5 @@ public virtual Task ToString_projection() [ConditionalFact] public virtual Task NewGuid() - => AssertQuery( - ss => ss.Set().Where(od => Guid.NewGuid() != default)); + => AssertQuery(ss => ss.Set().Where(od => Guid.NewGuid() != default)); } diff --git a/test/EFCore.Specification.Tests/Query/Translations/MathTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/MathTranslationsTestBase.cs index da27a749d15..f6b9e993b27 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/MathTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/MathTranslationsTestBase.cs @@ -10,142 +10,114 @@ public abstract class MathTranslationsTestBase(TFixture fixture) : Que { [ConditionalFact] public virtual Task Abs_decimal() - => AssertQuery( - ss => ss.Set().Where(od => Math.Abs(od.Decimal) == 9.5m)); + => AssertQuery(ss => ss.Set().Where(od => Math.Abs(od.Decimal) == 9.5m)); [ConditionalFact] public virtual Task Abs_int() - => AssertQuery( - ss => ss.Set().Where(b => Math.Abs(b.Int) == 9)); + => AssertQuery(ss => ss.Set().Where(b => Math.Abs(b.Int) == 9)); [ConditionalFact] public virtual Task Abs_double() - => AssertQuery( - ss => ss.Set().Where(b => Math.Abs(b.Double) == 9.5)); + => AssertQuery(ss => ss.Set().Where(b => Math.Abs(b.Double) == 9.5)); [ConditionalFact] public virtual Task Abs_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Abs(b.Float) == 9.5)); + => AssertQuery(ss => ss.Set().Where(b => MathF.Abs(b.Float) == 9.5)); [ConditionalFact] public virtual Task Ceiling() - => AssertQuery( - ss => ss.Set().Where(b => Math.Ceiling(b.Double) == 9)); + => AssertQuery(ss => ss.Set().Where(b => Math.Ceiling(b.Double) == 9)); [ConditionalFact] public virtual Task Ceiling_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Ceiling(b.Float) == 9)); + => AssertQuery(ss => ss.Set().Where(b => MathF.Ceiling(b.Float) == 9)); [ConditionalFact] public virtual Task Floor_decimal() - => AssertQuery( - ss => ss.Set().Where(b => Math.Floor(b.Decimal) == 8)); + => AssertQuery(ss => ss.Set().Where(b => Math.Floor(b.Decimal) == 8)); [ConditionalFact] public virtual Task Floor_double() - => AssertQuery( - ss => ss.Set().Where(b => Math.Floor(b.Double) == 8)); + => AssertQuery(ss => ss.Set().Where(b => Math.Floor(b.Double) == 8)); [ConditionalFact] public virtual Task Floor_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Floor(b.Float) == 8)); + => AssertQuery(ss => ss.Set().Where(b => MathF.Floor(b.Float) == 8)); [ConditionalFact] public virtual Task Exp() - => AssertQuery( - ss => ss.Set().Where(b => Math.Exp(b.Double) > 1)); + => AssertQuery(ss => ss.Set().Where(b => Math.Exp(b.Double) > 1)); [ConditionalFact] public virtual Task Exp_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Exp(b.Float) > 1)); + => AssertQuery(ss => ss.Set().Where(b => MathF.Exp(b.Float) > 1)); [ConditionalFact] public virtual Task Power() - => AssertQuery( - ss => ss.Set().Where(b => Math.Pow(b.Int, 2) == 64)); + => AssertQuery(ss => ss.Set().Where(b => Math.Pow(b.Int, 2) == 64)); [ConditionalFact] public virtual Task Power_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Pow(b.Float, 2) > 73 && MathF.Pow(b.Float, 2) < 74)); + => AssertQuery(ss => ss.Set().Where(b => MathF.Pow(b.Float, 2) > 73 && MathF.Pow(b.Float, 2) < 74)); [ConditionalFact] public virtual async Task Round_decimal() { - await AssertQuery( - ss => ss.Set().Where(b => Math.Round(b.Decimal) == 9)); + await AssertQuery(ss => ss.Set().Where(b => Math.Round(b.Decimal) == 9)); - await AssertQueryScalar( - ss => ss.Set().Select(b => Math.Round(b.Decimal))); + await AssertQueryScalar(ss => ss.Set().Select(b => Math.Round(b.Decimal))); } [ConditionalFact] public virtual async Task Round_double() { - await AssertQuery( - ss => ss.Set().Where(b => Math.Round(b.Double) == 9)); + await AssertQuery(ss => ss.Set().Where(b => Math.Round(b.Double) == 9)); - await AssertQueryScalar( - ss => ss.Set().Select(b => Math.Round(b.Double))); + await AssertQueryScalar(ss => ss.Set().Select(b => Math.Round(b.Double))); } [ConditionalFact] public virtual async Task Round_float() { - await AssertQuery( - ss => ss.Set().Where(b => MathF.Round(b.Float) == 9)); + await AssertQuery(ss => ss.Set().Where(b => MathF.Round(b.Float) == 9)); - await AssertQueryScalar( - ss => ss.Set().Select(b => MathF.Round(b.Float))); + await AssertQueryScalar(ss => ss.Set().Select(b => MathF.Round(b.Float))); } [ConditionalFact] public virtual Task Round_with_digits_decimal() - => AssertQuery( - ss => ss.Set().Where(b => Math.Round(b.Decimal, 1) == 255.1m)); + => AssertQuery(ss => ss.Set().Where(b => Math.Round(b.Decimal, 1) == 255.1m)); [ConditionalFact] public virtual Task Round_with_digits_double() - => AssertQuery( - ss => ss.Set().Where(b => Math.Round(b.Double, 1) == 255.1)); + => AssertQuery(ss => ss.Set().Where(b => Math.Round(b.Double, 1) == 255.1)); [ConditionalFact] public virtual Task Round_with_digits_float() - => AssertQuery( - ss => ss.Set().Where(b => Math.Round(b.Float, 1) == 255.1)); + => AssertQuery(ss => ss.Set().Where(b => Math.Round(b.Float, 1) == 255.1)); [ConditionalFact] public virtual async Task Truncate_decimal() { - await AssertQuery( - ss => ss.Set().Where(b => Math.Truncate(b.Decimal) == 8)); + await AssertQuery(ss => ss.Set().Where(b => Math.Truncate(b.Decimal) == 8)); - await AssertQueryScalar( - ss => ss.Set().Select(b => Math.Truncate(b.Decimal))); + await AssertQueryScalar(ss => ss.Set().Select(b => Math.Truncate(b.Decimal))); } [ConditionalFact] public virtual async Task Truncate_double() { - await AssertQuery( - ss => ss.Set().Where(b => Math.Truncate(b.Double) == 8)); + await AssertQuery(ss => ss.Set().Where(b => Math.Truncate(b.Double) == 8)); - await AssertQueryScalar( - ss => ss.Set().Select(b => Math.Truncate(b.Double))); + await AssertQueryScalar(ss => ss.Set().Select(b => Math.Truncate(b.Double))); } [ConditionalFact] public virtual async Task Truncate_float() { - await AssertQuery( - ss => ss.Set().Where(b => MathF.Truncate(b.Float) == 8)); + await AssertQuery(ss => ss.Set().Where(b => MathF.Truncate(b.Float) == 8)); - await AssertQueryScalar( - ss => ss.Set().Select(b => MathF.Truncate(b.Float))); + await AssertQueryScalar(ss => ss.Set().Select(b => MathF.Truncate(b.Float))); } [ConditionalFact] @@ -179,216 +151,175 @@ public virtual Task Truncate_project_and_order_by_it_twice3() [ConditionalFact] public virtual Task Log() - => AssertQuery( - ss => ss.Set().Where(b => b.Double > 0 && Math.Log(b.Double) != 0)); + => AssertQuery(ss => ss.Set().Where(b => b.Double > 0 && Math.Log(b.Double) != 0)); [ConditionalFact] public virtual Task Log_float() - => AssertQuery( - ss => ss.Set().Where(b => b.Float > 0 && MathF.Log(b.Float) != 0)); + => AssertQuery(ss => ss.Set().Where(b => b.Float > 0 && MathF.Log(b.Float) != 0)); [ConditionalFact] public virtual Task Log_with_newBase() - => AssertQuery( - ss => ss.Set().Where(b => b.Double > 0 && Math.Log(b.Double, 7) != 0)); + => AssertQuery(ss => ss.Set().Where(b => b.Double > 0 && Math.Log(b.Double, 7) != 0)); [ConditionalFact] public virtual Task Log_with_newBase_float() - => AssertQuery( - ss => ss.Set().Where(b => b.Float > 0 && MathF.Log(b.Float, 7) != 0)); + => AssertQuery(ss => ss.Set().Where(b => b.Float > 0 && MathF.Log(b.Float, 7) != 0)); [ConditionalFact] public virtual Task Log10() - => AssertQuery( - ss => ss.Set().Where(b => b.Double > 0 && Math.Log10(b.Double) != 0)); + => AssertQuery(ss => ss.Set().Where(b => b.Double > 0 && Math.Log10(b.Double) != 0)); [ConditionalFact] public virtual Task Log10_float() - => AssertQuery( - ss => ss.Set().Where(b => b.Float > 0 && MathF.Log10(b.Float) != 0)); + => AssertQuery(ss => ss.Set().Where(b => b.Float > 0 && MathF.Log10(b.Float) != 0)); [ConditionalFact] public virtual Task Log2() - => AssertQuery( - ss => ss.Set().Where(b => b.Double > 0 && Math.Log2(b.Double) != 0)); + => AssertQuery(ss => ss.Set().Where(b => b.Double > 0 && Math.Log2(b.Double) != 0)); [ConditionalFact] public virtual Task Sqrt() - => AssertQuery( - ss => ss.Set().Where(b => b.Double > 0 && Math.Sqrt(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => b.Double > 0 && Math.Sqrt(b.Double) > 0)); [ConditionalFact] public virtual Task Sqrt_float() - => AssertQuery( - ss => ss.Set().Where(b => b.Float > 0 && MathF.Sqrt(b.Float) > 0)); + => AssertQuery(ss => ss.Set().Where(b => b.Float > 0 && MathF.Sqrt(b.Float) > 0)); [ConditionalFact] public virtual Task Sign() - => AssertQuery( - ss => ss.Set().Where(b => Math.Sign(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Sign(b.Double) > 0)); [ConditionalFact] public virtual Task Sign_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Sign(b.Float) > 0)); + => AssertQuery(ss => ss.Set().Where(b => MathF.Sign(b.Float) > 0)); [ConditionalFact] public virtual Task Max() - => AssertQuery( - ss => ss.Set().Where(b => Math.Max(b.Int, b.Short - 3) == b.Int)); + => AssertQuery(ss => ss.Set().Where(b => Math.Max(b.Int, b.Short - 3) == b.Int)); [ConditionalFact] public virtual Task Max_nested() - => AssertQuery( - ss => ss.Set() - .Where(b => Math.Max(b.Short - 3, Math.Max(b.Int, 1)) == b.Int)); + => AssertQuery(ss => ss.Set() + .Where(b => Math.Max(b.Short - 3, Math.Max(b.Int, 1)) == b.Int)); [ConditionalFact] public virtual Task Max_nested_twice() - => AssertQuery( - ss => ss.Set() - .Where(b => Math.Max(Math.Max(1, Math.Max(b.Int, 2)), b.Short - 3) == b.Int)); + => AssertQuery(ss => ss.Set() + .Where(b => Math.Max(Math.Max(1, Math.Max(b.Int, 2)), b.Short - 3) == b.Int)); [ConditionalFact] public virtual Task Min() - => AssertQuery( - ss => ss.Set() - .Where(b => Math.Min(b.Int, b.Short + 3) == b.Int)); + => AssertQuery(ss => ss.Set() + .Where(b => Math.Min(b.Int, b.Short + 3) == b.Int)); [ConditionalFact] public virtual Task Min_nested() - => AssertQuery( - ss => ss.Set() - .Where(b => Math.Min(b.Short + 3, Math.Min(b.Int, 99999)) == b.Int)); + => AssertQuery(ss => ss.Set() + .Where(b => Math.Min(b.Short + 3, Math.Min(b.Int, 99999)) == b.Int)); [ConditionalFact] public virtual Task Min_nested_twice() - => AssertQuery( - ss => ss.Set() - .Where(b => Math.Min(Math.Min(99999, Math.Min(b.Int, 99998)), b.Short + 3) == b.Int)); + => AssertQuery(ss => ss.Set() + .Where(b => Math.Min(Math.Min(99999, Math.Min(b.Int, 99998)), b.Short + 3) == b.Int)); [ConditionalFact] public virtual Task Degrees() - => AssertQuery( - ss => ss.Set().Where(b => double.RadiansToDegrees(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => double.RadiansToDegrees(b.Double) > 0)); [ConditionalFact] public virtual Task Degrees_float() - => AssertQuery( - ss => ss.Set().Where(b => float.RadiansToDegrees(b.Float) > 0)); + => AssertQuery(ss => ss.Set().Where(b => float.RadiansToDegrees(b.Float) > 0)); [ConditionalFact] public virtual Task Radians() - => AssertQuery( - ss => ss.Set().Where(b => double.DegreesToRadians(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => double.DegreesToRadians(b.Double) > 0)); [ConditionalFact] public virtual Task Radians_float() - => AssertQuery( - ss => ss.Set().Where(b => float.DegreesToRadians(b.Float) > 0)); + => AssertQuery(ss => ss.Set().Where(b => float.DegreesToRadians(b.Float) > 0)); #region Trigonometry [ConditionalFact] public virtual Task Acos() - => AssertQuery( - ss => ss.Set().Where(b => b.Double >= -1 && b.Double <= 1 && Math.Acos(b.Double) > 1)); + => AssertQuery(ss => ss.Set().Where(b => b.Double >= -1 && b.Double <= 1 && Math.Acos(b.Double) > 1)); [ConditionalFact] public virtual Task Acos_float() - => AssertQuery( - ss => ss.Set().Where(b => b.Float >= -1 && b.Float <= 1 && MathF.Acos(b.Float) > 0)); + => AssertQuery(ss => ss.Set().Where(b => b.Float >= -1 && b.Float <= 1 && MathF.Acos(b.Float) > 0)); [ConditionalFact] public virtual Task Acosh() - => AssertQuery( - ss => ss.Set().Where(b => Math.Acosh(b.Double + 1) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Acosh(b.Double + 1) > 0)); [ConditionalFact] public virtual Task Asin() - => AssertQuery( - ss => ss.Set().Where(b => b.Double >= -1 && b.Double <= 1 && Math.Asin(b.Double) > double.MinValue)); + => AssertQuery(ss + => ss.Set().Where(b => b.Double >= -1 && b.Double <= 1 && Math.Asin(b.Double) > double.MinValue)); [ConditionalFact] public virtual Task Asin_float() - => AssertQuery( - ss => ss.Set().Where(b => b.Float >= -1 && b.Float <= 1 && MathF.Asin(b.Float) > double.MinValue)); + => AssertQuery(ss => ss.Set().Where(b => b.Float >= -1 && b.Float <= 1 && MathF.Asin(b.Float) > double.MinValue)); [ConditionalFact] public virtual Task Asinh() - => AssertQuery( - ss => ss.Set().Where(b => Math.Asinh(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Asinh(b.Double) > 0)); [ConditionalFact] public virtual Task Atan() - => AssertQuery( - ss => ss.Set().Where(b => Math.Atan(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Atan(b.Double) > 0)); [ConditionalFact] public virtual Task Atan_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Atan(b.Float) > 0)); - + => AssertQuery(ss => ss.Set().Where(b => MathF.Atan(b.Float) > 0)); [ConditionalFact] public virtual Task Atanh() - => AssertQuery( - ss => ss.Set().Where(b => Math.Atanh(b.Double) > double.MinValue)); + => AssertQuery(ss => ss.Set().Where(b => Math.Atanh(b.Double) > double.MinValue)); [ConditionalFact] public virtual Task Atan2() - => AssertQuery( - ss => ss.Set().Where(b => Math.Atan2(b.Double, 1) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Atan2(b.Double, 1) > 0)); [ConditionalFact] public virtual Task Atan2_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Atan2(b.Float, 1) > 0)); + => AssertQuery(ss => ss.Set().Where(b => MathF.Atan2(b.Float, 1) > 0)); [ConditionalFact] public virtual Task Cos() - => AssertQuery( - ss => ss.Set().Where(b => Math.Cos(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Cos(b.Double) > 0)); [ConditionalFact] public virtual Task Cos_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Cos(b.Float) > 0)); + => AssertQuery(ss => ss.Set().Where(b => MathF.Cos(b.Float) > 0)); [ConditionalFact] public virtual Task Cosh() - => AssertQuery( - ss => ss.Set().Where(b => Math.Cosh(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Cosh(b.Double) > 0)); [ConditionalFact] public virtual Task Sin() - => AssertQuery( - ss => ss.Set().Where(b => Math.Sin(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Sin(b.Double) > 0)); [ConditionalFact] public virtual Task Sin_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Sin(b.Float) > 0)); + => AssertQuery(ss => ss.Set().Where(b => MathF.Sin(b.Float) > 0)); [ConditionalFact] public virtual Task Sinh() - => AssertQuery( - ss => ss.Set().Where(b => Math.Sinh(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Sinh(b.Double) > 0)); [ConditionalFact] public virtual Task Tan() - => AssertQuery( - ss => ss.Set().Where(b => Math.Tan(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Tan(b.Double) > 0)); [ConditionalFact] public virtual Task Tan_float() - => AssertQuery( - ss => ss.Set().Where(b => MathF.Tan(b.Float) > 0)); + => AssertQuery(ss => ss.Set().Where(b => MathF.Tan(b.Float) > 0)); [ConditionalFact] public virtual Task Tanh() - => AssertQuery( - ss => ss.Set().Where(b => Math.Tanh(b.Double) > 0)); + => AssertQuery(ss => ss.Set().Where(b => Math.Tanh(b.Double) > 0)); #endregion Trigonometry } diff --git a/test/EFCore.Specification.Tests/Query/Translations/MiscellaneousTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/MiscellaneousTranslationsTestBase.cs index d9ee8660f2a..e55d1fc6c48 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/MiscellaneousTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/MiscellaneousTranslationsTestBase.cs @@ -26,28 +26,23 @@ public virtual Task Random_Shared_Next_with_no_args() [ConditionalFact] public virtual Task Random_Shared_Next_with_one_arg() - => AssertQuery( - ss => ss.Set().Where(o => o.Int > Random.Shared.Next(5) - 2147483647)); + => AssertQuery(ss => ss.Set().Where(o => o.Int > Random.Shared.Next(5) - 2147483647)); [ConditionalFact] public virtual Task Random_Shared_Next_with_two_args() - => AssertQuery( - ss => ss.Set().Where(o => o.Int > Random.Shared.Next(0, 10) - 2147483647)); + => AssertQuery(ss => ss.Set().Where(o => o.Int > Random.Shared.Next(0, 10) - 2147483647)); [ConditionalFact] public virtual Task Random_new_Next_with_no_args() - => AssertQuery( - ss => ss.Set().Where(o => o.Int > new Random(15).Next() - 2147483647)); + => AssertQuery(ss => ss.Set().Where(o => o.Int > new Random(15).Next() - 2147483647)); [ConditionalFact] public virtual Task Random_new_Next_with_one_arg() - => AssertQuery( - ss => ss.Set().Where(o => o.Int > new Random(15).Next(5) - 2147483647)); + => AssertQuery(ss => ss.Set().Where(o => o.Int > new Random(15).Next(5) - 2147483647)); [ConditionalFact] public virtual Task Random_new_Next_with_two_args() - => AssertQuery( - ss => ss.Set().Where(o => o.Int > new Random(15).Next(0, 10) - 2147483647)); + => AssertQuery(ss => ss.Set().Where(o => o.Int > new Random(15).Next(0, 10) - 2147483647)); #endregion Random @@ -248,120 +243,86 @@ public virtual async Task Int_Compare_to_simple_zero() { var orderId = 8; - await AssertQuery( - ss => ss.Set().Where(c => c.Int.CompareTo(orderId) == 0)); + await AssertQuery(ss => ss.Set().Where(c => c.Int.CompareTo(orderId) == 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 != c.Int.CompareTo(orderId))); + await AssertQuery(ss => ss.Set().Where(c => 0 != c.Int.CompareTo(orderId))); - await AssertQuery( - ss => ss.Set().Where(c => c.Int.CompareTo(orderId) > 0)); + await AssertQuery(ss => ss.Set().Where(c => c.Int.CompareTo(orderId) > 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 >= c.Int.CompareTo(orderId))); + await AssertQuery(ss => ss.Set().Where(c => 0 >= c.Int.CompareTo(orderId))); - await AssertQuery( - ss => ss.Set().Where(c => 0 < c.Int.CompareTo(orderId))); + await AssertQuery(ss => ss.Set().Where(c => 0 < c.Int.CompareTo(orderId))); - await AssertQuery( - ss => ss.Set().Where(c => c.Int.CompareTo(orderId) <= 0)); + await AssertQuery(ss => ss.Set().Where(c => c.Int.CompareTo(orderId) <= 0)); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task DateTime_Compare_to_simple_zero(bool compareTo) { var dateTime = new DateTime(1998, 5, 4, 15, 30, 10); if (compareTo) { - await AssertQuery( - ss => ss.Set().Where(c => c.DateTime.CompareTo(dateTime) == 0)); + await AssertQuery(ss => ss.Set().Where(c => c.DateTime.CompareTo(dateTime) == 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 != c.DateTime.CompareTo(dateTime))); + await AssertQuery(ss => ss.Set().Where(c => 0 != c.DateTime.CompareTo(dateTime))); - await AssertQuery( - ss => ss.Set().Where(c => c.DateTime.CompareTo(dateTime) > 0)); + await AssertQuery(ss => ss.Set().Where(c => c.DateTime.CompareTo(dateTime) > 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 >= c.DateTime.CompareTo(dateTime))); + await AssertQuery(ss => ss.Set().Where(c => 0 >= c.DateTime.CompareTo(dateTime))); - await AssertQuery( - ss => ss.Set().Where(c => 0 < c.DateTime.CompareTo(dateTime))); + await AssertQuery(ss => ss.Set().Where(c => 0 < c.DateTime.CompareTo(dateTime))); - await AssertQuery( - ss => ss.Set().Where(c => c.DateTime.CompareTo(dateTime) <= 0)); + await AssertQuery(ss => ss.Set().Where(c => c.DateTime.CompareTo(dateTime) <= 0)); } else { - await AssertQuery( - ss => ss.Set().Where(c => DateTime.Compare(c.DateTime, dateTime) == 0)); + await AssertQuery(ss => ss.Set().Where(c => DateTime.Compare(c.DateTime, dateTime) == 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 != DateTime.Compare(c.DateTime, dateTime))); + await AssertQuery(ss => ss.Set().Where(c => 0 != DateTime.Compare(c.DateTime, dateTime))); - await AssertQuery( - ss => ss.Set().Where(c => DateTime.Compare(c.DateTime, dateTime) > 0)); + await AssertQuery(ss => ss.Set().Where(c => DateTime.Compare(c.DateTime, dateTime) > 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 >= DateTime.Compare(c.DateTime, dateTime))); + await AssertQuery(ss => ss.Set().Where(c => 0 >= DateTime.Compare(c.DateTime, dateTime))); - await AssertQuery( - ss => ss.Set().Where(c => 0 < DateTime.Compare(c.DateTime, dateTime))); + await AssertQuery(ss => ss.Set().Where(c => 0 < DateTime.Compare(c.DateTime, dateTime))); - await AssertQuery( - ss => ss.Set().Where(c => DateTime.Compare(c.DateTime, dateTime) <= 0)); + await AssertQuery(ss => ss.Set().Where(c => DateTime.Compare(c.DateTime, dateTime) <= 0)); } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task TimeSpan_Compare_to_simple_zero(bool compareTo) { var timeSpan = new TimeSpan(1, 2, 3); if (compareTo) { - await AssertQuery( - ss => ss.Set().Where(c => c.TimeSpan.CompareTo(timeSpan) == 0)); + await AssertQuery(ss => ss.Set().Where(c => c.TimeSpan.CompareTo(timeSpan) == 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 != c.TimeSpan.CompareTo(timeSpan))); + await AssertQuery(ss => ss.Set().Where(c => 0 != c.TimeSpan.CompareTo(timeSpan))); - await AssertQuery( - ss => ss.Set().Where(c => c.TimeSpan.CompareTo(timeSpan) > 0)); + await AssertQuery(ss => ss.Set().Where(c => c.TimeSpan.CompareTo(timeSpan) > 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 >= c.TimeSpan.CompareTo(timeSpan))); + await AssertQuery(ss => ss.Set().Where(c => 0 >= c.TimeSpan.CompareTo(timeSpan))); - await AssertQuery( - ss => ss.Set().Where(c => 0 < c.TimeSpan.CompareTo(timeSpan))); + await AssertQuery(ss => ss.Set().Where(c => 0 < c.TimeSpan.CompareTo(timeSpan))); - await AssertQuery( - ss => ss.Set().Where(c => c.TimeSpan.CompareTo(timeSpan) <= 0)); + await AssertQuery(ss => ss.Set().Where(c => c.TimeSpan.CompareTo(timeSpan) <= 0)); } else { - await AssertQuery( - ss => ss.Set().Where(c => TimeSpan.Compare(c.TimeSpan, timeSpan) == 0)); + await AssertQuery(ss => ss.Set().Where(c => TimeSpan.Compare(c.TimeSpan, timeSpan) == 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 != TimeSpan.Compare(c.TimeSpan, timeSpan))); + await AssertQuery(ss => ss.Set().Where(c => 0 != TimeSpan.Compare(c.TimeSpan, timeSpan))); - await AssertQuery( - ss => ss.Set().Where(c => TimeSpan.Compare(c.TimeSpan, timeSpan) > 0)); + await AssertQuery(ss => ss.Set().Where(c => TimeSpan.Compare(c.TimeSpan, timeSpan) > 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 >= TimeSpan.Compare(c.TimeSpan, timeSpan))); + await AssertQuery(ss => ss.Set().Where(c => 0 >= TimeSpan.Compare(c.TimeSpan, timeSpan))); - await AssertQuery( - ss => ss.Set().Where(c => 0 < TimeSpan.Compare(c.TimeSpan, timeSpan))); + await AssertQuery(ss => ss.Set().Where(c => 0 < TimeSpan.Compare(c.TimeSpan, timeSpan))); - await AssertQuery( - ss => ss.Set().Where(c => TimeSpan.Compare(c.TimeSpan, timeSpan) <= 0)); + await AssertQuery(ss => ss.Set().Where(c => TimeSpan.Compare(c.TimeSpan, timeSpan) <= 0)); } } diff --git a/test/EFCore.Specification.Tests/Query/Translations/Operators/ArithmeticOperatorTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/Operators/ArithmeticOperatorTranslationsTestBase.cs index a099eed2d28..3a8726bf81f 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/Operators/ArithmeticOperatorTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/Operators/ArithmeticOperatorTranslationsTestBase.cs @@ -10,26 +10,21 @@ public abstract class ArithmeticOperatorTranslationsTestBase(TFixture { [ConditionalFact] public virtual async Task Add() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int + 2 == 10)); + => await AssertQuery(ss => ss.Set().Where(b => b.Int + 2 == 10)); [ConditionalFact] public virtual async Task Subtract() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int - 3 == 5)); + => await AssertQuery(ss => ss.Set().Where(b => b.Int - 3 == 5)); [ConditionalFact] public virtual async Task Multiply() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int * 2 == 16)); + => await AssertQuery(ss => ss.Set().Where(b => b.Int * 2 == 16)); [ConditionalFact] public virtual async Task Modulo() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int % 3 == 2)); + => await AssertQuery(ss => ss.Set().Where(b => b.Int % 3 == 2)); [ConditionalFact] public virtual async Task Minus() - => await AssertQuery( - ss => ss.Set().Where(b => -b.Int == -8)); + => await AssertQuery(ss => ss.Set().Where(b => -b.Int == -8)); } diff --git a/test/EFCore.Specification.Tests/Query/Translations/Operators/BitwiseOperatorTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/Operators/BitwiseOperatorTranslationsTestBase.cs index 09fb71ec2fc..47c986c8159 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/Operators/BitwiseOperatorTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/Operators/BitwiseOperatorTranslationsTestBase.cs @@ -13,100 +13,80 @@ public abstract class BitwiseOperatorTranslationsTestBase(TFixture fix [ConditionalFact] public virtual async Task Or() { - await AssertQuery( - ss => ss.Set().Where(b => (b.Int | b.Long) == 7)); + await AssertQuery(ss => ss.Set().Where(b => (b.Int | b.Long) == 7)); - await AssertQueryScalar( - ss => ss.Set().Select(b => b.Int | b.Long)); + await AssertQueryScalar(ss => ss.Set().Select(b => b.Int | b.Long)); } [ConditionalFact] public virtual async Task Or_over_boolean() { - await AssertQuery( - ss => ss.Set().Where(b => b.Int == 12 | b.String == "Seattle")); + await AssertQuery(ss => ss.Set().Where(b => b.Int == 12 | b.String == "Seattle")); - await AssertQueryScalar( - ss => ss.Set().Select(b => b.Int == 12 | b.String == "Seattle")); + await AssertQueryScalar(ss => ss.Set().Select(b => b.Int == 12 | b.String == "Seattle")); } [ConditionalFact] public virtual Task Or_multiple() - => AssertQuery( - ss => ss.Set().Where(b => (b.Int | b.Short | b.Long) == 7)); + => AssertQuery(ss => ss.Set().Where(b => (b.Int | b.Short | b.Long) == 7)); [ConditionalFact] public virtual async Task And() { - await AssertQuery( - ss => ss.Set().Where(b => (b.Int & b.Short) == 2)); + await AssertQuery(ss => ss.Set().Where(b => (b.Int & b.Short) == 2)); - await AssertQueryScalar( - ss => ss.Set().Select(b => b.Int & b.Short)); + await AssertQueryScalar(ss => ss.Set().Select(b => b.Int & b.Short)); } [ConditionalFact] public virtual async Task And_over_boolean() { - await AssertQuery( - ss => ss.Set().Where(b => b.Int == 8 & b.String == "Seattle")); + await AssertQuery(ss => ss.Set().Where(b => b.Int == 8 & b.String == "Seattle")); - await AssertQueryScalar( - ss => ss.Set().Select(b => b.Int == 8 & b.String == "Seattle")); + await AssertQueryScalar(ss => ss.Set().Select(b => b.Int == 8 & b.String == "Seattle")); } [ConditionalFact] public virtual async Task Xor() { - await AssertQuery( - ss => ss.Set().Where(b => (b.Int ^ b.Short) == 1)); + await AssertQuery(ss => ss.Set().Where(b => (b.Int ^ b.Short) == 1)); - await AssertQueryScalar( - ss => ss.Set().Select(b => b.Int ^ b.Short)); + await AssertQueryScalar(ss => ss.Set().Select(b => b.Int ^ b.Short)); } [ConditionalFact] public virtual Task Xor_over_boolean() - => AssertQuery( - ss => ss.Set().Where(b => (b.Int == b.Short) ^ (b.String == "Seattle"))); + => AssertQuery(ss => ss.Set().Where(b => (b.Int == b.Short) ^ (b.String == "Seattle"))); [ConditionalFact] public virtual Task Complement() - => AssertQuery( - ss => ss.Set().Where(b => ~b.Int == -9)); + => AssertQuery(ss => ss.Set().Where(b => ~b.Int == -9)); [ConditionalFact] public virtual Task And_or_over_boolean() - => AssertQuery( - ss => ss.Set().Where(b => b.Int == 12 & b.Short == 12 | b.String == "Seattle")); + => AssertQuery(ss => ss.Set().Where(b => b.Int == 12 & b.Short == 12 | b.String == "Seattle")); [ConditionalFact] public virtual Task Or_with_logical_or() - => AssertQuery( - ss => ss.Set().Where(b => b.Int == 12 | b.Short == 12 || b.String == "Seattle")); + => AssertQuery(ss => ss.Set().Where(b => b.Int == 12 | b.Short == 12 || b.String == "Seattle")); [ConditionalFact] public virtual Task And_with_logical_and() - => AssertQuery( - ss => ss.Set().Where(b => b.Int == 8 & b.Short == 8 && b.String == "Seattle")); + => AssertQuery(ss => ss.Set().Where(b => b.Int == 8 & b.Short == 8 && b.String == "Seattle")); [ConditionalFact] public virtual Task Or_with_logical_and() - => AssertQuery( - ss => ss.Set().Where(b => b.Int == 8 | b.Short == 9 && b.String == "Seattle")); + => AssertQuery(ss => ss.Set().Where(b => b.Int == 8 | b.Short == 9 && b.String == "Seattle")); [ConditionalFact] public virtual Task And_with_logical_or() - => AssertQuery( - ss => ss.Set().Where(b => b.Int == 12 & b.Short == 12 || b.String == "Seattle")); + => AssertQuery(ss => ss.Set().Where(b => b.Int == 12 & b.Short == 12 || b.String == "Seattle")); [ConditionalFact] public virtual Task Left_shift() - => AssertQuery( - ss => ss.Set().Where(b => b.Int << 1 == 16)); + => AssertQuery(ss => ss.Set().Where(b => b.Int << 1 == 16)); [ConditionalFact] public virtual Task Right_shift() - => AssertQuery( - ss => ss.Set().Where(b => b.Int >> 1 == 4)); + => AssertQuery(ss => ss.Set().Where(b => b.Int >> 1 == 4)); } diff --git a/test/EFCore.Specification.Tests/Query/Translations/Operators/ComparisonOperatorTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/Operators/ComparisonOperatorTranslationsTestBase.cs index 1889657cffb..c620d8ca6d7 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/Operators/ComparisonOperatorTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/Operators/ComparisonOperatorTranslationsTestBase.cs @@ -10,31 +10,25 @@ public abstract class ComparisonOperatorTranslationsTestBase(TFixture { [ConditionalFact] public virtual async Task Equal() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int == 8)); + => await AssertQuery(ss => ss.Set().Where(b => b.Int == 8)); [ConditionalFact] public virtual async Task NotEqual() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int != 8)); + => await AssertQuery(ss => ss.Set().Where(b => b.Int != 8)); [ConditionalFact] public virtual async Task GreaterThan() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int > 8)); + => await AssertQuery(ss => ss.Set().Where(b => b.Int > 8)); [ConditionalFact] public virtual async Task GreaterThanOrEqual() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int >= 8)); + => await AssertQuery(ss => ss.Set().Where(b => b.Int >= 8)); [ConditionalFact] public virtual async Task LessThan() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int < 8)); + => await AssertQuery(ss => ss.Set().Where(b => b.Int < 8)); [ConditionalFact] public virtual async Task LessThanOrEqual() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int <= 8)); + => await AssertQuery(ss => ss.Set().Where(b => b.Int <= 8)); } diff --git a/test/EFCore.Specification.Tests/Query/Translations/Operators/LogicalOperatorTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/Operators/LogicalOperatorTranslationsTestBase.cs index a79f8855900..d293046454b 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/Operators/LogicalOperatorTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/Operators/LogicalOperatorTranslationsTestBase.cs @@ -10,23 +10,19 @@ public abstract class LogicalOperatorTranslationsTestBase(TFixture fix { [ConditionalFact] public virtual async Task And() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int == 8 && b.String == "Seattle")); + => await AssertQuery(ss => ss.Set().Where(b => b.Int == 8 && b.String == "Seattle")); [ConditionalFact] public virtual async Task And_with_bool_property() - => await AssertQuery( - ss => ss.Set().Where(b => b.Bool && b.String == "Seattle")); + => await AssertQuery(ss => ss.Set().Where(b => b.Bool && b.String == "Seattle")); [ConditionalFact] public virtual async Task Or() - => await AssertQuery( - ss => ss.Set().Where(b => b.Int == 999 || b.String == "Seattle")); + => await AssertQuery(ss => ss.Set().Where(b => b.Int == 999 || b.String == "Seattle")); [ConditionalFact] public virtual async Task Or_with_bool_property() - => await AssertQuery( - ss => ss.Set().Where(b => b.Bool || b.String == "Seattle")); + => await AssertQuery(ss => ss.Set().Where(b => b.Bool || b.String == "Seattle")); [ConditionalFact] public virtual async Task Not() diff --git a/test/EFCore.Specification.Tests/Query/Translations/Operators/MiscellaneousOperatorTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/Operators/MiscellaneousOperatorTranslationsTestBase.cs index 6bd545d6633..8020ba46a37 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/Operators/MiscellaneousOperatorTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/Operators/MiscellaneousOperatorTranslationsTestBase.cs @@ -10,11 +10,9 @@ public abstract class MiscellaneousOperatorTranslationsTestBase(TFixtu { [ConditionalFact] public virtual async Task Conditional() - => await AssertQuery( - ss => ss.Set().Where(b => (b.Int == 8 ? b.String : "Foo") == "Seattle")); + => await AssertQuery(ss => ss.Set().Where(b => (b.Int == 8 ? b.String : "Foo") == "Seattle")); [ConditionalFact] public virtual async Task Coalesce() - => await AssertQuery( - ss => ss.Set().Where(b => (b.String ?? "Unknown") == "Seattle")); + => await AssertQuery(ss => ss.Set().Where(b => (b.String ?? "Unknown") == "Seattle")); } diff --git a/test/EFCore.Specification.Tests/Query/Translations/StringTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/StringTranslationsTestBase.cs index e4ce7f25a99..9845800f1f1 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/StringTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/StringTranslationsTestBase.cs @@ -13,47 +13,42 @@ public abstract class StringTranslationsTestBase(TFixture fixture) : Q /// /// Controls whether the tests assert case-sensitive or insensitive string comparisons. Defaults to . /// - protected virtual bool IsCaseSensitive => true; + protected virtual bool IsCaseSensitive + => true; #region Equals [ConditionalFact] public virtual Task Equals() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.Equals("Seattle"))) + ? AssertQuery(ss => ss.Set().Where(b => b.String.Equals("Seattle"))) : AssertQuery( ss => ss.Set().Where(b => b.String.Equals("seattle")), ss => ss.Set().Where(b => b.String.Equals("seattle", StringComparison.OrdinalIgnoreCase))); [ConditionalFact] public virtual Task Equals_with_OrdinalIgnoreCase() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Equals("seattle", StringComparison.OrdinalIgnoreCase))); + => AssertQuery(ss => ss.Set().Where(b => b.String.Equals("seattle", StringComparison.OrdinalIgnoreCase))); [ConditionalFact] public virtual Task Equals_with_Ordinal() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Equals("Seattle", StringComparison.Ordinal))); + => AssertQuery(ss => ss.Set().Where(b => b.String.Equals("Seattle", StringComparison.Ordinal))); [ConditionalFact] public virtual Task Static_Equals() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => string.Equals(b.String, "Seattle"))) + ? AssertQuery(ss => ss.Set().Where(b => string.Equals(b.String, "Seattle"))) : AssertQuery( ss => ss.Set().Where(b => string.Equals(b.String, "seattle")), ss => ss.Set().Where(b => string.Equals(b.String, "seattle", StringComparison.OrdinalIgnoreCase))); [ConditionalFact] public virtual Task Static_Equals_with_OrdinalIgnoreCase() - => AssertQuery( - ss => ss.Set().Where(b => string.Equals(b.String, "seattle", StringComparison.OrdinalIgnoreCase))); + => AssertQuery(ss => ss.Set().Where(b => string.Equals(b.String, "seattle", StringComparison.OrdinalIgnoreCase))); [ConditionalFact] public virtual Task Static_Equals_with_Ordinal() - => AssertQuery( - ss => ss.Set().Where(b => string.Equals(b.String, "Seattle", StringComparison.Ordinal))); + => AssertQuery(ss => ss.Set().Where(b => string.Equals(b.String, "Seattle", StringComparison.Ordinal))); #endregion Equals @@ -61,29 +56,24 @@ public virtual Task Static_Equals_with_Ordinal() [ConditionalFact] public virtual Task Length() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Length == 7)); + => AssertQuery(ss => ss.Set().Where(b => b.String.Length == 7)); [ConditionalFact] public virtual async Task ToUpper() { // Note that if the database is case-insensitive, the Where() assertion checks nothing. - await AssertQuery( - ss => ss.Set().Where(b => b.String.ToUpper() == "SEATTLE")); + await AssertQuery(ss => ss.Set().Where(b => b.String.ToUpper() == "SEATTLE")); - await AssertQuery( - ss => ss.Set().Select(b => b.String.ToUpper())); + await AssertQuery(ss => ss.Set().Select(b => b.String.ToUpper())); } [ConditionalFact] public virtual async Task ToLower() { // Note that if the database is case-insensitive, the Where() assertion checks nothing. - await AssertQuery( - ss => ss.Set().Where(b => b.String.ToLower() == "seattle")); + await AssertQuery(ss => ss.Set().Where(b => b.String.ToLower() == "seattle")); - await AssertQuery( - ss => ss.Set().Select(b => b.String.ToLower())); + await AssertQuery(ss => ss.Set().Select(b => b.String.ToLower())); } #endregion Miscellaneous @@ -93,8 +83,7 @@ await AssertQuery( [ConditionalFact] public virtual Task IndexOf() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.IndexOf("eattl") != -1)) + ? AssertQuery(ss => ss.Set().Where(b => b.String.IndexOf("eattl") != -1)) : AssertQuery( ss => ss.Set().Where(b => b.String.IndexOf("Eattl") != -1), ss => ss.Set().Where(b => b.String.IndexOf("Eattl", StringComparison.OrdinalIgnoreCase) != -1)); @@ -102,10 +91,8 @@ public virtual Task IndexOf() [ConditionalFact] public virtual Task IndexOf_Char() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.IndexOf('e') != -1)) - : AssertQuery( - ss => ss.Set().Where(b => b.String.IndexOf('e') != -1)); + ? AssertQuery(ss => ss.Set().Where(b => b.String.IndexOf('e') != -1)) + : AssertQuery(ss => ss.Set().Where(b => b.String.IndexOf('e') != -1)); [ConditionalFact] public virtual Task IndexOf_with_empty_string() @@ -120,8 +107,7 @@ public virtual Task IndexOf_with_one_parameter_arg() { var pattern = "eattl"; - return AssertQuery( - ss => ss.Set().Where(b => b.String.IndexOf(pattern) == 1)); + return AssertQuery(ss => ss.Set().Where(b => b.String.IndexOf(pattern) == 1)); } else { @@ -140,8 +126,7 @@ public virtual Task IndexOf_with_one_parameter_arg_char() { var pattern = 'e'; - return AssertQuery( - ss => ss.Set().Where(b => b.String.IndexOf(pattern) == 1)); + return AssertQuery(ss => ss.Set().Where(b => b.String.IndexOf(pattern) == 1)); } else { @@ -155,13 +140,11 @@ public virtual Task IndexOf_with_one_parameter_arg_char() [ConditionalFact] public virtual Task IndexOf_with_constant_starting_position() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Length > 2 && b.String.IndexOf("e", 2) == 6)); + => AssertQuery(ss => ss.Set().Where(b => b.String.Length > 2 && b.String.IndexOf("e", 2) == 6)); [ConditionalFact] public virtual Task IndexOf_with_constant_starting_position_char() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Length > 2 && b.String.IndexOf('e', 2) == 6)); + => AssertQuery(ss => ss.Set().Where(b => b.String.Length > 2 && b.String.IndexOf('e', 2) == 6)); #pragma warning disable CA1866 // Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char [ConditionalFact] @@ -170,13 +153,11 @@ public virtual Task IndexOf_with_parameter_starting_position() var start = 2; return IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.Length > 2 && b.String.IndexOf("e", start) == 6)) + ? AssertQuery(ss => ss.Set().Where(b => b.String.Length > 2 && b.String.IndexOf("e", start) == 6)) : AssertQuery( - ss => ss.Set().Where( - b => b.String.Length > 2 && b.String.IndexOf("E", start) == 6), - ss => ss.Set().Where( - b => b.String.Length > 2 && b.String.IndexOf("E", start, StringComparison.OrdinalIgnoreCase) == 6)); + ss => ss.Set().Where(b => b.String.Length > 2 && b.String.IndexOf("E", start) == 6), + ss => ss.Set().Where(b + => b.String.Length > 2 && b.String.IndexOf("E", start, StringComparison.OrdinalIgnoreCase) == 6)); } #pragma warning restore CA1866 @@ -186,22 +167,17 @@ public virtual Task IndexOf_with_parameter_starting_position_char() var start = 2; return IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.Length > 2 && b.String.IndexOf('e', start) == 6)) - : AssertQuery( - ss => ss.Set().Where( - b => b.String.Length > 2 && b.String.IndexOf('e', start) == 6)); + ? AssertQuery(ss => ss.Set().Where(b => b.String.Length > 2 && b.String.IndexOf('e', start) == 6)) + : AssertQuery(ss => ss.Set().Where(b => b.String.Length > 2 && b.String.IndexOf('e', start) == 6)); } [ConditionalFact] public virtual Task IndexOf_after_ToString() - => AssertQuery( - ss => ss.Set().Where(x => x.Int.ToString().IndexOf("55") == 1)); + => AssertQuery(ss => ss.Set().Where(x => x.Int.ToString().IndexOf("55") == 1)); [ConditionalFact] public virtual Task IndexOf_over_ToString() - => AssertQuery( - ss => ss.Set().Where(x => "12559".IndexOf(x.Int.ToString()) == 1)); + => AssertQuery(ss => ss.Set().Where(x => "12559".IndexOf(x.Int.ToString()) == 1)); #endregion IndexOf @@ -210,30 +186,27 @@ public virtual Task IndexOf_over_ToString() [ConditionalFact] public virtual Task Replace() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.Replace("Sea", "Rea") == "Reattle")) - : AssertQuery( - ss => ss.Set().Where(b => b.String.Replace("sea", "rea") == "reattle"), - ss => ss.Set().Where(b => b.String.Replace("sea", "rea", StringComparison.OrdinalIgnoreCase) == "reattle")); + ? AssertQuery(ss => ss.Set().Where(b => b.String.Replace("Sea", "Rea") == "Reattle")) + : AssertQuery( + ss => ss.Set().Where(b => b.String.Replace("sea", "rea") == "reattle"), + ss => ss.Set() + .Where(b => b.String.Replace("sea", "rea", StringComparison.OrdinalIgnoreCase) == "reattle")); [ConditionalFact] public virtual Task Replace_Char() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Replace('S', 'R') == "Reattle")); + => AssertQuery(ss => ss.Set().Where(b => b.String.Replace('S', 'R') == "Reattle")); [ConditionalFact] public virtual Task Replace_with_empty_string() - => AssertQuery( - ss => ss - .Set() - .Where(c => c.String != "" && c.String.Replace(c.String, string.Empty) == "")); + => AssertQuery(ss => ss + .Set() + .Where(c => c.String != "" && c.String.Replace(c.String, string.Empty) == "")); [ConditionalFact] public virtual Task Replace_using_property_arguments() - => AssertQuery( - ss => ss - .Set() - .Where(c => c.String != "" && c.String.Replace(c.String, c.Int.ToString()) == c.Int.ToString())); + => AssertQuery(ss => ss + .Set() + .Where(c => c.String != "" && c.String.Replace(c.String, c.Int.ToString()) == c.Int.ToString())); #endregion Replace @@ -241,52 +214,44 @@ public virtual Task Replace_using_property_arguments() [ConditionalFact] public virtual Task Substring() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Length >= 3 && b.String.Substring(1, 2) == "ea")); + => AssertQuery(ss => ss.Set().Where(b => b.String.Length >= 3 && b.String.Substring(1, 2) == "ea")); [ConditionalFact] public virtual Task Substring_with_one_arg_with_zero_startIndex() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Substring(0) == "Seattle")); + => AssertQuery(ss => ss.Set().Where(b => b.String.Substring(0) == "Seattle")); [ConditionalFact] public virtual Task Substring_with_one_arg_with_constant() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Length >= 1 && b.String.Substring(1) == "eattle")); + => AssertQuery(ss => ss.Set().Where(b => b.String.Length >= 1 && b.String.Substring(1) == "eattle")); [ConditionalFact] public virtual Task Substring_with_one_arg_with_parameter() { var start = 2; - return AssertQuery( - ss => ss.Set().Where(b => b.String.Length >= 2 && b.String.Substring(start) == "attle")); + return AssertQuery(ss => ss.Set().Where(b => b.String.Length >= 2 && b.String.Substring(start) == "attle")); } [ConditionalFact] public virtual Task Substring_with_two_args_with_zero_startIndex() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Length >= 3 && b.String.Substring(0, 3) == "Sea")); + => AssertQuery(ss => ss.Set().Where(b => b.String.Length >= 3 && b.String.Substring(0, 3) == "Sea")); [ConditionalFact] public virtual Task Substring_with_two_args_with_zero_length() - => AssertQuery( - ss => ss.Set().Where(b => b.String.Length >= 2 && b.String.Substring(2, 0) == "")); + => AssertQuery(ss => ss.Set().Where(b => b.String.Length >= 2 && b.String.Substring(2, 0) == "")); [ConditionalFact] public virtual Task Substring_with_two_args_with_parameter() { var start = 2; - return AssertQuery( - ss => ss.Set().Where(b => b.String.Length >= 5 && b.String.Substring(start, 3) == "att")); + return AssertQuery(ss => ss.Set().Where(b => b.String.Length >= 5 && b.String.Substring(start, 3) == "att")); } [ConditionalFact] public virtual Task Substring_with_two_args_with_IndexOf() - => AssertQuery( - ss => ss.Set().Where(c => - c.String.Contains("a") && c.String.Substring(c.String.IndexOf("a"), 3) == "att")); + => AssertQuery(ss => ss.Set().Where(c => + c.String.Contains("a") && c.String.Substring(c.String.IndexOf("a"), 3) == "att")); #endregion Substring @@ -295,27 +260,22 @@ public virtual Task Substring_with_two_args_with_IndexOf() [ConditionalFact] public virtual async Task IsNullOrEmpty() { - await AssertQuery( - ss => ss.Set().Where(n => string.IsNullOrEmpty(n.String))); + await AssertQuery(ss => ss.Set().Where(n => string.IsNullOrEmpty(n.String))); - await AssertQueryScalar( - ss => ss.Set().Select(n => string.IsNullOrEmpty(n.String))); + await AssertQueryScalar(ss => ss.Set().Select(n => string.IsNullOrEmpty(n.String))); } [ConditionalFact] public virtual async Task IsNullOrEmpty_negated() { - await AssertQuery( - ss => ss.Set().Where(n => !string.IsNullOrEmpty(n.String))); + await AssertQuery(ss => ss.Set().Where(n => !string.IsNullOrEmpty(n.String))); - await AssertQuery( - ss => ss.Set().Select(n => !string.IsNullOrEmpty(n.String))); + await AssertQuery(ss => ss.Set().Select(n => !string.IsNullOrEmpty(n.String))); } [ConditionalFact] public virtual Task IsNullOrWhiteSpace() - => AssertQuery( - ss => ss.Set().Where(c => string.IsNullOrWhiteSpace(c.String))); + => AssertQuery(ss => ss.Set().Where(c => string.IsNullOrWhiteSpace(c.String))); #endregion IsNullOrEmpty/Whitespace @@ -324,8 +284,7 @@ public virtual Task IsNullOrWhiteSpace() [ConditionalFact] public virtual Task StartsWith_Literal() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith("Se"))) + ? AssertQuery(ss => ss.Set().Where(b => b.String.StartsWith("Se"))) : AssertQuery( ss => ss.Set().Where(b => b.String.StartsWith("se")), ss => ss.Set().Where(b => b.String.StartsWith("se", StringComparison.OrdinalIgnoreCase))); @@ -333,8 +292,7 @@ public virtual Task StartsWith_Literal() [ConditionalFact] public virtual Task StartsWith_Literal_Char() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith('S'))) + ? AssertQuery(ss => ss.Set().Where(b => b.String.StartsWith('S'))) : AssertQuery( ss => ss.Set().Where(b => b.String.StartsWith('S')), ss => ss.Set().Where(b => b.String.StartsWith('S'))); @@ -346,8 +304,7 @@ public virtual Task StartsWith_Parameter() { var pattern = "Se"; - return AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith(pattern))); + return AssertQuery(ss => ss.Set().Where(b => b.String.StartsWith(pattern))); } else { @@ -366,8 +323,7 @@ public virtual Task StartsWith_Parameter_Char() { var pattern = 'S'; - return AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith(pattern))); + return AssertQuery(ss => ss.Set().Where(b => b.String.StartsWith(pattern))); } else { @@ -381,41 +337,31 @@ public virtual Task StartsWith_Parameter_Char() [ConditionalFact] public virtual Task StartsWith_Column() - => AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith(b.String))); + => AssertQuery(ss => ss.Set().Where(b => b.String.StartsWith(b.String))); [ConditionalFact] public virtual Task StartsWith_with_StringComparison_Ordinal() - => AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.Ordinal))); + => AssertQuery(ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.Ordinal))); [ConditionalFact] public virtual Task StartsWith_with_StringComparison_OrdinalIgnoreCase() - => AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.OrdinalIgnoreCase))); + => AssertQuery(ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.OrdinalIgnoreCase))); [ConditionalFact] public virtual async Task StartsWith_with_StringComparison_unsupported() { - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.CurrentCulture)))); - - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.CurrentCultureIgnoreCase)))); - - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.InvariantCulture)))); - - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.InvariantCultureIgnoreCase)))); + await AssertTranslationFailed(() => + AssertQuery(ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.CurrentCulture)))); + + await AssertTranslationFailed(() => + AssertQuery(ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.CurrentCultureIgnoreCase)))); + + await AssertTranslationFailed(() => + AssertQuery(ss => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.InvariantCulture)))); + + await AssertTranslationFailed(() => + AssertQuery(ss + => ss.Set().Where(b => b.String.StartsWith("Se", StringComparison.InvariantCultureIgnoreCase)))); } #endregion StartsWith @@ -425,8 +371,7 @@ await AssertTranslationFailed( [ConditionalFact] public virtual Task EndsWith_Literal() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith("le"))) + ? AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith("le"))) : AssertQuery( ss => ss.Set().Where(b => b.String.EndsWith("Le")), ss => ss.Set().Where(b => b.String.EndsWith("Le", StringComparison.OrdinalIgnoreCase))); @@ -434,10 +379,8 @@ public virtual Task EndsWith_Literal() [ConditionalFact] public virtual Task EndsWith_Literal_Char() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith('e'))) - : AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith('e'))); + ? AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith('e'))) + : AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith('e'))); [ConditionalFact] public virtual Task EndsWith_Parameter() @@ -446,8 +389,7 @@ public virtual Task EndsWith_Parameter() { var pattern = "le"; - return AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith(pattern))); + return AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith(pattern))); } else { @@ -466,8 +408,7 @@ public virtual Task EndsWith_Parameter_Char() { var pattern = 'e'; - return AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith(pattern))); + return AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith(pattern))); } else { @@ -481,41 +422,30 @@ public virtual Task EndsWith_Parameter_Char() [ConditionalFact] public virtual Task EndsWith_Column() - => AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith(b.String))); + => AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith(b.String))); [ConditionalFact] public virtual Task EndsWith_with_StringComparison_Ordinal() - => AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith("le", StringComparison.Ordinal))); + => AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith("le", StringComparison.Ordinal))); [ConditionalFact] public virtual Task EndsWith_with_StringComparison_OrdinalIgnoreCase() - => AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith("LE", StringComparison.OrdinalIgnoreCase))); + => AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith("LE", StringComparison.OrdinalIgnoreCase))); [ConditionalFact] public virtual async Task EndsWith_with_StringComparison_unsupported() { - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith("le", StringComparison.CurrentCulture)))); - - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith("le", StringComparison.CurrentCultureIgnoreCase)))); - - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith("le", StringComparison.InvariantCulture)))); - - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(b => b.String.EndsWith("le", StringComparison.InvariantCultureIgnoreCase)))); + await AssertTranslationFailed(() => + AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith("le", StringComparison.CurrentCulture)))); + + await AssertTranslationFailed(() => + AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith("le", StringComparison.CurrentCultureIgnoreCase)))); + + await AssertTranslationFailed(() => + AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith("le", StringComparison.InvariantCulture)))); + + await AssertTranslationFailed(() => + AssertQuery(ss => ss.Set().Where(b => b.String.EndsWith("le", StringComparison.InvariantCultureIgnoreCase)))); } #endregion EndsWith @@ -525,8 +455,7 @@ await AssertTranslationFailed( [ConditionalFact] public virtual Task Contains_Literal() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.Contains("eattl"))) + ? AssertQuery(ss => ss.Set().Where(b => b.String.Contains("eattl"))) : AssertQuery( ss => ss.Set().Where(b => b.String.Contains("Eattl")), ss => ss.Set().Where(b => b.String.Contains("Eattl", StringComparison.OrdinalIgnoreCase))); @@ -534,8 +463,7 @@ public virtual Task Contains_Literal() [ConditionalFact] public virtual Task Contains_Literal_Char() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(b => b.String.Contains('e'))) + ? AssertQuery(ss => ss.Set().Where(b => b.String.Contains('e'))) : AssertQuery( ss => ss.Set().Where(b => b.String.Contains('e')), ss => ss.Set().Where(b => b.String.Contains('e'))); @@ -543,11 +471,9 @@ public virtual Task Contains_Literal_Char() [ConditionalFact] public virtual async Task Contains_Column() { - await AssertQuery( - ss => ss.Set().Where(b => b.String.Contains(b.String))); + await AssertQuery(ss => ss.Set().Where(b => b.String.Contains(b.String))); - await AssertQueryScalar( - ss => ss.Set().Select(b => b.String.Contains(b.String))); + await AssertQueryScalar(ss => ss.Set().Select(b => b.String.Contains(b.String))); } [ConditionalFact] @@ -555,11 +481,9 @@ public virtual async Task Contains_negated() { if (IsCaseSensitive) { - await AssertQuery( - ss => ss.Set().Where(c => !c.String.Contains("eattle"))); + await AssertQuery(ss => ss.Set().Where(c => !c.String.Contains("eattle"))); - await AssertQueryScalar( - ss => ss.Set().Select(c => !c.String.Contains("eattle"))); + await AssertQueryScalar(ss => ss.Set().Select(c => !c.String.Contains("eattle"))); } else { @@ -575,36 +499,28 @@ await AssertQueryScalar( [ConditionalFact] public virtual Task Contains_with_StringComparison_Ordinal() - => AssertQuery( - ss => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.Ordinal))); + => AssertQuery(ss => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.Ordinal))); [ConditionalFact] public virtual Task Contains_with_StringComparison_OrdinalIgnoreCase() - => AssertQuery( - ss => ss.Set().Where(c => c.String.Contains("EATTL", StringComparison.OrdinalIgnoreCase))); + => AssertQuery(ss => ss.Set().Where(c => c.String.Contains("EATTL", StringComparison.OrdinalIgnoreCase))); [ConditionalFact] public virtual async Task Contains_with_StringComparison_unsupported() { - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.CurrentCulture)))); - - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.CurrentCultureIgnoreCase)))); - - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.InvariantCulture)))); - - await AssertTranslationFailed( - () => - AssertQuery( - ss => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.InvariantCultureIgnoreCase)))); + await AssertTranslationFailed(() => + AssertQuery(ss => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.CurrentCulture)))); + + await AssertTranslationFailed(() => + AssertQuery(ss + => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.CurrentCultureIgnoreCase)))); + + await AssertTranslationFailed(() => + AssertQuery(ss => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.InvariantCulture)))); + + await AssertTranslationFailed(() => + AssertQuery(ss + => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.InvariantCultureIgnoreCase)))); } [ConditionalFact] // Probably belongs in FunkyDataQueryTestBase @@ -628,18 +544,15 @@ public virtual Task Contains_parameter_with_whitespace() [ConditionalFact] public virtual Task TrimStart_without_arguments() - => AssertQuery( - ss => ss.Set().Where(c => c.String.TrimStart() == "Boston ")); + => AssertQuery(ss => ss.Set().Where(c => c.String.TrimStart() == "Boston ")); [ConditionalFact] public virtual Task TrimStart_with_char_argument() - => AssertQuery( - ss => ss.Set().Where(c => c.String.TrimStart('S') == "eattle")); + => AssertQuery(ss => ss.Set().Where(c => c.String.TrimStart('S') == "eattle")); [ConditionalFact] public virtual Task TrimStart_with_char_array_argument() - => AssertQuery( - ss => ss.Set().Where(c => c.String.TrimStart(new [] { 'S', 'e' }) == "attle")); + => AssertQuery(ss => ss.Set().Where(c => c.String.TrimStart(new[] { 'S', 'e' }) == "attle")); #endregion TrimStart @@ -647,18 +560,15 @@ public virtual Task TrimStart_with_char_array_argument() [ConditionalFact] public virtual Task TrimEnd_without_arguments() - => AssertQuery( - ss => ss.Set().Where(c => c.String.TrimEnd() == " Boston")); + => AssertQuery(ss => ss.Set().Where(c => c.String.TrimEnd() == " Boston")); [ConditionalFact] public virtual Task TrimEnd_with_char_argument() - => AssertQuery( - ss => ss.Set().Where(c => c.String.TrimEnd('e') == "Seattl")); + => AssertQuery(ss => ss.Set().Where(c => c.String.TrimEnd('e') == "Seattl")); [ConditionalFact] public virtual Task TrimEnd_with_char_array_argument() - => AssertQuery( - ss => ss.Set().Where(c => c.String.TrimEnd(new [] { 'l', 'e' }) == "Seatt")); + => AssertQuery(ss => ss.Set().Where(c => c.String.TrimEnd(new[] { 'l', 'e' }) == "Seatt")); #endregion TrimEnd @@ -666,18 +576,15 @@ public virtual Task TrimEnd_with_char_array_argument() [ConditionalFact] public virtual Task Trim_without_argument_in_predicate() - => AssertQuery( - ss => ss.Set().Where(c => c.String.Trim() == "Boston")); + => AssertQuery(ss => ss.Set().Where(c => c.String.Trim() == "Boston")); [ConditionalFact] public virtual Task Trim_with_char_argument_in_predicate() - => AssertQuery( - ss => ss.Set().Where(c => c.String.Trim('S') == "eattle")); + => AssertQuery(ss => ss.Set().Where(c => c.String.Trim('S') == "eattle")); [ConditionalFact] public virtual Task Trim_with_char_array_argument_in_predicate() - => AssertQuery( - ss => ss.Set().Where(c => c.String.Trim(new [] { 'S', 'e' }) == "attl")); + => AssertQuery(ss => ss.Set().Where(c => c.String.Trim(new[] { 'S', 'e' }) == "attl")); #endregion Trim @@ -688,23 +595,17 @@ public virtual async Task Compare_simple_zero() { if (IsCaseSensitive) { - await AssertQuery( - ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") == 0)); + await AssertQuery(ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") == 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 != string.Compare(c.String, "Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => 0 != string.Compare(c.String, "Seattle"))); - await AssertQuery( - ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") > 0)); + await AssertQuery(ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") > 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 >= string.Compare(c.String, "Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => 0 >= string.Compare(c.String, "Seattle"))); - await AssertQuery( - ss => ss.Set().Where(c => 0 < string.Compare(c.String, "Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => 0 < string.Compare(c.String, "Seattle"))); - await AssertQuery( - ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") <= 0)); + await AssertQuery(ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") <= 0)); } else { @@ -737,23 +638,17 @@ await AssertQuery( [ConditionalFact] public virtual async Task Compare_simple_one() { - await AssertQuery( - ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") == 1)); + await AssertQuery(ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") == 1)); - await AssertQuery( - ss => ss.Set().Where(c => -1 == string.Compare(c.String, "Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => -1 == string.Compare(c.String, "Seattle"))); - await AssertQuery( - ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") < 1)); + await AssertQuery(ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") < 1)); - await AssertQuery( - ss => ss.Set().Where(c => 1 > string.Compare(c.String, "Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => 1 > string.Compare(c.String, "Seattle"))); - await AssertQuery( - ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") > -1)); + await AssertQuery(ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") > -1)); - await AssertQuery( - ss => ss.Set().Where(c => -1 < string.Compare(c.String, "Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => -1 < string.Compare(c.String, "Seattle"))); } [ConditionalFact] @@ -767,23 +662,17 @@ public virtual async Task Compare_with_parameter() ClearLog(); - await AssertQuery( - ss => ss.Set().Where(c => string.Compare(c.String, basicTypeEntity.String) == 1)); + await AssertQuery(ss => ss.Set().Where(c => string.Compare(c.String, basicTypeEntity.String) == 1)); - await AssertQuery( - ss => ss.Set().Where(c => -1 == string.Compare(c.String, basicTypeEntity.String))); + await AssertQuery(ss => ss.Set().Where(c => -1 == string.Compare(c.String, basicTypeEntity.String))); - await AssertQuery( - ss => ss.Set().Where(c => string.Compare(c.String, basicTypeEntity.String) < 1)); + await AssertQuery(ss => ss.Set().Where(c => string.Compare(c.String, basicTypeEntity.String) < 1)); - await AssertQuery( - ss => ss.Set().Where(c => 1 > string.Compare(c.String, basicTypeEntity.String))); + await AssertQuery(ss => ss.Set().Where(c => 1 > string.Compare(c.String, basicTypeEntity.String))); - await AssertQuery( - ss => ss.Set().Where(c => string.Compare(c.String, basicTypeEntity.String) > -1)); + await AssertQuery(ss => ss.Set().Where(c => string.Compare(c.String, basicTypeEntity.String) > -1)); - await AssertQuery( - ss => ss.Set().Where(c => -1 < string.Compare(c.String, basicTypeEntity.String))); + await AssertQuery(ss => ss.Set().Where(c => -1 < string.Compare(c.String, basicTypeEntity.String))); } [ConditionalFact] @@ -797,8 +686,7 @@ await AssertQuery( ss => ss.Set().Where(c => string.Compare(c.String, "Seattle") > 42), assertEmpty: true); - await AssertQuery( - ss => ss.Set().Where(c => 42 > string.Compare(c.String, "Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => 42 > string.Compare(c.String, "Seattle"))); } [ConditionalFact] @@ -808,72 +696,55 @@ await AssertQuery( ss => ss.Set().Where(c => string.Compare(c.String, "M" + c.String) == 0), assertEmpty: true); - await AssertQuery( - ss => ss.Set().Where(c => 0 != string.Compare(c.String, c.String.Substring(0, 0)))); + await AssertQuery(ss => ss.Set().Where(c => 0 != string.Compare(c.String, c.String.Substring(0, 0)))); await AssertQuery( ss => ss.Set().Where(c => string.Compare(c.String, "Seattle".Replace("Sea", c.String)) > 0), assertEmpty: true); - await AssertQuery( - ss => ss.Set().Where(c => 0 >= string.Compare(c.String, "M" + c.String))); + await AssertQuery(ss => ss.Set().Where(c => 0 >= string.Compare(c.String, "M" + c.String))); - await AssertQuery( - ss => ss.Set().Where(c => 1 == string.Compare(c.String, c.String.Substring(0, 0)))); + await AssertQuery(ss => ss.Set().Where(c => 1 == string.Compare(c.String, c.String.Substring(0, 0)))); - await AssertQuery( - ss => ss.Set().Where(c => string.Compare(c.String, "Seattle".Replace("Sea", c.String)) == -1)); + await AssertQuery(ss => ss.Set().Where(c => string.Compare(c.String, "Seattle".Replace("Sea", c.String)) == -1)); } [ConditionalFact] public virtual async Task Compare_multi_predicate() - => await AssertQuery( - ss => ss.Set() - .Where(c => string.Compare(c.String, "Seattle") > -1) - .Where(c => string.Compare(c.String, "Toronto") == -1)); + => await AssertQuery(ss => ss.Set() + .Where(c => string.Compare(c.String, "Seattle") > -1) + .Where(c => string.Compare(c.String, "Toronto") == -1)); [ConditionalFact] public virtual async Task CompareTo_simple_zero() { - await AssertQuery( - ss => ss.Set().Where(c => c.String.CompareTo("Seattle") == 0)); + await AssertQuery(ss => ss.Set().Where(c => c.String.CompareTo("Seattle") == 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 != c.String.CompareTo("Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => 0 != c.String.CompareTo("Seattle"))); - await AssertQuery( - ss => ss.Set().Where(c => c.String.CompareTo("Seattle") > 0)); + await AssertQuery(ss => ss.Set().Where(c => c.String.CompareTo("Seattle") > 0)); - await AssertQuery( - ss => ss.Set().Where(c => 0 >= c.String.CompareTo("Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => 0 >= c.String.CompareTo("Seattle"))); - await AssertQuery( - ss => ss.Set().Where(c => 0 < c.String.CompareTo("Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => 0 < c.String.CompareTo("Seattle"))); - await AssertQuery( - ss => ss.Set().Where(c => c.String.CompareTo("Seattle") <= 0)); + await AssertQuery(ss => ss.Set().Where(c => c.String.CompareTo("Seattle") <= 0)); } [ConditionalFact] public virtual async Task CompareTo_simple_one() { - await AssertQuery( - ss => ss.Set().Where(c => c.String.CompareTo("Seattle") == 1)); + await AssertQuery(ss => ss.Set().Where(c => c.String.CompareTo("Seattle") == 1)); - await AssertQuery( - ss => ss.Set().Where(c => -1 == c.String.CompareTo("Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => -1 == c.String.CompareTo("Seattle"))); - await AssertQuery( - ss => ss.Set().Where(c => c.String.CompareTo("Seattle") < 1)); + await AssertQuery(ss => ss.Set().Where(c => c.String.CompareTo("Seattle") < 1)); - await AssertQuery( - ss => ss.Set().Where(c => 1 > c.String.CompareTo("Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => 1 > c.String.CompareTo("Seattle"))); - await AssertQuery( - ss => ss.Set().Where(c => c.String.CompareTo("Seattle") > -1)); + await AssertQuery(ss => ss.Set().Where(c => c.String.CompareTo("Seattle") > -1)); - await AssertQuery( - ss => ss.Set().Where(c => -1 < c.String.CompareTo("Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => -1 < c.String.CompareTo("Seattle"))); } [ConditionalFact] @@ -887,23 +758,17 @@ public virtual async Task CompareTo_with_parameter() ClearLog(); - await AssertQuery( - ss => ss.Set().Where(c => c.String.CompareTo(basicTypesEntity.String) == 1)); + await AssertQuery(ss => ss.Set().Where(c => c.String.CompareTo(basicTypesEntity.String) == 1)); - await AssertQuery( - ss => ss.Set().Where(c => -1 == c.String.CompareTo(basicTypesEntity.String))); + await AssertQuery(ss => ss.Set().Where(c => -1 == c.String.CompareTo(basicTypesEntity.String))); - await AssertQuery( - ss => ss.Set().Where(c => c.String.CompareTo(basicTypesEntity.String) < 1)); + await AssertQuery(ss => ss.Set().Where(c => c.String.CompareTo(basicTypesEntity.String) < 1)); - await AssertQuery( - ss => ss.Set().Where(c => 1 > c.String.CompareTo(basicTypesEntity.String))); + await AssertQuery(ss => ss.Set().Where(c => 1 > c.String.CompareTo(basicTypesEntity.String))); - await AssertQuery( - ss => ss.Set().Where(c => c.String.CompareTo(basicTypesEntity.String) > -1)); + await AssertQuery(ss => ss.Set().Where(c => c.String.CompareTo(basicTypesEntity.String) > -1)); - await AssertQuery( - ss => ss.Set().Where(c => -1 < c.String.CompareTo(basicTypesEntity.String))); + await AssertQuery(ss => ss.Set().Where(c => -1 < c.String.CompareTo(basicTypesEntity.String))); } [ConditionalFact] @@ -917,8 +782,7 @@ await AssertQuery( ss => ss.Set().Where(c => c.String.CompareTo("Seattle") > 42), assertEmpty: true); - await AssertQuery( - ss => ss.Set().Where(c => 42 > c.String.CompareTo("Seattle"))); + await AssertQuery(ss => ss.Set().Where(c => 42 > c.String.CompareTo("Seattle"))); } [ConditionalFact] @@ -928,29 +792,24 @@ await AssertQuery( ss => ss.Set().Where(c => c.String.CompareTo("M" + c.String) == 0), assertEmpty: true); - await AssertQuery( - ss => ss.Set().Where(c => 0 != c.String.CompareTo(c.String.Substring(0, 0)))); + await AssertQuery(ss => ss.Set().Where(c => 0 != c.String.CompareTo(c.String.Substring(0, 0)))); await AssertQuery( ss => ss.Set().Where(c => c.String.CompareTo("Seattle".Replace("Sea", c.String)) > 0), assertEmpty: true); - await AssertQuery( - ss => ss.Set().Where(c => 0 >= c.String.CompareTo("M" + c.String))); + await AssertQuery(ss => ss.Set().Where(c => 0 >= c.String.CompareTo("M" + c.String))); - await AssertQuery( - ss => ss.Set().Where(c => 1 == c.String.CompareTo(c.String.Substring(0, 0)))); + await AssertQuery(ss => ss.Set().Where(c => 1 == c.String.CompareTo(c.String.Substring(0, 0)))); - await AssertQuery( - ss => ss.Set().Where(c => c.String.CompareTo("Seattle".Replace("Sea", c.String)) == -1)); + await AssertQuery(ss => ss.Set().Where(c => c.String.CompareTo("Seattle".Replace("Sea", c.String)) == -1)); } [ConditionalFact] public virtual async Task Compare_to_multi_predicate() - => await AssertQuery( - ss => ss.Set() - .Where(c => c.String.CompareTo("Seattle") > -1) - .Where(c => c.String.CompareTo("Toronto") == -1)); + => await AssertQuery(ss => ss.Set() + .Where(c => c.String.CompareTo("Seattle") > -1) + .Where(c => c.String.CompareTo("Toronto") == -1)); #endregion Compare @@ -995,12 +854,7 @@ public virtual Task Join_with_predicate() => AssertQuery( ss => ss.Set() .GroupBy(c => c.Int) - .Select( - g => new - { - g.Key, - Strings = string.Join("|", g.Where(e => e.String.Length > 6).Select(e => e.String)) - }), + .Select(g => new { g.Key, Strings = string.Join("|", g.Where(e => e.String.Length > 6).Select(e => e.String)) }), elementSorter: x => x.Key, elementAsserter: (e, a) => { @@ -1017,11 +871,7 @@ public virtual Task Join_with_ordering() => AssertQuery( ss => ss.Set() .GroupBy(c => c.Int) - .Select( - g => new - { - g.Key, Strings = string.Join("|", g.OrderByDescending(e => e.Id).Select(e => e.String)) - }), + .Select(g => new { g.Key, Strings = string.Join("|", g.OrderByDescending(e => e.Id).Select(e => e.String)) }), elementSorter: x => x.Key); [ConditionalFact] @@ -1029,8 +879,8 @@ public virtual Task Join_non_aggregate() { var foo = "foo"; - return AssertQuery( - ss => ss.Set().Where(c => string.Join("|", new[] { c.String, foo, null, "bar" }) == "Seattle|foo||bar")); + return AssertQuery(ss + => ss.Set().Where(c => string.Join("|", new[] { c.String, foo, null, "bar" }) == "Seattle|foo||bar")); } #endregion Join @@ -1039,8 +889,7 @@ public virtual Task Join_non_aggregate() [ConditionalFact] public virtual Task Concat_operator() - => AssertQuery( - ss => ss.Set().Where(b => b.String + "Boston" == "SeattleBoston")); + => AssertQuery(ss => ss.Set().Where(b => b.String + "Boston" == "SeattleBoston")); // TODO: Possibly move to aggregate-specific test suite, not sure. Also Join above. @@ -1065,8 +914,7 @@ public virtual Task Concat_string_int_comparison1() { var i = 10; - return AssertQuery( - ss => ss.Set().Where(c => c.String + i == "Seattle10")); + return AssertQuery(ss => ss.Set().Where(c => c.String + i == "Seattle10")); } [ConditionalFact] // #31917 @@ -1074,8 +922,7 @@ public virtual Task Concat_string_int_comparison2() { var i = 10; - return AssertQuery( - ss => ss.Set().Where(c => i + c.String == "10Seattle")); + return AssertQuery(ss => ss.Set().Where(c => i + c.String == "10Seattle")); } [ConditionalFact] // #31917 @@ -1084,22 +931,19 @@ public virtual Task Concat_string_int_comparison3() var i = 10; var j = 21; - return AssertQuery( - ss => ss.Set().Where(c => i + 20 + c.String + j + 42 == "30Seattle2142")); + return AssertQuery(ss => ss.Set().Where(c => i + 20 + c.String + j + 42 == "30Seattle2142")); } [ConditionalFact] // #31917 public virtual Task Concat_string_int_comparison4() - => AssertQuery( - ss => ss.Set().Where(o => o.Int + o.String == "8Seattle")); + => AssertQuery(ss => ss.Set().Where(o => o.Int + o.String == "8Seattle")); [ConditionalFact] public virtual Task Concat_string_string_comparison() { var i = "A"; - return AssertQuery( - ss => ss.Set().Where(c => i + c.String == "ASeattle")); + return AssertQuery(ss => ss.Set().Where(c => i + c.String == "ASeattle")); } [ConditionalFact] @@ -1107,8 +951,7 @@ public virtual Task Concat_method_comparison() { var i = "A"; - return AssertQuery( - ss => ss.Set().Where(c => string.Concat(i, c.String) == "ASeattle")); + return AssertQuery(ss => ss.Set().Where(c => string.Concat(i, c.String) == "ASeattle")); } [ConditionalFact] @@ -1117,8 +960,7 @@ public virtual Task Concat_method_comparison_2() var i = "A"; var j = "B"; - return AssertQuery( - ss => ss.Set().Where(c => string.Concat(i, j, c.String) == "ABSeattle")); + return AssertQuery(ss => ss.Set().Where(c => string.Concat(i, j, c.String) == "ABSeattle")); } [ConditionalFact] @@ -1128,8 +970,7 @@ public virtual Task Concat_method_comparison_3() var j = "B"; var k = "C"; - return AssertQuery( - ss => ss.Set().Where(c => string.Concat(i, j, k, c.String) == "ABCSeattle")); + return AssertQuery(ss => ss.Set().Where(c => string.Concat(i, j, k, c.String) == "ABCSeattle")); } #endregion Concatenation @@ -1138,13 +979,11 @@ public virtual Task Concat_method_comparison_3() [ConditionalFact] public virtual Task FirstOrDefault() - => AssertQuery( - ss => ss.Set().Where(c => c.String.FirstOrDefault() == 'S')); + => AssertQuery(ss => ss.Set().Where(c => c.String.FirstOrDefault() == 'S')); [ConditionalFact] public virtual Task LastOrDefault() - => AssertQuery( - ss => ss.Set().Where(c => c.String.LastOrDefault() == 'e')); + => AssertQuery(ss => ss.Set().Where(c => c.String.LastOrDefault() == 'e')); #endregion LINQ Operators @@ -1153,8 +992,7 @@ public virtual Task LastOrDefault() [ConditionalFact] public virtual Task Regex_IsMatch() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(o => Regex.IsMatch(o.String, "^S"))) + ? AssertQuery(ss => ss.Set().Where(o => Regex.IsMatch(o.String, "^S"))) : AssertQuery( ss => ss.Set().Where(o => Regex.IsMatch(o.String, "^s")), ss => ss.Set().Where(o => Regex.IsMatch(o.String, "^s", RegexOptions.IgnoreCase))); @@ -1162,8 +1000,7 @@ public virtual Task Regex_IsMatch() [ConditionalFact] public virtual Task Regex_IsMatch_constant_input() => IsCaseSensitive - ? AssertQuery( - ss => ss.Set().Where(o => Regex.IsMatch("Seattle", o.String))) + ? AssertQuery(ss => ss.Set().Where(o => Regex.IsMatch("Seattle", o.String))) : AssertQuery( ss => ss.Set().Where(o => Regex.IsMatch("seattle", o.String)), ss => ss.Set().Where(o => Regex.IsMatch("seattle", o.String, RegexOptions.IgnoreCase))); diff --git a/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateOnlyTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateOnlyTranslationsTestBase.cs index c0a91ea538d..5c21d1d4c10 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateOnlyTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateOnlyTranslationsTestBase.cs @@ -10,102 +10,84 @@ public abstract class DateOnlyTranslationsTestBase(TFixture fixture) : { [ConditionalFact] public virtual Task Year() - => AssertQuery( - ss => ss.Set().Where(b => b.DateOnly.Year == 1990)); + => AssertQuery(ss => ss.Set().Where(b => b.DateOnly.Year == 1990)); [ConditionalFact] public virtual Task Month() - => AssertQuery( - ss => ss.Set().Where(b => b.DateOnly.Month == 11)); + => AssertQuery(ss => ss.Set().Where(b => b.DateOnly.Month == 11)); [ConditionalFact] public virtual Task Day() - => AssertQuery( - ss => ss.Set().Where(b => b.DateOnly.Day == 10)); + => AssertQuery(ss => ss.Set().Where(b => b.DateOnly.Day == 10)); [ConditionalFact] public virtual Task DayOfYear() - => AssertQuery( - ss => ss.Set().Where(b => b.DateOnly.DayOfYear == 314)); + => AssertQuery(ss => ss.Set().Where(b => b.DateOnly.DayOfYear == 314)); [ConditionalFact] public virtual Task DayOfWeek() - => AssertQuery( - ss => ss.Set().Where(b => b.DateOnly.DayOfWeek == System.DayOfWeek.Saturday)); + => AssertQuery(ss => ss.Set().Where(b => b.DateOnly.DayOfWeek == System.DayOfWeek.Saturday)); [ConditionalFact] public virtual Task DayNumber() - => AssertQuery( - ss => ss.Set().Where(b => b.DateOnly.DayNumber == 726780)); + => AssertQuery(ss => ss.Set().Where(b => b.DateOnly.DayNumber == 726780)); [ConditionalFact] public virtual Task AddYears() - => AssertQuery( - ss => ss.Set().Where(b => b.DateOnly.AddYears(3) == new DateOnly(1993, 11, 10))); + => AssertQuery(ss => ss.Set().Where(b => b.DateOnly.AddYears(3) == new DateOnly(1993, 11, 10))); [ConditionalFact] public virtual Task AddMonths() - => AssertQuery( - ss => ss.Set().Where(b => b.DateOnly.AddMonths(3) == new DateOnly(1991, 2, 10))); + => AssertQuery(ss => ss.Set().Where(b => b.DateOnly.AddMonths(3) == new DateOnly(1991, 2, 10))); [ConditionalFact] public virtual Task AddDays() - => AssertQuery( - ss => ss.Set().Where(b => b.DateOnly.AddDays(3) == new DateOnly(1990, 11, 13))); + => AssertQuery(ss => ss.Set().Where(b => b.DateOnly.AddDays(3) == new DateOnly(1990, 11, 13))); [ConditionalFact] public virtual Task DayNumber_subtraction() - => AssertQuery( - ss => ss.Set().Where(b => b.DateOnly.DayNumber - new DateOnly(1990, 11, 5).DayNumber == 5)); + => AssertQuery(ss => ss.Set().Where(b => b.DateOnly.DayNumber - new DateOnly(1990, 11, 5).DayNumber == 5)); [ConditionalFact] public virtual Task FromDateTime() - => AssertQuery( - ss => ss.Set().Where(o => DateOnly.FromDateTime(o.DateTime) == new DateOnly(1998, 5, 4))); + => AssertQuery(ss => ss.Set().Where(o => DateOnly.FromDateTime(o.DateTime) == new DateOnly(1998, 5, 4))); [ConditionalFact] public virtual Task FromDateTime_compared_to_property() - => AssertQuery( - ss => ss.Set().Where(o => DateOnly.FromDateTime(o.DateTime) == o.DateOnly)); + => AssertQuery(ss => ss.Set().Where(o => DateOnly.FromDateTime(o.DateTime) == o.DateOnly)); [ConditionalFact] public virtual Task FromDateTime_compared_to_constant_and_parameter() { var dateOnly = new DateOnly(2, 10, 11); - return AssertQuery( - ss => ss.Set() - .Where(x => new[] { dateOnly, new DateOnly(1998, 5, 4) }.Contains(DateOnly.FromDateTime(x.DateTime)))); + return AssertQuery(ss => ss.Set() + .Where(x => new[] { dateOnly, new DateOnly(1998, 5, 4) }.Contains(DateOnly.FromDateTime(x.DateTime)))); } [ConditionalFact] public virtual Task ToDateTime_property_with_constant_TimeOnly() - => AssertQuery( - ss => ss.Set() - .Where(o => o.DateOnly.ToDateTime(new TimeOnly(21, 5, 19, 940, 500)) == new DateTime(2020, 1, 1, 21, 5, 19, 940, 500))); + => AssertQuery(ss => ss.Set() + .Where(o => o.DateOnly.ToDateTime(new TimeOnly(21, 5, 19, 940, 500)) == new DateTime(2020, 1, 1, 21, 5, 19, 940, 500))); [ConditionalFact] public virtual Task ToDateTime_property_with_property_TimeOnly() - => AssertQuery( - ss => ss.Set() - .Where(o => o.DateOnly.ToDateTime(o.TimeOnly) == new DateTime(2020, 1, 1, 15, 30, 10))); + => AssertQuery(ss => ss.Set() + .Where(o => o.DateOnly.ToDateTime(o.TimeOnly) == new DateTime(2020, 1, 1, 15, 30, 10))); [ConditionalFact] public virtual Task ToDateTime_constant_DateTime_with_property_TimeOnly() - => AssertQuery( - ss => ss.Set() - .Where(o => new DateOnly(1990, 11, 10).ToDateTime(o.TimeOnly) == new DateTime(1990, 11, 10, 15, 30, 10))); + => AssertQuery(ss => ss.Set() + .Where(o => new DateOnly(1990, 11, 10).ToDateTime(o.TimeOnly) == new DateTime(1990, 11, 10, 15, 30, 10))); [ConditionalFact] public virtual Task ToDateTime_with_complex_DateTime() - => AssertQuery( - ss => ss.Set() - .Where(o => o.DateOnly.AddYears(1).ToDateTime(o.TimeOnly) == new DateTime(2021, 1, 1, 15, 30, 10))); + => AssertQuery(ss => ss.Set() + .Where(o => o.DateOnly.AddYears(1).ToDateTime(o.TimeOnly) == new DateTime(2021, 1, 1, 15, 30, 10))); [ConditionalFact] public virtual Task ToDateTime_with_complex_TimeOnly() - => AssertQuery( - ss => ss.Set() - .Where(o => o.DateOnly.ToDateTime(o.TimeOnly.AddHours(1)) == new DateTime(2020, 1, 1, 16, 30, 10)) - .AsTracking()); + => AssertQuery(ss => ss.Set() + .Where(o => o.DateOnly.ToDateTime(o.TimeOnly.AddHours(1)) == new DateTime(2020, 1, 1, 16, 30, 10)) + .AsTracking()); } diff --git a/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateTimeOffsetTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateTimeOffsetTranslationsTestBase.cs index b3ade9a7633..47ab0f14aec 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateTimeOffsetTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateTimeOffsetTranslationsTestBase.cs @@ -10,117 +10,95 @@ public abstract class DateTimeOffsetTranslationsTestBase(TFixture fixt { [ConditionalFact] public virtual Task Now() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset != DateTimeOffset.Now)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset != DateTimeOffset.Now)); [ConditionalFact] public virtual Task UtcNow() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset != DateTimeOffset.UtcNow)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset != DateTimeOffset.UtcNow)); [ConditionalFact] public virtual Task Date() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset.Date > new DateTimeOffset().Date)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset.Date > new DateTimeOffset().Date)); [ConditionalFact] public virtual Task Year() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset.Year == 1998)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset.Year == 1998)); [ConditionalFact] public virtual Task Month() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset.Month == 5)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset.Month == 5)); [ConditionalFact] public virtual Task DayOfYear() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset.DayOfYear == 124)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset.DayOfYear == 124)); [ConditionalFact] public virtual Task Day() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset.Day == 4)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset.Day == 4)); [ConditionalFact] public virtual Task Hour() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset.Hour == 15)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset.Hour == 15)); [ConditionalFact] public virtual Task Minute() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset.Minute == 30)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset.Minute == 30)); [ConditionalFact] public virtual Task Second() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset.Second == 10)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset.Second == 10)); [ConditionalFact] public virtual Task Millisecond() - => AssertQuery( - ss => ss.Set().Where(b => b.DateTimeOffset.Millisecond == 123)); + => AssertQuery(ss => ss.Set().Where(b => b.DateTimeOffset.Millisecond == 123)); [ConditionalFact] public virtual Task Microsecond() - => AssertQuery( - ss => ss.Set().Where(e => e.DateTimeOffset.Microsecond == 456)); + => AssertQuery(ss => ss.Set().Where(e => e.DateTimeOffset.Microsecond == 456)); [ConditionalFact] public virtual Task Nanosecond() - => AssertQuery( - ss => ss.Set().Where(e => e.DateTimeOffset.Nanosecond == 400)); + => AssertQuery(ss => ss.Set().Where(e => e.DateTimeOffset.Nanosecond == 400)); [ConditionalFact] public virtual Task TimeOfDay() - => AssertQueryScalar( - ss => ss.Set().Select(b => b.DateTimeOffset.TimeOfDay)); + => AssertQueryScalar(ss => ss.Set().Select(b => b.DateTimeOffset.TimeOfDay)); [ConditionalFact] public virtual Task AddYears() - => AssertQueryScalar( - ss => ss.Set().Select(b => b.DateTimeOffset.AddYears(1))); + => AssertQueryScalar(ss => ss.Set().Select(b => b.DateTimeOffset.AddYears(1))); [ConditionalFact] public virtual Task AddMonths() - => AssertQueryScalar( - ss => ss.Set().Select(b => b.DateTimeOffset.AddMonths(1))); + => AssertQueryScalar(ss => ss.Set().Select(b => b.DateTimeOffset.AddMonths(1))); [ConditionalFact] public virtual Task AddDays() - => AssertQueryScalar( - ss => ss.Set().Select(b => b.DateTimeOffset.AddDays(1))); + => AssertQueryScalar(ss => ss.Set().Select(b => b.DateTimeOffset.AddDays(1))); [ConditionalFact] public virtual Task AddHours() - => AssertQueryScalar( - ss => ss.Set().Select(b => b.DateTimeOffset.AddHours(1))); + => AssertQueryScalar(ss => ss.Set().Select(b => b.DateTimeOffset.AddHours(1))); [ConditionalFact] public virtual Task AddMinutes() - => AssertQueryScalar( - ss => ss.Set().Select(b => b.DateTimeOffset.AddMinutes(1))); + => AssertQueryScalar(ss => ss.Set().Select(b => b.DateTimeOffset.AddMinutes(1))); [ConditionalFact] public virtual Task AddSeconds() - => AssertQueryScalar( - ss => ss.Set().Select(b => b.DateTimeOffset.AddSeconds(1))); + => AssertQueryScalar(ss => ss.Set().Select(b => b.DateTimeOffset.AddSeconds(1))); [ConditionalFact] public virtual Task AddMilliseconds() - => AssertQueryScalar( - ss => ss.Set().Select(b => b.DateTimeOffset.AddMilliseconds(300))); + => AssertQueryScalar(ss => ss.Set().Select(b => b.DateTimeOffset.AddMilliseconds(300))); [ConditionalFact] public virtual Task ToUnixTimeMilliseconds() { var unixEpochMilliseconds = new DateTimeOffset(1998, 5, 4, 15, 30, 10, TimeSpan.Zero).ToUnixTimeMilliseconds(); - return AssertQuery( - ss => ss.Set() - .Where(b => b.DateTimeOffset.ToUnixTimeMilliseconds() == unixEpochMilliseconds)); + return AssertQuery(ss => ss.Set() + .Where(b => b.DateTimeOffset.ToUnixTimeMilliseconds() == unixEpochMilliseconds)); } [ConditionalFact] @@ -128,9 +106,8 @@ public virtual Task ToUnixTimeSecond() { var unixEpochSeconds = new DateTimeOffset(1998, 5, 4, 15, 30, 10, TimeSpan.Zero).ToUnixTimeSeconds(); - return AssertQuery( - ss => ss.Set() - .Where(b => b.DateTimeOffset.ToUnixTimeSeconds() == unixEpochSeconds)); + return AssertQuery(ss => ss.Set() + .Where(b => b.DateTimeOffset.ToUnixTimeSeconds() == unixEpochSeconds)); } [ConditionalFact] diff --git a/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateTimeTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateTimeTranslationsTestBase.cs index f355c6c8ebf..f5b7d32b375 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateTimeTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/Temporal/DateTimeTranslationsTestBase.cs @@ -13,8 +13,7 @@ public virtual Task Now() { var myDatetime = new DateTime(2015, 4, 10); - return AssertQuery( - ss => ss.Set().Where(c => DateTime.Now != myDatetime)); + return AssertQuery(ss => ss.Set().Where(c => DateTime.Now != myDatetime)); } [ConditionalFact] @@ -22,8 +21,7 @@ public virtual Task UtcNow() { var myDatetime = new DateTime(2015, 4, 10); - return AssertQuery( - ss => ss.Set().Where(c => DateTime.UtcNow != myDatetime)); + return AssertQuery(ss => ss.Set().Where(c => DateTime.UtcNow != myDatetime)); } [ConditionalFact] @@ -37,87 +35,72 @@ public virtual Task Date() { var myDatetime = new DateTime(1998, 5, 4); - return AssertQuery( - ss => ss.Set().Where(o => o.DateTime.Date == myDatetime)); + return AssertQuery(ss => ss.Set().Where(o => o.DateTime.Date == myDatetime)); } [ConditionalFact] public virtual Task AddYear() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime.AddYears(1).Year == 1999)); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime.AddYears(1).Year == 1999)); [ConditionalFact] public virtual Task Year() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime.Year == 1998)); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime.Year == 1998)); [ConditionalFact] public virtual Task Month() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime.Month == 5)); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime.Month == 5)); [ConditionalFact] public virtual Task DayOfYear() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime.DayOfYear == 124)); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime.DayOfYear == 124)); [ConditionalFact] public virtual Task Day() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime.Day == 4)); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime.Day == 4)); [ConditionalFact] public virtual Task Hour() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime.Hour == 15)); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime.Hour == 15)); [ConditionalFact] public virtual Task Minute() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime.Minute == 30)); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime.Minute == 30)); [ConditionalFact] public virtual Task Second() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime.Second == 10)); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime.Second == 10)); [ConditionalFact] public virtual Task Millisecond() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime.Millisecond == 123)); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime.Millisecond == 123)); [ConditionalFact] public virtual Task TimeOfDay() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime.TimeOfDay == TimeSpan.Zero)); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime.TimeOfDay == TimeSpan.Zero)); [ConditionalFact] public virtual Task subtract_and_TotalDays() { var date = new DateTime(1997, 1, 1); - return AssertQuery( - ss => ss.Set().Where(o => (o.DateTime - date).TotalDays > 365)); + return AssertQuery(ss => ss.Set().Where(o => (o.DateTime - date).TotalDays > 365)); } [ConditionalFact] public virtual Task Parse_with_constant() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime == DateTime.Parse("5/4/1998 15:30:10 PM"))); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime == DateTime.Parse("5/4/1998 15:30:10 PM"))); [ConditionalFact] public virtual Task Parse_with_parameter() { var date = "5/4/1998 15:30:10 PM"; - return AssertQuery( - ss => ss.Set().Where(o => o.DateTime == DateTime.Parse(date))); + return AssertQuery(ss => ss.Set().Where(o => o.DateTime == DateTime.Parse(date))); } [ConditionalFact] public virtual Task New_with_constant() - => AssertQuery( - ss => ss.Set().Where(o => o.DateTime == new DateTime(1998, 5, 4, 15, 30, 10))); + => AssertQuery(ss => ss.Set().Where(o => o.DateTime == new DateTime(1998, 5, 4, 15, 30, 10))); [ConditionalFact] public virtual async Task New_with_parameters() @@ -127,7 +110,6 @@ public virtual async Task New_with_parameters() var date = 4; var hour = 15; - await AssertQuery( - ss => ss.Set().Where(o => o.DateTime == new DateTime(year, month, date, hour, 30, 10))); + await AssertQuery(ss => ss.Set().Where(o => o.DateTime == new DateTime(year, month, date, hour, 30, 10))); } } diff --git a/test/EFCore.Specification.Tests/Query/Translations/Temporal/TimeOnlyTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/Temporal/TimeOnlyTranslationsTestBase.cs index 9da342f2da7..a32ec94998c 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/Temporal/TimeOnlyTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/Temporal/TimeOnlyTranslationsTestBase.cs @@ -10,90 +10,74 @@ public abstract class TimeOnlyTranslationsTestBase(TFixture fixture) : { [ConditionalFact] public virtual Task Hour() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeOnly.Hour == 15)); + => AssertQuery(ss => ss.Set().Where(b => b.TimeOnly.Hour == 15)); [ConditionalFact] public virtual Task Minute() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeOnly.Minute == 30)); + => AssertQuery(ss => ss.Set().Where(b => b.TimeOnly.Minute == 30)); [ConditionalFact] public virtual Task Second() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeOnly.Second == 10)); + => AssertQuery(ss => ss.Set().Where(b => b.TimeOnly.Second == 10)); [ConditionalFact] public virtual Task Millisecond() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeOnly.Millisecond == 123)); + => AssertQuery(ss => ss.Set().Where(b => b.TimeOnly.Millisecond == 123)); [ConditionalFact] public virtual Task Microsecond() - => AssertQuery( - ss => ss.Set().Where(e => e.TimeOnly.Microsecond == 456)); + => AssertQuery(ss => ss.Set().Where(e => e.TimeOnly.Microsecond == 456)); [ConditionalFact] public virtual Task Nanosecond() - => AssertQuery( - ss => ss.Set().Where(e => e.TimeOnly.Nanosecond == 400)); + => AssertQuery(ss => ss.Set().Where(e => e.TimeOnly.Nanosecond == 400)); [ConditionalFact] public virtual Task AddHours() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeOnly.AddHours(3) == new TimeOnly(18, 30, 10))); + => AssertQuery(ss => ss.Set().Where(b => b.TimeOnly.AddHours(3) == new TimeOnly(18, 30, 10))); [ConditionalFact] public virtual Task AddMinutes() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeOnly.AddMinutes(3) == new TimeOnly(15, 33, 10))); + => AssertQuery(ss => ss.Set().Where(b => b.TimeOnly.AddMinutes(3) == new TimeOnly(15, 33, 10))); [ConditionalFact] public virtual Task Add_TimeSpan() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeOnly.Add(new TimeSpan(3, 0, 0)) == new TimeOnly(18, 30, 10))); + => AssertQuery(ss => ss.Set().Where(b => b.TimeOnly.Add(new TimeSpan(3, 0, 0)) == new TimeOnly(18, 30, 10))); [ConditionalFact] public virtual Task IsBetween() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeOnly.IsBetween(new TimeOnly(14, 0, 0), new TimeOnly(16, 0, 0)))); + => AssertQuery(ss => ss.Set().Where(b => b.TimeOnly.IsBetween(new TimeOnly(14, 0, 0), new TimeOnly(16, 0, 0)))); [ConditionalFact] public virtual Task Subtract() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeOnly - new TimeOnly(3, 0, 0) == new TimeSpan(12, 30, 10))); + => AssertQuery(ss => ss.Set().Where(b => b.TimeOnly - new TimeOnly(3, 0, 0) == new TimeSpan(12, 30, 10))); [ConditionalFact] public virtual Task FromDateTime_compared_to_property() - => AssertQuery( - ss => ss.Set().Where(b => TimeOnly.FromDateTime(b.DateTime) == b.TimeOnly)); + => AssertQuery(ss => ss.Set().Where(b => TimeOnly.FromDateTime(b.DateTime) == b.TimeOnly)); [ConditionalFact] public virtual Task FromDateTime_compared_to_parameter() { var time = new TimeOnly(15, 30, 10); - return AssertQuery( - ss => ss.Set().Where(b => TimeOnly.FromDateTime(b.DateTime) == time)); + return AssertQuery(ss => ss.Set().Where(b => TimeOnly.FromDateTime(b.DateTime) == time)); } [ConditionalFact] public virtual Task FromDateTime_compared_to_constant() - => AssertQuery( - ss => ss.Set().Where(b => TimeOnly.FromDateTime(b.DateTime) == new TimeOnly(15, 30, 10))); + => AssertQuery(ss => ss.Set().Where(b => TimeOnly.FromDateTime(b.DateTime) == new TimeOnly(15, 30, 10))); [ConditionalFact] public virtual Task FromTimeSpan_compared_to_property() - => AssertQuery( - ss => ss.Set().Where(b => TimeOnly.FromTimeSpan(b.TimeSpan) < b.TimeOnly)); + => AssertQuery(ss => ss.Set().Where(b => TimeOnly.FromTimeSpan(b.TimeSpan) < b.TimeOnly)); [ConditionalFact] public virtual Task FromTimeSpan_compared_to_parameter() { var time = new TimeOnly(1, 2, 3); - return AssertQuery( - ss => ss.Set().Where(x => TimeOnly.FromTimeSpan(x.TimeSpan) == time)); + return AssertQuery(ss => ss.Set().Where(x => TimeOnly.FromTimeSpan(x.TimeSpan) == time)); } [ConditionalFact] diff --git a/test/EFCore.Specification.Tests/Query/Translations/Temporal/TimeSpanTranslationsTestBase.cs b/test/EFCore.Specification.Tests/Query/Translations/Temporal/TimeSpanTranslationsTestBase.cs index 0abee2ffb2e..8f5d49421fe 100644 --- a/test/EFCore.Specification.Tests/Query/Translations/Temporal/TimeSpanTranslationsTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/Translations/Temporal/TimeSpanTranslationsTestBase.cs @@ -10,31 +10,25 @@ public abstract class TimeSpanTranslationsTestBase(TFixture fixture) : { [ConditionalFact] public virtual Task Hours() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeSpan.Hours == 3)); + => AssertQuery(ss => ss.Set().Where(b => b.TimeSpan.Hours == 3)); [ConditionalFact] public virtual Task Minutes() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeSpan.Minutes == 4)); + => AssertQuery(ss => ss.Set().Where(b => b.TimeSpan.Minutes == 4)); [ConditionalFact] public virtual Task Seconds() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeSpan.Seconds == 5)); + => AssertQuery(ss => ss.Set().Where(b => b.TimeSpan.Seconds == 5)); [ConditionalFact] public virtual Task Milliseconds() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeSpan.Milliseconds == 678)); + => AssertQuery(ss => ss.Set().Where(b => b.TimeSpan.Milliseconds == 678)); [ConditionalFact] public virtual Task Microseconds() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeSpan.Microseconds == 912)); + => AssertQuery(ss => ss.Set().Where(b => b.TimeSpan.Microseconds == 912)); [ConditionalFact] public virtual Task Nanoseconds() - => AssertQuery( - ss => ss.Set().Where(b => b.TimeSpan.Nanoseconds == 400)); + => AssertQuery(ss => ss.Set().Where(b => b.TimeSpan.Nanoseconds == 400)); } diff --git a/test/EFCore.Specification.Tests/QueryExpressionInterceptionTestBase.cs b/test/EFCore.Specification.Tests/QueryExpressionInterceptionTestBase.cs index 32fb767da11..10f570bb907 100644 --- a/test/EFCore.Specification.Tests/QueryExpressionInterceptionTestBase.cs +++ b/test/EFCore.Specification.Tests/QueryExpressionInterceptionTestBase.cs @@ -8,8 +8,7 @@ namespace Microsoft.EntityFrameworkCore; public abstract class QueryExpressionInterceptionTestBase(InterceptionTestBase.InterceptionFixtureBase fixture) : InterceptionTestBase(fixture) { - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Intercept_query_passively(bool async) { var (context, interceptor) = await CreateContextAsync(inject: true); @@ -26,16 +25,14 @@ public virtual async Task Intercept_query_passively(bool async) Assert.Contains(""".Where(e => e.Type == "Black Hole")""", interceptor.QueryExpression); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Intercept_query_with_multiple_interceptors(bool async) { var interceptor1 = new TestQueryExpressionInterceptor(); var interceptor2 = new QueryChangingExpressionInterceptor(); using var context = await CreateContextAsync( - appInterceptor: null, - [interceptor1, interceptor2]); + appInterceptor: null, interceptor1, interceptor2); using var listener = Fixture.SubscribeToDiagnosticListener(context.ContextId); @@ -54,8 +51,7 @@ public virtual async Task Intercept_query_with_multiple_interceptors(bool async) _ = async ? await query.ToListAsync() : query.ToList(); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Intercept_to_change_query_expression(bool async) { var (context, interceptor) = await CreateContextAsync(inject: true); @@ -72,8 +68,7 @@ public virtual async Task Intercept_to_change_query_expression(bool async) Assert.Contains(""".Where(e => e.Type == "Bing Bang")""", interceptor.QueryExpression); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Interceptor_does_not_leak_across_contexts(bool async) { // Create one context with QueryChangingExpressionInterceptor, and another with TestQueryExpressionInterceptor (which is a no-op). @@ -81,14 +76,14 @@ public virtual async Task Interceptor_does_not_leak_across_contexts(bool async) // one, but that's exactly what we want to test here. using var context1 = new UniverseContext( Fixture.AddOptions( - Fixture.TestStore.AddProviderOptions( - new DbContextOptionsBuilder().AddInterceptors(new QueryChangingExpressionInterceptor()))) - .Options); + Fixture.TestStore.AddProviderOptions( + new DbContextOptionsBuilder().AddInterceptors(new QueryChangingExpressionInterceptor()))) + .Options); using var context2 = new UniverseContext( Fixture.AddOptions( - Fixture.TestStore.AddProviderOptions( - new DbContextOptionsBuilder().AddInterceptors(new TestQueryExpressionInterceptor()))) - .Options); + Fixture.TestStore.AddProviderOptions( + new DbContextOptionsBuilder().AddInterceptors(new TestQueryExpressionInterceptor()))) + .Options); var query1 = context1.Set().Where(e => e.Type == "Black Hole"); var result1 = async ? await query1.SingleAsync() : query1.Single(); diff --git a/test/EFCore.Specification.Tests/SaveChangesInterceptionTestBase.cs b/test/EFCore.Specification.Tests/SaveChangesInterceptionTestBase.cs index 9735d9e0148..d923c81d34e 100644 --- a/test/EFCore.Specification.Tests/SaveChangesInterceptionTestBase.cs +++ b/test/EFCore.Specification.Tests/SaveChangesInterceptionTestBase.cs @@ -7,15 +7,9 @@ namespace Microsoft.EntityFrameworkCore; public abstract class SaveChangesInterceptionTestBase(InterceptionTestBase.InterceptionFixtureBase fixture) : InterceptionTestBase(fixture) { - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(true, false, false)] - [InlineData(false, true, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(true, false, false), InlineData(false, true, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(true, false, true), InlineData(false, true, true), + InlineData(true, true, true)] public virtual async Task Intercept_SaveChanges_passively(bool async, bool inject, bool noAcceptChanges) { var (context, interceptor) = await CreateContextAsync(inject); @@ -75,15 +69,9 @@ public virtual async Task Intercept_SaveChanges_passively(bool async, bool injec protected class PassiveSaveChangesInterceptor : SaveChangesInterceptorBase; - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(true, false, false)] - [InlineData(false, true, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(true, false, false), InlineData(false, true, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(true, false, true), InlineData(false, true, true), + InlineData(true, true, true)] public virtual async Task Intercept_SaveChanges_to_suppress_save(bool async, bool inject, bool noAcceptChanges) { var (context, interceptor) = await CreateContextAsync(inject); @@ -161,15 +149,9 @@ public override async ValueTask> SavingChangesAsync( } } - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(true, false, false)] - [InlineData(false, true, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(true, false, false), InlineData(false, true, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(true, false, true), InlineData(false, true, true), + InlineData(true, true, true)] public virtual async Task Intercept_SaveChanges_to_change_result(bool async, bool inject, bool noAcceptChanges) { var (context, interceptor) = await CreateContextAsync(inject); @@ -247,23 +229,12 @@ public override async ValueTask SavedChangesAsync( } } - [ConditionalTheory] - [InlineData(false, false, false, false)] - [InlineData(true, false, false, false)] - [InlineData(false, true, false, false)] - [InlineData(true, true, false, false)] - [InlineData(false, false, true, false)] - [InlineData(true, false, true, false)] - [InlineData(false, true, true, false)] - [InlineData(true, true, true, false)] - [InlineData(false, false, false, true)] - [InlineData(true, false, false, true)] - [InlineData(false, true, false, true)] - [InlineData(true, true, false, true)] - [InlineData(false, false, true, true)] - [InlineData(true, false, true, true)] - [InlineData(false, true, true, true)] - [InlineData(true, true, true, true)] + [ConditionalTheory, InlineData(false, false, false, false), InlineData(true, false, false, false), + InlineData(false, true, false, false), InlineData(true, true, false, false), InlineData(false, false, true, false), + InlineData(true, false, true, false), InlineData(false, true, true, false), InlineData(true, true, true, false), + InlineData(false, false, false, true), InlineData(true, false, false, true), InlineData(false, true, false, true), + InlineData(true, true, false, true), InlineData(false, false, true, true), InlineData(true, false, true, true), + InlineData(false, true, true, true), InlineData(true, true, true, true)] public virtual async Task Intercept_SaveChanges_failed(bool async, bool inject, bool noAcceptChanges, bool concurrencyError) { if (concurrencyError @@ -358,15 +329,9 @@ public virtual async Task Intercept_SaveChanges_failed(bool async, bool inject, } } - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(true, false, false)] - [InlineData(false, true, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(true, false, false), InlineData(false, true, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(true, false, true), InlineData(false, true, true), + InlineData(true, true, true)] public virtual async Task Intercept_to_suppress_concurrency_exception(bool async, bool inject, bool noAcceptChanges) { if (!SupportsOptimisticConcurrency) @@ -465,15 +430,9 @@ public override async ValueTask ThrowingConcurrencyException } } - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(true, false, false)] - [InlineData(false, true, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(true, false, false), InlineData(false, true, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(true, false, true), InlineData(false, true, true), + InlineData(true, true, true)] public virtual async Task Intercept_SaveChanges_with_multiple_interceptors(bool async, bool inject, bool noAcceptChanges) { var interceptor1 = new PassiveSaveChangesInterceptor(); @@ -482,8 +441,8 @@ public virtual async Task Intercept_SaveChanges_with_multiple_interceptors(bool var interceptor4 = new PassiveSaveChangesInterceptor(); using var context = await CreateContextAsync( - new IInterceptor[] { new PassiveSaveChangesInterceptor(), interceptor1, interceptor2 }, - new IInterceptor[] { interceptor3, interceptor4, new PassiveSaveChangesInterceptor() }); + [new PassiveSaveChangesInterceptor(), interceptor1, interceptor2], + [interceptor3, interceptor4, new PassiveSaveChangesInterceptor()]); await context.AddAsync(new Singularity { Id = 35, Type = "Red Dwarf" }); diff --git a/test/EFCore.Specification.Tests/Scaffolding/CompiledModelTestBase.cs b/test/EFCore.Specification.Tests/Scaffolding/CompiledModelTestBase.cs index 6ea94fdc497..d30cced15c3 100644 --- a/test/EFCore.Specification.Tests/Scaffolding/CompiledModelTestBase.cs +++ b/test/EFCore.Specification.Tests/Scaffolding/CompiledModelTestBase.cs @@ -23,13 +23,12 @@ public virtual Task SimpleModel() modelBuilder => { modelBuilder.Ignore>(); - modelBuilder.Entity>( - b => - { - b.Ignore(e => e.Principal); - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property("Data"); - }); + modelBuilder.Entity>(b => + { + b.Ignore(e => e.Principal); + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property("Data"); + }); }, model => Assert.Single(model.GetEntityTypes()), async c => @@ -94,188 +93,182 @@ protected virtual Task BigModel(bool forNativeAot, [CallerMemberName] string tes protected virtual void BuildBigModel(ModelBuilder modelBuilder, bool jsonColumns) { - modelBuilder.Entity( - eb => - { - eb.Property("FlagsEnum2") - .UsePropertyAccessMode(PropertyAccessMode.Property) - .HasSentinel(AFlagsEnum.C | AFlagsEnum.B); - - eb.Property(e => e.AlternateId) - .UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction); + modelBuilder.Entity(eb => + { + eb.Property("FlagsEnum2") + .UsePropertyAccessMode(PropertyAccessMode.Property) + .HasSentinel(AFlagsEnum.C | AFlagsEnum.B); - eb.HasKey(e => new { e.Id, e.AlternateId }); + eb.Property(e => e.AlternateId) + .UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction); - eb.Property(e => e.Id).ValueGeneratedNever(); - eb.HasAlternateKey(e => e.Id); + eb.HasKey(e => new { e.Id, e.AlternateId }); - eb.Property(e => e.AlternateId).Metadata.SetJsonValueReaderWriterType( - jsonColumns - ? typeof(MyJsonGuidReaderWriter) - : typeof(JsonGuidReaderWriter)); + eb.Property(e => e.Id).ValueGeneratedNever(); + eb.HasAlternateKey(e => e.Id); - eb.OwnsOne( - e => e.Owned, ob => - { - ob.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues); - ob.UsePropertyAccessMode(PropertyAccessMode.Field); + eb.Property(e => e.AlternateId).Metadata.SetJsonValueReaderWriterType( + jsonColumns + ? typeof(MyJsonGuidReaderWriter) + : typeof(JsonGuidReaderWriter)); - if (!jsonColumns) - { - ob.HasData( - new - { - Number = 10, - PrincipalBaseId = 1L, - PrincipalBaseAlternateId = new Guid() - }); - } - }); + eb.OwnsOne( + e => e.Owned, ob => + { + ob.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues); + ob.UsePropertyAccessMode(PropertyAccessMode.Field); - eb.Navigation(e => e.Owned).IsRequired().HasField("_ownedField") - .UsePropertyAccessMode(PropertyAccessMode.Field); + if (!jsonColumns) + { + ob.HasData( + new + { + Number = 10, + PrincipalBaseId = 1L, + PrincipalBaseAlternateId = new Guid() + }); + } + }); - if (!jsonColumns) - { - eb.HasData(new PrincipalBase { Id = 1, AlternateId = new Guid() }); - } - }); + eb.Navigation(e => e.Owned).IsRequired().HasField("_ownedField") + .UsePropertyAccessMode(PropertyAccessMode.Field); - modelBuilder.Entity>>( - eb => + if (!jsonColumns) { - eb.HasOne(e => e.Dependent).WithOne(e => e.Principal) - .HasForeignKey>() - .OnDelete(DeleteBehavior.ClientNoAction); + eb.HasData(new PrincipalBase { Id = 1, AlternateId = new Guid() }); + } + }); + + modelBuilder.Entity>>(eb => + { + eb.HasOne(e => e.Dependent).WithOne(e => e.Principal) + .HasForeignKey>() + .OnDelete(DeleteBehavior.ClientNoAction); - eb.Navigation(e => e.Dependent).AutoInclude().EnableLazyLoading(false); + eb.Navigation(e => e.Dependent).AutoInclude().EnableLazyLoading(false); - eb.OwnsMany(typeof(OwnedType).FullName!, "ManyOwned"); + eb.OwnsMany(typeof(OwnedType).FullName!, "ManyOwned"); - eb.HasMany(e => e.Principals).WithMany(e => (ICollection>>)e.Deriveds) - .UsingEntity( - jb => - { - jb.Property("rowid"); - }); - }); + eb.HasMany(e => e.Principals).WithMany(e => (ICollection>>)e.Deriveds) + .UsingEntity(jb => + { + jb.Property("rowid"); + }); + }); - modelBuilder.Entity>( - eb => - { - eb.Property("Id"); + modelBuilder.Entity>(eb => + { + eb.Property("Id"); - eb.HasKey("PrincipalId", "PrincipalAlternateId"); + eb.HasKey("PrincipalId", "PrincipalAlternateId"); - eb.HasOne().WithOne() - .HasForeignKey>("PrincipalId") - .HasPrincipalKey(e => e.Id); + eb.HasOne().WithOne() + .HasForeignKey>("PrincipalId") + .HasPrincipalKey(e => e.Id); - eb.HasDiscriminator("EnumDiscriminator") - .HasValue(Enum1.One) - .HasValue>(Enum1.Two) - .IsComplete(false); - }); + eb.HasDiscriminator("EnumDiscriminator") + .HasValue(Enum1.One) + .HasValue>(Enum1.Two) + .IsComplete(false); + }); - modelBuilder.Entity>( - eb => - { - eb.Property("Data") - .HasMaxLength(20) - .IsUnicode(false); + modelBuilder.Entity>(eb => + { + eb.Property("Data") + .HasMaxLength(20) + .IsUnicode(false); - eb.Property("Money") - .HasPrecision(9, 3); - }); + eb.Property("Money") + .HasPrecision(9, 3); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasConversion().ValueGeneratedOnAdd(); - b.HasKey(e => e.Id); - - b.Property(e => e.Enum8AsString).HasConversion(); - b.Property(e => e.Enum16AsString).HasConversion(); - b.Property(e => e.Enum32AsString).HasConversion(); - b.Property(e => e.Enum64AsString).HasConversion(); - b.Property(e => e.EnumU8AsString).HasConversion(); - b.Property(e => e.EnumU16AsString).HasConversion(); - b.Property(e => e.EnumU32AsString).HasConversion(); - b.Property(e => e.EnumU64AsString).HasConversion(); - - b.PrimitiveCollection(e => e.Enum8AsStringCollection).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.Enum16AsStringCollection).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.Enum32AsStringCollection).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.Enum64AsStringCollection).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.EnumU8AsStringCollection).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.EnumU16AsStringCollection).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.EnumU32AsStringCollection).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.EnumU64AsStringCollection).ElementType(b => b.HasConversion()); - - b.PrimitiveCollection(e => e.Enum8AsStringArray).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.Enum16AsStringArray).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.Enum32AsStringArray).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.Enum64AsStringArray).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.EnumU8AsStringArray).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.EnumU16AsStringArray).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.EnumU32AsStringArray).ElementType(b => b.HasConversion()); - b.PrimitiveCollection(e => e.EnumU64AsStringArray).ElementType(b => b.HasConversion()); - - b.Property(e => e.BoolReadOnlyCollection); - b.Property(e => e.UInt8ReadOnlyCollection).HasField("_uInt8ReadOnlyCollection"); - b.Property(e => e.Int32ReadOnlyCollection); - b.Property(e => e.StringReadOnlyCollection).HasField("_stringReadOnlyCollection"); - - b.PrimitiveCollection(e => e.IPAddressReadOnlyCollection) - .ElementType(b => b.HasConversion()) - .HasField("_ipAddressReadOnlyCollection"); - - b.Property(e => e.BoolToStringConverterProperty).HasConversion(new BoolToStringConverter("A", "B")); - b.Property(e => e.BoolToTwoValuesConverterProperty).HasConversion(new BoolToTwoValuesConverter(0, 1)); - b.Property(e => e.BoolToZeroOneConverterProperty).HasConversion>(); - b.Property(e => e.BytesToStringConverterProperty).HasConversion>(); - b.Property(e => e.CastingConverterProperty).HasConversion>(); - b.Property(e => e.CharToStringConverterProperty).HasConversion(); - b.Property(e => e.DateOnlyToStringConverterProperty).HasConversion(); - b.Property(e => e.DateTimeOffsetToBinaryConverterProperty).HasConversion(); - b.Property(e => e.DateTimeOffsetToBytesConverterProperty).HasConversion(); - b.Property(e => e.DateTimeOffsetToStringConverterProperty).HasConversion(); - b.Property(e => e.DateTimeToBinaryConverterProperty).HasConversion(); - b.Property(e => e.DateTimeToStringConverterProperty).HasConversion(); - b.Property(e => e.EnumToNumberConverterProperty).HasConversion>(); - b.Property(e => e.EnumToStringConverterProperty).HasConversion>(); - b.Property(e => e.GuidToBytesConverterProperty).HasConversion(); - b.Property(e => e.GuidToStringConverterProperty).HasConversion(); - b.Property(e => e.IPAddressToBytesConverterProperty).HasConversion(); - b.Property(e => e.IPAddressToStringConverterProperty).HasConversion(); - b.Property(e => e.IntNumberToBytesConverterProperty).HasConversion>(); - b.Property(e => e.DecimalNumberToBytesConverterProperty).HasConversion>(); - b.Property(e => e.DoubleNumberToBytesConverterProperty).HasConversion>(); - b.Property(e => e.IntNumberToStringConverterProperty).HasConversion>(); - b.Property(e => e.DecimalNumberToStringConverterProperty).HasConversion>(); - b.Property(e => e.DoubleNumberToStringConverterProperty).HasConversion>(); - b.Property(e => e.PhysicalAddressToBytesConverterProperty).HasConversion(); - b.Property(e => e.PhysicalAddressToStringConverterProperty).HasConversion(); - b.Property(e => e.StringToBoolConverterProperty).HasConversion(); - b.Property(e => e.StringToBytesConverterProperty).HasConversion(new StringToBytesConverter(Encoding.UTF32)); - b.Property(e => e.StringToCharConverterProperty).HasConversion(); - b.Property(e => e.StringToDateOnlyConverterProperty).HasConversion(); - b.Property(e => e.StringToDateTimeConverterProperty).HasConversion(); - b.Property(e => e.StringToDateTimeOffsetConverterProperty).HasConversion(); - b.Property(e => e.StringToEnumConverterProperty).HasConversion>(); - b.Property(e => e.StringToIntNumberConverterProperty).HasConversion>(); - b.Property(e => e.StringToDecimalNumberConverterProperty).HasConversion>(); - b.Property(e => e.StringToDoubleNumberConverterProperty).HasConversion>(); - b.Property(e => e.StringToTimeOnlyConverterProperty).HasConversion(); - b.Property(e => e.StringToTimeSpanConverterProperty).HasConversion(); - b.Property(e => e.StringToUriConverterProperty).HasConversion(); - b.Property(e => e.TimeOnlyToStringConverterProperty).HasConversion(); - b.Property(e => e.TimeOnlyToTicksConverterProperty).HasConversion(); - b.Property(e => e.TimeSpanToStringConverterProperty).HasConversion(); - b.Property(e => e.TimeSpanToTicksConverterProperty).HasConversion(); - b.Property(e => e.UriToStringConverterProperty).HasConversion(); - b.Property(e => e.NullIntToNullStringConverterProperty).HasConversion(); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasConversion().ValueGeneratedOnAdd(); + b.HasKey(e => e.Id); + + b.Property(e => e.Enum8AsString).HasConversion(); + b.Property(e => e.Enum16AsString).HasConversion(); + b.Property(e => e.Enum32AsString).HasConversion(); + b.Property(e => e.Enum64AsString).HasConversion(); + b.Property(e => e.EnumU8AsString).HasConversion(); + b.Property(e => e.EnumU16AsString).HasConversion(); + b.Property(e => e.EnumU32AsString).HasConversion(); + b.Property(e => e.EnumU64AsString).HasConversion(); + + b.PrimitiveCollection(e => e.Enum8AsStringCollection).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.Enum16AsStringCollection).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.Enum32AsStringCollection).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.Enum64AsStringCollection).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.EnumU8AsStringCollection).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.EnumU16AsStringCollection).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.EnumU32AsStringCollection).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.EnumU64AsStringCollection).ElementType(b => b.HasConversion()); + + b.PrimitiveCollection(e => e.Enum8AsStringArray).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.Enum16AsStringArray).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.Enum32AsStringArray).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.Enum64AsStringArray).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.EnumU8AsStringArray).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.EnumU16AsStringArray).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.EnumU32AsStringArray).ElementType(b => b.HasConversion()); + b.PrimitiveCollection(e => e.EnumU64AsStringArray).ElementType(b => b.HasConversion()); + + b.Property(e => e.BoolReadOnlyCollection); + b.Property(e => e.UInt8ReadOnlyCollection).HasField("_uInt8ReadOnlyCollection"); + b.Property(e => e.Int32ReadOnlyCollection); + b.Property(e => e.StringReadOnlyCollection).HasField("_stringReadOnlyCollection"); + + b.PrimitiveCollection(e => e.IPAddressReadOnlyCollection) + .ElementType(b => b.HasConversion()) + .HasField("_ipAddressReadOnlyCollection"); + + b.Property(e => e.BoolToStringConverterProperty).HasConversion(new BoolToStringConverter("A", "B")); + b.Property(e => e.BoolToTwoValuesConverterProperty).HasConversion(new BoolToTwoValuesConverter(0, 1)); + b.Property(e => e.BoolToZeroOneConverterProperty).HasConversion>(); + b.Property(e => e.BytesToStringConverterProperty).HasConversion>(); + b.Property(e => e.CastingConverterProperty).HasConversion>(); + b.Property(e => e.CharToStringConverterProperty).HasConversion(); + b.Property(e => e.DateOnlyToStringConverterProperty).HasConversion(); + b.Property(e => e.DateTimeOffsetToBinaryConverterProperty).HasConversion(); + b.Property(e => e.DateTimeOffsetToBytesConverterProperty).HasConversion(); + b.Property(e => e.DateTimeOffsetToStringConverterProperty).HasConversion(); + b.Property(e => e.DateTimeToBinaryConverterProperty).HasConversion(); + b.Property(e => e.DateTimeToStringConverterProperty).HasConversion(); + b.Property(e => e.EnumToNumberConverterProperty).HasConversion>(); + b.Property(e => e.EnumToStringConverterProperty).HasConversion>(); + b.Property(e => e.GuidToBytesConverterProperty).HasConversion(); + b.Property(e => e.GuidToStringConverterProperty).HasConversion(); + b.Property(e => e.IPAddressToBytesConverterProperty).HasConversion(); + b.Property(e => e.IPAddressToStringConverterProperty).HasConversion(); + b.Property(e => e.IntNumberToBytesConverterProperty).HasConversion>(); + b.Property(e => e.DecimalNumberToBytesConverterProperty).HasConversion>(); + b.Property(e => e.DoubleNumberToBytesConverterProperty).HasConversion>(); + b.Property(e => e.IntNumberToStringConverterProperty).HasConversion>(); + b.Property(e => e.DecimalNumberToStringConverterProperty).HasConversion>(); + b.Property(e => e.DoubleNumberToStringConverterProperty).HasConversion>(); + b.Property(e => e.PhysicalAddressToBytesConverterProperty).HasConversion(); + b.Property(e => e.PhysicalAddressToStringConverterProperty).HasConversion(); + b.Property(e => e.StringToBoolConverterProperty).HasConversion(); + b.Property(e => e.StringToBytesConverterProperty).HasConversion(new StringToBytesConverter(Encoding.UTF32)); + b.Property(e => e.StringToCharConverterProperty).HasConversion(); + b.Property(e => e.StringToDateOnlyConverterProperty).HasConversion(); + b.Property(e => e.StringToDateTimeConverterProperty).HasConversion(); + b.Property(e => e.StringToDateTimeOffsetConverterProperty).HasConversion(); + b.Property(e => e.StringToEnumConverterProperty).HasConversion>(); + b.Property(e => e.StringToIntNumberConverterProperty).HasConversion>(); + b.Property(e => e.StringToDecimalNumberConverterProperty).HasConversion>(); + b.Property(e => e.StringToDoubleNumberConverterProperty).HasConversion>(); + b.Property(e => e.StringToTimeOnlyConverterProperty).HasConversion(); + b.Property(e => e.StringToTimeSpanConverterProperty).HasConversion(); + b.Property(e => e.StringToUriConverterProperty).HasConversion(); + b.Property(e => e.TimeOnlyToStringConverterProperty).HasConversion(); + b.Property(e => e.TimeOnlyToTicksConverterProperty).HasConversion(); + b.Property(e => e.TimeSpanToStringConverterProperty).HasConversion(); + b.Property(e => e.TimeSpanToTicksConverterProperty).HasConversion(); + b.Property(e => e.UriToStringConverterProperty).HasConversion(); + b.Property(e => e.NullIntToNullStringConverterProperty).HasConversion(); + }); } protected virtual void AssertBigModel(IModel model, bool jsonColumns) @@ -302,7 +295,8 @@ protected virtual void AssertBigModel(IModel model, bool jsonColumns) Assert.Null(ipAddressElementType.GetPrecision()); Assert.Null(ipAddressElementType.GetScale()); Assert.Null(ipAddressElementType.IsUnicode()); - Assert.Equal(ipAddressCollection.GetTypeMapping().ElementTypeMapping?.GetType(), ipAddressElementType.GetTypeMapping().GetType()); + Assert.Equal( + ipAddressCollection.GetTypeMapping().ElementTypeMapping?.GetType(), ipAddressElementType.GetTypeMapping().GetType()); Assert.NotNull(ipAddressElementType.GetTypeMapping().Comparer); Assert.NotNull(ipAddressElementType.GetTypeMapping().Converter); Assert.NotNull(ipAddressElementType.GetTypeMapping().JsonValueReaderWriter); @@ -595,7 +589,7 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) context.Add(principalDerived); - var types = new ManyTypes() + var types = new ManyTypes { Bool = true, UInt8 = 1, @@ -619,7 +613,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) Uri = new Uri("https://www.example.com"), PhysicalAddress = PhysicalAddress.Parse("00-00-00-00-00-01"), IPAddress = IPAddress.Parse("127.0.0.1"), - NullableBool = true, NullableUInt8 = 1, NullableInt16 = 2, @@ -640,7 +633,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) NullableTimeSpan = new TimeSpan(1), NullableBytes = [1, 2, 3], NullableUri = new Uri("https://www.example.com"), - BoolArray = [true], Int8Array = [1], Int16Array = [2], @@ -664,7 +656,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) UriArray = [new Uri("https://www.example.com")], IPAddressArray = [IPAddress.Parse("127.0.0.1")], PhysicalAddressArray = [PhysicalAddress.Parse("00-00-00-00-00-01")], - NullableBoolArray = [true], NullableInt8Array = [1], NullableInt16Array = [2], @@ -688,13 +679,11 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) NullableUriArray = [new Uri("https://www.example.com")], NullableIPAddressArray = [IPAddress.Parse("127.0.0.1")], NullablePhysicalAddressArray = [PhysicalAddress.Parse("00-00-00-00-00-01")], - BoolReadOnlyCollection = [true], UInt8ReadOnlyCollection = [1], Int32ReadOnlyCollection = [2], StringReadOnlyCollection = ["3"], IPAddressReadOnlyCollection = [IPAddress.Parse("127.0.0.1")], - Enum8 = Enum8.One, Enum16 = Enum16.One, Enum32 = Enum32.One, @@ -703,7 +692,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) EnumU16 = EnumU16.One, EnumU32 = EnumU32.One, EnumU64 = EnumU64.One, - Enum8AsString = Enum8.One, Enum16AsString = Enum16.One, Enum32AsString = Enum32.One, @@ -712,7 +700,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) EnumU16AsString = EnumU16.One, EnumU32AsString = EnumU32.One, EnumU64AsString = EnumU64.One, - Enum8Collection = [Enum8.One], Enum16Collection = [Enum16.One], Enum32Collection = [Enum32.One], @@ -721,7 +708,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) EnumU16Collection = [EnumU16.One], EnumU32Collection = [EnumU32.One], EnumU64Collection = [EnumU64.One], - Enum8AsStringCollection = [Enum8.One], Enum16AsStringCollection = [Enum16.One], Enum32AsStringCollection = [Enum32.One], @@ -730,7 +716,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) EnumU16AsStringCollection = [EnumU16.One], EnumU32AsStringCollection = [EnumU32.One], EnumU64AsStringCollection = [EnumU64.One], - NullableEnum8Collection = [Enum8.One], NullableEnum16Collection = [Enum16.One], NullableEnum32Collection = [Enum32.One], @@ -739,7 +724,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) NullableEnumU16Collection = [EnumU16.One], NullableEnumU32Collection = [EnumU32.One], NullableEnumU64Collection = [EnumU64.One], - NullableEnum8AsStringCollection = [Enum8.One], NullableEnum16AsStringCollection = [Enum16.One], NullableEnum32AsStringCollection = [Enum32.One], @@ -748,7 +732,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) NullableEnumU16AsStringCollection = [EnumU16.One], NullableEnumU32AsStringCollection = [EnumU32.One], NullableEnumU64AsStringCollection = [EnumU64.One], - Enum8Array = [Enum8.One], Enum16Array = [Enum16.One], Enum32Array = [Enum32.One], @@ -757,7 +740,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) EnumU16Array = [EnumU16.One], EnumU32Array = [EnumU32.One], EnumU64Array = [EnumU64.One], - Enum8AsStringArray = [Enum8.One], Enum16AsStringArray = [Enum16.One], Enum32AsStringArray = [Enum32.One], @@ -766,7 +748,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) EnumU16AsStringArray = [EnumU16.One], EnumU32AsStringArray = [EnumU32.One], EnumU64AsStringArray = [EnumU64.One], - NullableEnum8Array = [Enum8.One], NullableEnum16Array = [Enum16.One], NullableEnum32Array = [Enum32.One], @@ -775,7 +756,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) NullableEnumU16Array = [EnumU16.One], NullableEnumU32Array = [EnumU32.One], NullableEnumU64Array = [EnumU64.One], - NullableEnum8AsStringArray = [Enum8.One], NullableEnum16AsStringArray = [Enum16.One], NullableEnum32AsStringArray = [Enum32.One], @@ -784,7 +764,6 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) NullableEnumU16AsStringArray = [EnumU16.One], NullableEnumU32AsStringArray = [EnumU32.One], NullableEnumU64AsStringArray = [EnumU64.One], - BoolNestedCollection = [[true]], UInt8NestedCollection = [[9]], Int8NestedCollection = [[[9]]], @@ -801,14 +780,12 @@ protected virtual async Task UseBigModel(DbContext context, bool jsonColumns) NullableGuidNestedCollection = [[Guid.NewGuid()]], NullableBytesNestedCollection = [[[1, 2, 3]]], NullablePhysicalAddressNestedCollection = [[[PhysicalAddress.Parse("00-00-00-00-00-01")]]], - Enum8NestedCollection = [[Enum8.One]], Enum32NestedCollection = [[[Enum32.One]]], EnumU64NestedCollection = [[EnumU64.One]], NullableEnum8NestedCollection = [[Enum8.One]], NullableEnum32NestedCollection = [[[Enum32.One]]], NullableEnumU64NestedCollection = [[EnumU64.One]], - BoolToStringConverterProperty = true, BoolToTwoValuesConverterProperty = true, BoolToZeroOneConverterProperty = true, @@ -1192,68 +1169,66 @@ public virtual Task ComplexTypes() protected virtual void BuildComplexTypesModel(ModelBuilder modelBuilder) { - modelBuilder.Entity( - eb => - { - eb.Ignore(e => e.Owned); + modelBuilder.Entity(eb => + { + eb.Ignore(e => e.Owned); - eb.Property("FlagsEnum2"); + eb.Property("FlagsEnum2"); - eb.ComplexProperty( - e => e.Owned, eb => - { - eb.HasField("_ownedField") - .UsePropertyAccessMode(PropertyAccessMode.Field) - .HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues) - .HasPropertyAnnotation("goo", "ber") - .HasTypeAnnotation("go", "brr"); - eb.Property(c => c.Details) - .IsUnicode(false) - .IsRequired(false) - .HasField("_details") - .HasSentinel("") - .UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction) - .HasMaxLength(64) - .HasPrecision(3, 2) - .HasAnnotation("foo", "bar"); - eb.Ignore(e => e.Context); - eb.ComplexProperty( - o => o.Principal, cb => - { - cb.Property("FlagsEnum2"); - cb.Ignore(e => e.Deriveds); - }); - }); - }); + eb.ComplexProperty( + e => e.Owned, eb => + { + eb.HasField("_ownedField") + .UsePropertyAccessMode(PropertyAccessMode.Field) + .HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues) + .HasPropertyAnnotation("goo", "ber") + .HasTypeAnnotation("go", "brr"); + eb.Property(c => c.Details) + .IsUnicode(false) + .IsRequired(false) + .HasField("_details") + .HasSentinel("") + .UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction) + .HasMaxLength(64) + .HasPrecision(3, 2) + .HasAnnotation("foo", "bar"); + eb.Ignore(e => e.Context); + eb.ComplexProperty( + o => o.Principal, cb => + { + cb.Property("FlagsEnum2"); + cb.Ignore(e => e.Deriveds); + }); + }); + }); - modelBuilder.Entity>>( - eb => - { - eb.ComplexCollection, OwnedType>( - "ManyOwned", "OwnedCollection", eb => - { - eb.UsePropertyAccessMode(PropertyAccessMode.Field) - .HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues) - .HasPropertyAnnotation("goo", "ber") - .HasTypeAnnotation("go", "brr"); - eb.Property(c => c.Details) - .IsUnicode(false) - .IsRequired(false) - .HasField("_details") - .HasSentinel("") - .UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction) - .HasAnnotation("foo", "bar"); - eb.Ignore(e => e.Context); - eb.ComplexProperty( - o => o.Principal, cb => - { - cb.Property("FlagsEnum2"); - cb.Ignore(e => e.Deriveds); - }); - }); - eb.Ignore(p => p.Dependent); - eb.Ignore(p => p.Principals); - }); + modelBuilder.Entity>>(eb => + { + eb.ComplexCollection, OwnedType>( + "ManyOwned", "OwnedCollection", eb => + { + eb.UsePropertyAccessMode(PropertyAccessMode.Field) + .HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues) + .HasPropertyAnnotation("goo", "ber") + .HasTypeAnnotation("go", "brr"); + eb.Property(c => c.Details) + .IsUnicode(false) + .IsRequired(false) + .HasField("_details") + .HasSentinel("") + .UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction) + .HasAnnotation("foo", "bar"); + eb.Ignore(e => e.Context); + eb.ComplexProperty( + o => o.Principal, cb => + { + cb.Property("FlagsEnum2"); + cb.Ignore(e => e.Deriveds); + }); + }); + eb.Ignore(p => p.Dependent); + eb.Ignore(p => p.Principals); + }); } protected virtual void AssertComplexTypes(IModel model) @@ -1317,6 +1292,7 @@ protected virtual void AssertComplexTypes(IModel model) { return; } + Assert.Equal(principalBase, principalDerived.BaseType); var complexCollection = principalDerived.GetDeclaredComplexProperties().Single(); @@ -2090,10 +2066,9 @@ protected virtual Task Test( { Assert.Equal( expectedExceptionMessage, - Assert.Throws( - () => generator.GenerateModel( - model, - options)).Message); + Assert.Throws(() => generator.GenerateModel( + model, + options)).Message); return (null, null); } diff --git a/test/EFCore.Specification.Tests/SeedingTestBase.cs b/test/EFCore.Specification.Tests/SeedingTestBase.cs index 608de122221..d64124f7cc6 100644 --- a/test/EFCore.Specification.Tests/SeedingTestBase.cs +++ b/test/EFCore.Specification.Tests/SeedingTestBase.cs @@ -9,9 +9,7 @@ namespace Microsoft.EntityFrameworkCore; public abstract class SeedingTestBase { - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Seeding_does_not_leave_context_contaminated(bool async) { using var context = CreateContextWithEmptyDatabase(async ? "1A" : "1S"); @@ -30,20 +28,17 @@ public virtual async Task Seeding_does_not_leave_context_contaminated(bool async Assert.Equal("Orange", seeds[1].Species); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Seeding_keyless_entity_throws_exception(bool async) { - var exception = await Assert.ThrowsAsync( - async () => - { - using var context = CreateKeylessContextWithEmptyDatabase(); - await TestStore.CleanAsync(context); - var _ = async - ? await context.Database.EnsureCreatedResilientlyAsync() - : context.Database.EnsureCreatedResiliently(); - }); + var exception = await Assert.ThrowsAsync(async () => + { + using var context = CreateKeylessContextWithEmptyDatabase(); + await TestStore.CleanAsync(context); + var _ = async + ? await context.Database.EnsureCreatedResilientlyAsync() + : context.Database.EnsureCreatedResiliently(); + }); Assert.Equal(CoreStrings.SeedKeylessEntity(nameof(KeylessSeed)), exception.Message); } diff --git a/test/EFCore.Specification.Tests/SerializationTestBase.cs b/test/EFCore.Specification.Tests/SerializationTestBase.cs index 4c27ff07ad6..65a8d1a3571 100644 --- a/test/EFCore.Specification.Tests/SerializationTestBase.cs +++ b/test/EFCore.Specification.Tests/SerializationTestBase.cs @@ -16,13 +16,8 @@ public abstract class SerializationTestBase(TFixture fixture) : IClass { protected TFixture Fixture { get; } = fixture; - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(false, false, true)] - [InlineData(true, true, false)] - [InlineData(true, true, true)] - [InlineData(true, false, false)] - [InlineData(true, false, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(false, false, true), InlineData(true, true, false), + InlineData(true, true, true), InlineData(true, false, false), InlineData(true, false, true)] public virtual void Can_round_trip_through_JSON(bool useNewtonsoft, bool ignoreLoops, bool writeIndented) { using var context = Fixture.CreateContext(); diff --git a/test/EFCore.Specification.Tests/SharedStoreFixtureBase.cs b/test/EFCore.Specification.Tests/SharedStoreFixtureBase.cs index 6fed8e56418..149bc04ea35 100644 --- a/test/EFCore.Specification.Tests/SharedStoreFixtureBase.cs +++ b/test/EFCore.Specification.Tests/SharedStoreFixtureBase.cs @@ -61,9 +61,8 @@ public virtual async Task InitializeAsync() _createDbContext = typeof(IDbContextFactory<>).MakeGenericType(ContextType) .GetTypeInfo().GetDeclaredMethods(nameof(IDbContextFactory.CreateDbContext)) - .Single( - mi => mi.GetParameters().Length == 0 - && mi.GetGenericArguments().Length == 0); + .Single(mi => mi.GetParameters().Length == 0 + && mi.GetGenericArguments().Length == 0); } _serviceProvider = services.BuildServiceProvider(validateScopes: true); diff --git a/test/EFCore.Specification.Tests/SingletonInterceptorsTestBase.cs b/test/EFCore.Specification.Tests/SingletonInterceptorsTestBase.cs index b8480ef2757..5db3b578f45 100644 --- a/test/EFCore.Specification.Tests/SingletonInterceptorsTestBase.cs +++ b/test/EFCore.Specification.Tests/SingletonInterceptorsTestBase.cs @@ -5,7 +5,8 @@ namespace Microsoft.EntityFrameworkCore; -public abstract class SingletonInterceptorsTestBase(NonSharedFixture fixture) : NonSharedModelTestBase(fixture), IClassFixture +public abstract class SingletonInterceptorsTestBase(NonSharedFixture fixture) + : NonSharedModelTestBase(fixture), IClassFixture where TContext : SingletonInterceptorsTestBase.LibraryContext { protected class Book @@ -51,17 +52,15 @@ public abstract class LibraryContext(DbContextOptions options) : PoolableDbConte { protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity( - b => - { - b.Property("Author"); - }); - - modelBuilder.Entity( - b => - { - b.Property("Author"); - }); + modelBuilder.Entity(b => + { + b.Property("Author"); + }); + + modelBuilder.Entity(b => + { + b.Property("Author"); + }); } } diff --git a/test/EFCore.Specification.Tests/SpatialFixtureBase.cs b/test/EFCore.Specification.Tests/SpatialFixtureBase.cs index 3373505a621..d7f972a084c 100644 --- a/test/EFCore.Specification.Tests/SpatialFixtureBase.cs +++ b/test/EFCore.Specification.Tests/SpatialFixtureBase.cs @@ -22,12 +22,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).ValueGeneratedNever(); - b.Property(e => e.Location).HasConversion(new GeoPointConverter(_geometryFactory)); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).ValueGeneratedNever(); + b.Property(e => e.Location).HasConversion(new GeoPointConverter(_geometryFactory)); + }); } protected override Task SeedAsync(SpatialContext context) diff --git a/test/EFCore.Specification.Tests/StoreGeneratedFixupTestBase.cs b/test/EFCore.Specification.Tests/StoreGeneratedFixupTestBase.cs index 69d3139abb7..2a4049a2f48 100644 --- a/test/EFCore.Specification.Tests/StoreGeneratedFixupTestBase.cs +++ b/test/EFCore.Specification.Tests/StoreGeneratedFixupTestBase.cs @@ -19,276 +19,262 @@ public abstract class StoreGeneratedFixupTestBase(TFixture fixture) : [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_FK_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product - { - Id1 = -78, - Id2 = Guid78, - Category = principal, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; - principal.Products.Add(dependent); + Id1 = -78, + Id2 = Guid78, + Category = principal, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; + principal.Products.Add(dependent); - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_FK_not_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Category(); - var dependent = new Product { Category = principal }; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category(); + var dependent = new Product { Category = principal }; - principal.Products.Add(dependent); + principal.Products.Add(dependent); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; - principal.Products.Add(dependent); + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; + principal.Products.Add(dependent); - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2, - Category = principal - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2, + Category = principal + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Category(); - var dependent = new Product(); - principal.Products.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category(); + var dependent = new Product(); + principal.Products.Add(dependent); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Category(); - var dependent = new Product { Category = principal }; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category(); + var dependent = new Product { Category = principal }; - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_FK_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product - { - Id1 = -78, - Id2 = Guid78, - Category = principal, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; - principal.Products.Add(dependent); + Id1 = -78, + Id2 = Guid78, + Category = principal, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; + principal.Products.Add(dependent); - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_FK_not_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Category(); - var dependent = new Product { Category = principal }; - principal.Products.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category(); + var dependent = new Product { Category = principal }; + principal.Products.Add(dependent); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; - principal.Products.Add(dependent); + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; + principal.Products.Add(dependent); - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2, - Category = principal - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2, + Category = principal + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Category(); - var dependent = new Product(); - principal.Products.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category(); + var dependent = new Product(); + principal.Products.Add(dependent); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Category(); - var dependent = new Product { Category = principal }; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Category(); + var dependent = new Product { Category = principal }; - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); private async Task AssertFixupAndSaveAsync(DbContext context, Category principal, Product dependent) { @@ -327,123 +313,117 @@ private async Task AssertFixupAndSaveAsync(DbContext context, Category principal [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_prin_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductPN { - var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductPN - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_prin_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductPN { - var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductPN - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_prin_uni_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductPN { - var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductPN - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; - principal.Products.Add(dependent); + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; + principal.Products.Add(dependent); - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_prin_uni_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new CategoryPN(); - var dependent = new ProductPN(); - principal.Products.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryPN(); + var dependent = new ProductPN(); + principal.Products.Add(dependent); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_prin_uni_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductPN { - var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductPN - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; - principal.Products.Add(dependent); + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; + principal.Products.Add(dependent); - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_prin_uni_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new CategoryPN(); - var dependent = new ProductPN(); - principal.Products.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryPN(); + var dependent = new ProductPN(); + principal.Products.Add(dependent); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); private async Task AssertFixupAndSaveAsync(DbContext context, CategoryPN principal, ProductPN dependent) { @@ -480,121 +460,115 @@ private async Task AssertFixupAndSaveAsync(DbContext context, CategoryPN princip [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_dep_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductDN { - var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductDN - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_dep_uni_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductDN { - var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductDN - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2, - Category = principal - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2, + Category = principal + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_dep_uni_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new CategoryDN(); - var dependent = new ProductDN { Category = principal }; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryDN(); + var dependent = new ProductDN { Category = principal }; - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_dep_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductDN { - var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductDN - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_dep_uni_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductDN { - var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductDN - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2, - Category = principal - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2, + Category = principal + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_dep_uni_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new CategoryDN(); - var dependent = new ProductDN { Category = principal }; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryDN(); + var dependent = new ProductDN { Category = principal }; - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); private async Task AssertFixupAndSaveAsync(DbContext context, CategoryDN principal, ProductDN dependent) { @@ -631,47 +605,45 @@ private async Task AssertFixupAndSaveAsync(DbContext context, CategoryDN princip [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_many_no_navs_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryNN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductNN { - var principal = new CategoryNN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductNN - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_many_no_navs_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new CategoryNN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductNN { - var principal = new CategoryNN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductNN - { - Id1 = -78, - Id2 = Guid78, - CategoryId1 = principal.Id1, - CategoryId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + CategoryId1 = principal.Id1, + CategoryId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); private async Task AssertFixupAndSaveAsync(DbContext context, CategoryNN principal, ProductNN dependent) { @@ -700,275 +672,261 @@ private async Task AssertFixupAndSaveAsync(DbContext context, CategoryNN princip [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_FK_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child - { - Id1 = -78, - Id2 = Guid78, - Parent = principal, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; - principal.Child = dependent; + Id1 = -78, + Id2 = Guid78, + Parent = principal, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; + principal.Child = dependent; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_FK_not_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Parent(); - var dependent = new Child { Parent = principal }; - principal.Child = dependent; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent(); + var dependent = new Child { Parent = principal }; + principal.Child = dependent; - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; - principal.Child = dependent; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; + principal.Child = dependent; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2, - Parent = principal - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2, + Parent = principal + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Parent(); - var dependent = new Child(); - principal.Child = dependent; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent(); + var dependent = new Child(); + principal.Child = dependent; - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Parent(); - var dependent = new Child { Parent = principal }; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent(); + var dependent = new Child { Parent = principal }; - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_FK_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child - { - Id1 = -78, - Id2 = Guid78, - Parent = principal, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; - principal.Child = dependent; + Id1 = -78, + Id2 = Guid78, + Parent = principal, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; + principal.Child = dependent; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_FK_not_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Parent(); - var dependent = new Child { Parent = principal }; - principal.Child = dependent; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent(); + var dependent = new Child { Parent = principal }; + principal.Child = dependent; - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; - principal.Child = dependent; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; + principal.Child = dependent; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2, - Parent = principal - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2, + Parent = principal + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Parent(); - var dependent = new Child(); - principal.Child = dependent; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent(); + var dependent = new Child(); + principal.Child = dependent; - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new Parent(); - var dependent = new Child { Parent = principal }; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new Parent(); + var dependent = new Child { Parent = principal }; - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); private async Task AssertFixupAndSaveAsync(DbContext context, Parent principal, Child dependent) { @@ -1007,123 +965,117 @@ private async Task AssertFixupAndSaveAsync(DbContext context, Parent principal, [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_prin_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildPN { - var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildPN - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_prin_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildPN { - var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildPN - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_prin_uni_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildPN { - var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildPN - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; - principal.Child = dependent; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; + principal.Child = dependent; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_prin_uni_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new ParentPN(); - var dependent = new ChildPN(); - principal.Child = dependent; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentPN(); + var dependent = new ChildPN(); + principal.Child = dependent; - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_prin_uni_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildPN { - var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildPN - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; - principal.Child = dependent; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; + principal.Child = dependent; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_prin_uni_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new ParentPN(); - var dependent = new ChildPN(); - principal.Child = dependent; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentPN(); + var dependent = new ChildPN(); + principal.Child = dependent; - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); private async Task AssertFixupAndSaveAsync(DbContext context, ParentPN principal, ChildPN dependent) { @@ -1160,123 +1112,117 @@ private async Task AssertFixupAndSaveAsync(DbContext context, ParentPN principal [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_dep_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildDN { - var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildDN - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_dep_uni_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildDN { - var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildDN - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2, - Parent = principal - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2, + Parent = principal + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_dep_uni_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new ParentDN(); - var dependent = new ChildDN { Parent = principal }; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentDN(); + var dependent = new ChildDN { Parent = principal }; - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_dep_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildDN { - var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildDN - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_dep_uni_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildDN { - var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildDN - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2, - Parent = principal - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2, + Parent = principal + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_dep_uni_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var principal = new ParentDN(); - var dependent = new ChildDN { Parent = principal }; + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentDN(); + var dependent = new ChildDN { Parent = principal }; - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); private async Task AssertFixupAndSaveAsync(DbContext context, ParentDN principal, ChildDN dependent) { @@ -1313,47 +1259,45 @@ private async Task AssertFixupAndSaveAsync(DbContext context, ParentDN principal [ConditionalFact] public virtual Task Add_dependent_then_principal_one_to_one_no_navs_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentNN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildNN { - var principal = new ParentNN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildNN - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); - context.Add(principal); + context.Add(dependent); + context.Add(principal); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); [ConditionalFact] public virtual Task Add_principal_then_dependent_one_to_one_no_navs_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - context => + => ExecuteWithStrategyInTransactionAsync(context => + { + var principal = new ParentNN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildNN { - var principal = new ParentNN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildNN - { - Id1 = -78, - Id2 = Guid78, - ParentId1 = principal.Id1, - ParentId2 = principal.Id2 - }; + Id1 = -78, + Id2 = Guid78, + ParentId1 = principal.Id1, + ParentId2 = principal.Id2 + }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); - context.Add(dependent); + context.Add(principal); + context.Add(dependent); - return AssertFixupAndSaveAsync(context, principal, dependent); - }); + return AssertFixupAndSaveAsync(context, principal, dependent); + }); private async Task AssertFixupAndSaveAsync(DbContext context, ParentNN principal, ChildNN dependent) { @@ -1382,2562 +1326,2503 @@ private async Task AssertFixupAndSaveAsync(DbContext context, ParentNN principal [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_FK_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); + context.Add(dependent); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - dependent.Category = principal; - principal.Products.Add(dependent); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + dependent.Category = principal; + principal.Products.Add(dependent); - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_FK_not_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category(); - var dependent = new Product(); - - context.Add(dependent); - - dependent.Category = principal; - principal.Products.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category(); + var dependent = new Product(); - context.ChangeTracker.DetectChanges(); + context.Add(dependent); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.CategoryId1).CurrentValue); + dependent.Category = principal; + principal.Products.Add(dependent); - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.CategoryId2).CurrentValue); + context.ChangeTracker.DetectChanges(); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.CategoryId1).CurrentValue); + + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.CategoryId2).CurrentValue); + + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Null(dependent.Category); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Null(dependent.Category); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Null(dependent.Category); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Null(dependent.Category); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - principal.Products.Add(dependent); + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + principal.Products.Add(dependent); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Null(dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Null(dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Null(dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Null(dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); + context.Add(dependent); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - dependent.Category = principal; + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + dependent.Category = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category(); - var dependent = new Product(); - - context.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category(); + var dependent = new Product(); - principal.Products.Add(dependent); + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + principal.Products.Add(dependent); - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.CategoryId1); - Assert.Null(dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) - { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.CategoryId1); - Assert.Null(dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(0, dependent.CategoryId1); + Assert.Null(dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - [ConditionalFact] - public virtual Task Add_dependent_but_not_principal_one_to_many_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => + if (EnforcesFKs) { - var principal = new Category(); - var dependent = new Product(); + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } - context.Add(dependent); + AssertFixup( + context, + () => + { + Assert.Equal(0, dependent.CategoryId1); + Assert.Null(dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); - dependent.Category = principal; + [ConditionalFact] + public virtual Task Add_dependent_but_not_principal_one_to_many_FK_not_set_dependent_nav_set() + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category(); + var dependent = new Product(); - context.ChangeTracker.DetectChanges(); + context.Add(dependent); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.CategoryId1).CurrentValue); + dependent.Category = principal; - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.CategoryId2).CurrentValue); + context.ChangeTracker.DetectChanges(); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.CategoryId1).CurrentValue); + + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.CategoryId2).CurrentValue); + + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_FK_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - dependent.Category = principal; - principal.Products.Add(dependent); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + dependent.Category = principal; + principal.Products.Add(dependent); - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_FK_not_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category(); - var dependent = new Product(); - - context.Add(principal); - - dependent.Category = principal; - principal.Products.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category(); + var dependent = new Product(); - context.ChangeTracker.DetectChanges(); + context.Add(principal); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.CategoryId1).CurrentValue); + dependent.Category = principal; + principal.Products.Add(dependent); - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.CategoryId2).CurrentValue); + context.ChangeTracker.DetectChanges(); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.CategoryId1).CurrentValue); + + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.CategoryId2).CurrentValue); + + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Null(dependent.Category); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Null(dependent.Category); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Null(dependent.Category); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Null(dependent.Category); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - principal.Products.Add(dependent); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + principal.Products.Add(dependent); - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category { Id1 = -77, Id2 = Guid77 }; - var dependent = new Product { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category { Id1 = -77, Id2 = Guid77 }; + var dependent = new Product { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - dependent.Category = principal; + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + dependent.Category = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Same(principal, dependent.Category); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Same(principal, dependent.Category); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category(); - var dependent = new Product(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category(); + var dependent = new Product(); - context.Add(principal); + context.Add(principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - principal.Products.Add(dependent); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + principal.Products.Add(dependent); - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Category(); - var dependent = new Product(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Category(); + var dependent = new Product(); - context.Add(principal); + context.Add(principal); - dependent.Category = principal; + dependent.Category = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.CategoryId1); - Assert.Same(principal, dependent.Category); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(0, dependent.CategoryId1); + Assert.Same(principal, dependent.Category); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.CategoryId1); - Assert.Same(principal, dependent.Category); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(0, dependent.CategoryId1); + Assert.Same(principal, dependent.Category); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_prin_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductPN { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductPN { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_prin_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductPN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductPN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Empty(principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Empty(principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_prin_uni_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductPN { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductPN { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - principal.Products.Add(dependent); + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + principal.Products.Add(dependent); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_prin_uni_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryPN(); - var dependent = new ProductPN(); - - context.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryPN(); + var dependent = new ProductPN(); - principal.Products.Add(dependent); + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + principal.Products.Add(dependent); - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.CategoryId1); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(0, dependent.CategoryId1); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.CategoryId1); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(0, dependent.CategoryId1); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_prin_uni_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductPN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductPN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - principal.Products.Add(dependent); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + principal.Products.Add(dependent); - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_prin_uni_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryPN(); - var dependent = new ProductPN(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryPN(); + var dependent = new ProductPN(); - context.Add(principal); + context.Add(principal); - principal.Products.Add(dependent); + principal.Products.Add(dependent); - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.CategoryId1).CurrentValue); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.CategoryId1).CurrentValue); - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.CategoryId2).CurrentValue); + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.CategoryId2).CurrentValue); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Equal(new[] { dependent }.ToList(), principal.Products); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Equal(new[] { dependent }.ToList(), principal.Products); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_dep_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductDN { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductDN { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Null(dependent.Category); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Null(dependent.Category); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Null(dependent.Category); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Null(dependent.Category); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_dep_uni_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductDN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductDN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); + context.Add(dependent); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - dependent.Category = principal; + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + dependent.Category = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_dep_uni_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryDN(); - var dependent = new ProductDN(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryDN(); + var dependent = new ProductDN(); - context.Add(dependent); + context.Add(dependent); - dependent.Category = principal; + dependent.Category = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.CategoryId1).CurrentValue); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.CategoryId1).CurrentValue); - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.CategoryId2).CurrentValue); + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.CategoryId2).CurrentValue); - Assert.Same(principal, dependent.Category); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + Assert.Same(principal, dependent.Category); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_dep_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductDN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductDN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Null(dependent.Category); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Null(dependent.Category); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Null(dependent.Category); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Null(dependent.Category); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_dep_uni_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductDN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductDN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; - dependent.Category = principal; + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; + dependent.Category = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Same(principal, dependent.Category); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Same(principal, dependent.Category); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Same(principal, dependent.Category); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Same(principal, dependent.Category); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_dep_uni_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryDN(); - var dependent = new ProductDN(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryDN(); + var dependent = new ProductDN(); - context.Add(principal); + context.Add(principal); - dependent.Category = principal; + dependent.Category = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.CategoryId1); - Assert.Same(principal, dependent.Category); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(0, dependent.CategoryId1); + Assert.Same(principal, dependent.Category); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.CategoryId1); - Assert.Same(principal, dependent.Category); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(0, dependent.CategoryId1); + Assert.Same(principal, dependent.Category); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_many_no_navs_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryNN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductNN { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryNN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductNN { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_many_no_navs_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new CategoryNN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ProductNN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new CategoryNN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ProductNN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.CategoryId1 = principal.Id1; - dependent.CategoryId2 = principal.Id2; + dependent.CategoryId1 = principal.Id1; + dependent.CategoryId2 = principal.Id2; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.CategoryId1); - Assert.Equal(principal.Id2, dependent.CategoryId2); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.CategoryId1); + Assert.Equal(principal.Id2, dependent.CategoryId2); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_FK_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); + context.Add(dependent); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; - dependent.Parent = principal; - principal.Child = dependent; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; + dependent.Parent = principal; + principal.Child = dependent; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_FK_not_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent(); - var dependent = new Child(); - - context.Add(dependent); - - dependent.Parent = principal; - principal.Child = dependent; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent(); + var dependent = new Child(); - context.ChangeTracker.DetectChanges(); + context.Add(dependent); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); + dependent.Parent = principal; + principal.Child = dependent; - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); + context.ChangeTracker.DetectChanges(); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); + + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); + + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(dependent.Parent); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(dependent.Parent); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(dependent.Parent); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(dependent.Parent); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; - principal.Child = dependent; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; + principal.Child = dependent; - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); + context.Add(dependent); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; - dependent.Parent = principal; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; + dependent.Parent = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent(); - var dependent = new Child(); - - context.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent(); + var dependent = new Child(); - principal.Child = dependent; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + principal.Child = dependent; - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.ParentId1); - Assert.Null(dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) - { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.ParentId1); - Assert.Null(dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(0, dependent.ParentId1); + Assert.Null(dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - [ConditionalFact] - public virtual Task Add_dependent_but_not_principal_one_to_one_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => + if (EnforcesFKs) { - var principal = new Parent(); - var dependent = new Child(); + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } - context.Add(dependent); + AssertFixup( + context, + () => + { + Assert.Equal(0, dependent.ParentId1); + Assert.Null(dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); - dependent.Parent = principal; + [ConditionalFact] + public virtual Task Add_dependent_but_not_principal_one_to_one_FK_not_set_dependent_nav_set() + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent(); + var dependent = new Child(); - context.ChangeTracker.DetectChanges(); + context.Add(dependent); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); + dependent.Parent = principal; - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); + context.ChangeTracker.DetectChanges(); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); + + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); + + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_FK_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; - dependent.Parent = principal; - principal.Child = dependent; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; + dependent.Parent = principal; + principal.Child = dependent; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_FK_not_set_both_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent(); - var dependent = new Child(); - - context.Add(principal); - - dependent.Parent = principal; - principal.Child = dependent; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent(); + var dependent = new Child(); - context.ChangeTracker.DetectChanges(); + context.Add(principal); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); + dependent.Parent = principal; + principal.Child = dependent; - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); + context.ChangeTracker.DetectChanges(); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); + + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); + + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(dependent.Parent); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(dependent.Parent); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Null(dependent.Parent); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Null(dependent.Parent); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; - principal.Child = dependent; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; + principal.Child = dependent; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent { Id1 = -77, Id2 = Guid77 }; - var dependent = new Child { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent { Id1 = -77, Id2 = Guid77 }; + var dependent = new Child { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; - dependent.Parent = principal; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; + dependent.Parent = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Same(principal, dependent.Parent); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Same(principal, dependent.Parent); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent(); - var dependent = new Child(); - - context.Add(principal); - - principal.Child = dependent; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent(); + var dependent = new Child(); - context.ChangeTracker.DetectChanges(); + context.Add(principal); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); + principal.Child = dependent; - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); + context.ChangeTracker.DetectChanges(); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); + + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); + + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new Parent(); - var dependent = new Child(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new Parent(); + var dependent = new Child(); - context.Add(principal); + context.Add(principal); - dependent.Parent = principal; + dependent.Parent = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.ParentId1); - Assert.Same(principal, dependent.Parent); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(0, dependent.ParentId1); + Assert.Same(principal, dependent.Parent); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.ParentId1); - Assert.Same(principal, dependent.Parent); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(0, dependent.ParentId1); + Assert.Same(principal, dependent.Parent); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_prin_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildPN { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildPN { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_prin_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildPN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildPN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Null(principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Null(principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_prin_uni_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildPN { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildPN { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; - principal.Child = dependent; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; + principal.Child = dependent; - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_prin_uni_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentPN(); - var dependent = new ChildPN(); - - context.Add(dependent); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentPN(); + var dependent = new ChildPN(); - principal.Child = dependent; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + principal.Child = dependent; - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.ParentId1); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(0, dependent.ParentId1); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.ParentId1); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(0, dependent.ParentId1); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_prin_uni_FK_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildPN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentPN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildPN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; - principal.Child = dependent; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; + principal.Child = dependent; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_prin_uni_FK_not_set_principal_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentPN(); - var dependent = new ChildPN(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentPN(); + var dependent = new ChildPN(); - context.Add(principal); + context.Add(principal); - principal.Child = dependent; + principal.Child = dependent; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(dependent, principal.Child); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(dependent, principal.Child); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_dep_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildDN { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildDN { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(dependent.Parent); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(dependent.Parent); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(dependent.Parent); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(dependent.Parent); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_dep_uni_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildDN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildDN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(dependent); + context.Add(dependent); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; - dependent.Parent = principal; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; + dependent.Parent = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_dep_uni_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentDN(); - var dependent = new ChildDN(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentDN(); + var dependent = new ChildDN(); - context.Add(dependent); + context.Add(dependent); - dependent.Parent = principal; + dependent.Parent = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal( - context.Entry(principal).Property(e => e.Id1).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); + AssertFixup( + context, + () => + { + Assert.Equal( + context.Entry(principal).Property(e => e.Id1).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId1).CurrentValue); - Assert.Equal( - context.Entry(principal).Property(e => e.Id2).CurrentValue, - context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); + Assert.Equal( + context.Entry(principal).Property(e => e.Id2).CurrentValue, + context.Entry(dependent).Property(e => e.ParentId2).CurrentValue); - Assert.Same(principal, dependent.Parent); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + Assert.Same(principal, dependent.Parent); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_dep_uni_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildDN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildDN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Null(dependent.Parent); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Null(dependent.Parent); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Null(dependent.Parent); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Null(dependent.Parent); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_dep_uni_FK_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildDN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentDN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildDN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; - dependent.Parent = principal; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; + dependent.Parent = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Same(principal, dependent.Parent); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Same(principal, dependent.Parent); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Same(principal, dependent.Parent); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Same(principal, dependent.Parent); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_dep_uni_FK_not_set_dependent_nav_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentDN(); - var dependent = new ChildDN(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentDN(); + var dependent = new ChildDN(); - context.Add(principal); + context.Add(principal); - dependent.Parent = principal; + dependent.Parent = principal; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.ParentId1); - Assert.Same(principal, dependent.Parent); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(0, dependent.ParentId1); + Assert.Same(principal, dependent.Parent); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(0, dependent.ParentId1); - Assert.Same(principal, dependent.Parent); - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(0, dependent.ParentId1); + Assert.Same(principal, dependent.Parent); + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_dependent_but_not_principal_one_to_one_no_navs_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentNN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildNN { Id1 = -78, Id2 = Guid78 }; - - MarkIdsTemporary(context, dependent, principal); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentNN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildNN { Id1 = -78, Id2 = Guid78 }; - context.Add(dependent); + MarkIdsTemporary(context, dependent, principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; + context.Add(dependent); - context.ChangeTracker.DetectChanges(); + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EntityState.Added, context.Entry(dependent).State); - }); + context.ChangeTracker.DetectChanges(); - if (EnforcesFKs) + AssertFixup( + context, + () => { - await Assert.ThrowsAsync(() => context.SaveChangesAsync()); - } - else + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EntityState.Added, context.Entry(dependent).State); + }); + + if (EnforcesFKs) + { + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); + } + else + { + await context.SaveChangesAsync(); + } + + AssertFixup( + context, + () => { - await context.SaveChangesAsync(); - } - - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Equal(EntityState.Detached, context.Entry(principal).State); - Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); - }); - }); + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Equal(EntityState.Detached, context.Entry(principal).State); + Assert.Equal(EnforcesFKs ? EntityState.Added : EntityState.Unchanged, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_principal_but_not_dependent_one_to_one_no_navs_FK_set_no_navs_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var principal = new ParentNN { Id1 = -77, Id2 = Guid77 }; - var dependent = new ChildNN { Id1 = -78, Id2 = Guid78 }; + => ExecuteWithStrategyInTransactionAsync(async context => + { + var principal = new ParentNN { Id1 = -77, Id2 = Guid77 }; + var dependent = new ChildNN { Id1 = -78, Id2 = Guid78 }; - MarkIdsTemporary(context, dependent, principal); + MarkIdsTemporary(context, dependent, principal); - context.Add(principal); + context.Add(principal); - dependent.ParentId1 = principal.Id1; - dependent.ParentId2 = principal.Id2; + dependent.ParentId1 = principal.Id1; + dependent.ParentId2 = principal.Id2; - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - AssertFixup( - context, - () => - { - Assert.Equal(principal.Id1, dependent.ParentId1); - Assert.Equal(principal.Id2, dependent.ParentId2); - Assert.Equal(EntityState.Added, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); + AssertFixup( + context, + () => + { + Assert.Equal(principal.Id1, dependent.ParentId1); + Assert.Equal(principal.Id2, dependent.ParentId2); + Assert.Equal(EntityState.Added, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertFixup( - context, - () => - { - Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); - Assert.Equal(EntityState.Detached, context.Entry(dependent).State); - }); - }); + AssertFixup( + context, + () => + { + Assert.Equal(EntityState.Unchanged, context.Entry(principal).State); + Assert.Equal(EntityState.Detached, context.Entry(dependent).State); + }); + }); [ConditionalFact] public virtual Task Add_overlapping_graph_from_level() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var game = new Game { Id = Guid77 }; - var level = new Level { Id = -77, Game = game }; - var item = new Item { Id = 78 }; - level.Items.Add(item); + => ExecuteWithStrategyInTransactionAsync(context => + { + var game = new Game { Id = Guid77 }; + var level = new Level { Id = -77, Game = game }; + var item = new Item { Id = 78 }; + level.Items.Add(item); - MarkIdsTemporary(context, game, level, item); + MarkIdsTemporary(context, game, level, item); - context.Add(level); + context.Add(level); - return AssertFixupAndSaveAsync(context, game, level, item); - }); + return AssertFixupAndSaveAsync(context, game, level, item); + }); [ConditionalFact] public virtual Task Add_overlapping_graph_from_game() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var level = new Level { Id = -77 }; - var game = new Game { Id = Guid77 }; - game.Levels.Add(level); - var item = new Item { Id = 78 }; - level.Items.Add(item); + => ExecuteWithStrategyInTransactionAsync(context => + { + var level = new Level { Id = -77 }; + var game = new Game { Id = Guid77 }; + game.Levels.Add(level); + var item = new Item { Id = 78 }; + level.Items.Add(item); - MarkIdsTemporary(context, game, level, item); + MarkIdsTemporary(context, game, level, item); - context.Add(game); + context.Add(game); - return AssertFixupAndSaveAsync(context, game, level, item); - }); + return AssertFixupAndSaveAsync(context, game, level, item); + }); [ConditionalFact] public virtual Task Add_overlapping_graph_from_item() - => ExecuteWithStrategyInTransactionAsync( - context => - { - var game = new Game { Id = Guid77 }; - var level = new Level { Id = -77, Game = game }; - var item = new Item { Id = 78, Level = level }; + => ExecuteWithStrategyInTransactionAsync(context => + { + var game = new Game { Id = Guid77 }; + var level = new Level { Id = -77, Game = game }; + var item = new Item { Id = 78, Level = level }; - MarkIdsTemporary(context, game, level, item); + MarkIdsTemporary(context, game, level, item); - context.Add(item); + context.Add(item); - return AssertFixupAndSaveAsync(context, game, level, item); - }); + return AssertFixupAndSaveAsync(context, game, level, item); + }); [ConditionalFact] public virtual void Temporary_value_equals_database_generated_value() @@ -4023,46 +3908,45 @@ public virtual void Remove_overlapping_principal() [ConditionalFact] public virtual Task Multi_level_add_replace_and_save() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var firstLevel = await context.Set().SingleAsync(); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var firstLevel = await context.Set().SingleAsync(); - AddData(firstLevel); + AddData(firstLevel); - var originalSecondLevels = firstLevel.SecondLevels.ToArray(); - var originalThirdLevels = originalSecondLevels.SelectMany(e => e.ThirdLevels).ToArray(); + var originalSecondLevels = firstLevel.SecondLevels.ToArray(); + var originalThirdLevels = originalSecondLevels.SelectMany(e => e.ThirdLevels).ToArray(); - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - Assert.Single(context.ChangeTracker.Entries()); - Assert.Equal(2, context.ChangeTracker.Entries().Count()); - Assert.Equal(4, context.ChangeTracker.Entries().Count()); + Assert.Single(context.ChangeTracker.Entries()); + Assert.Equal(2, context.ChangeTracker.Entries().Count()); + Assert.Equal(4, context.ChangeTracker.Entries().Count()); - AssertValidFks(context, firstLevel, tempKeys: true); + AssertValidFks(context, firstLevel, tempKeys: true); - AddData(firstLevel); + AddData(firstLevel); - context.ChangeTracker.DetectChanges(); + context.ChangeTracker.DetectChanges(); - Assert.Single(context.ChangeTracker.Entries()); - Assert.Equal(2, context.ChangeTracker.Entries().Count()); - Assert.Equal(4, context.ChangeTracker.Entries().Count()); + Assert.Single(context.ChangeTracker.Entries()); + Assert.Equal(2, context.ChangeTracker.Entries().Count()); + Assert.Equal(4, context.ChangeTracker.Entries().Count()); - AssertValidFks(context, firstLevel, tempKeys: true); + AssertValidFks(context, firstLevel, tempKeys: true); - Assert.All( - originalSecondLevels.Select(l => context.Entry(l).State), - s => Assert.Equal(EntityState.Detached, s)); + Assert.All( + originalSecondLevels.Select(l => context.Entry(l).State), + s => Assert.Equal(EntityState.Detached, s)); - Assert.All( - originalThirdLevels.Select(l => context.Entry(l).State), - s => Assert.Equal(EntityState.Detached, s)); + Assert.All( + originalThirdLevels.Select(l => context.Entry(l).State), + s => Assert.Equal(EntityState.Detached, s)); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - AssertValidFks(context, firstLevel, tempKeys: false); - }); + AssertValidFks(context, firstLevel, tempKeys: false); + }); private static void AssertValidFks(DbContext context, FirstLevel firstLevel, bool tempKeys) { @@ -4358,120 +4242,109 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con { modelBuilder.Entity(); - modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Child) - .WithOne(e => e.Parent) - .HasForeignKey(e => new { e.ParentId1, e.ParentId2 }); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); + b.HasOne(e => e.Child) + .WithOne(e => e.Parent) + .HasForeignKey(e => new { e.ParentId1, e.ParentId2 }); + }); modelBuilder.Entity(b => b.HasKey(e => new { e.Id1, e.Id2 })); - modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne(e => e.Child) - .WithOne() - .HasForeignKey(e => new { e.ParentId1, e.ParentId2 }); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); + b.HasOne(e => e.Child) + .WithOne() + .HasForeignKey(e => new { e.ParentId1, e.ParentId2 }); + }); modelBuilder.Entity(b => b.HasKey(e => new { e.Id1, e.Id2 })); - modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne() - .WithOne(e => e.Parent) - .HasForeignKey(e => new { e.ParentId1, e.ParentId2 }); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); + b.HasOne() + .WithOne(e => e.Parent) + .HasForeignKey(e => new { e.ParentId1, e.ParentId2 }); + }); modelBuilder.Entity(b => b.HasKey(e => new { e.Id1, e.Id2 })); - modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasOne() - .WithOne() - .HasForeignKey(e => new { e.ParentId1, e.ParentId2 }); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); + b.HasOne() + .WithOne() + .HasForeignKey(e => new { e.ParentId1, e.ParentId2 }); + }); modelBuilder.Entity(b => b.HasKey(e => new { e.Id1, e.Id2 })); - modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany() - .WithOne(e => e.Category) - .HasForeignKey(e => new { e.CategoryId1, e.CategoryId2 }); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); + b.HasMany() + .WithOne(e => e.Category) + .HasForeignKey(e => new { e.CategoryId1, e.CategoryId2 }); + }); modelBuilder.Entity(b => b.HasKey(e => new { e.Id1, e.Id2 })); - modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Products) - .WithOne() - .HasForeignKey(e => new { e.CategoryId1, e.CategoryId2 }); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); + b.HasMany(e => e.Products) + .WithOne() + .HasForeignKey(e => new { e.CategoryId1, e.CategoryId2 }); + }); modelBuilder.Entity(b => b.HasKey(e => new { e.Id1, e.Id2 })); - modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany() - .WithOne() - .HasForeignKey(e => new { e.CategoryId1, e.CategoryId2 }); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); + b.HasMany() + .WithOne() + .HasForeignKey(e => new { e.CategoryId1, e.CategoryId2 }); + }); modelBuilder.Entity(b => b.HasKey(e => new { e.Id1, e.Id2 })); - modelBuilder.Entity( - b => - { - b.HasKey(e => new { e.Id1, e.Id2 }); - b.HasMany(e => e.Products) - .WithOne(e => e.Category) - .HasForeignKey(e => new { e.CategoryId1, e.CategoryId2 }); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.Id1, e.Id2 }); + b.HasMany(e => e.Products) + .WithOne(e => e.Category) + .HasForeignKey(e => new { e.CategoryId1, e.CategoryId2 }); + }); modelBuilder.Entity(b => b.HasKey(e => new { e.Id1, e.Id2 })); - modelBuilder.Entity( - eb => - { - eb.Property(g => g.Id).ValueGeneratedNever(); - eb.HasKey(l => new { l.GameId, l.Id }); - }); + modelBuilder.Entity(eb => + { + eb.Property(g => g.Id).ValueGeneratedNever(); + eb.HasKey(l => new { l.GameId, l.Id }); + }); modelBuilder.Entity(); - modelBuilder.Entity( - eb => - { - eb.HasOne(i => i.Level) - .WithMany(l => l.Items) - .HasForeignKey(i => new { i.GameId, i.LevelId }) - .OnDelete(DeleteBehavior.Restrict); - }); + modelBuilder.Entity(eb => + { + eb.HasOne(i => i.Level) + .WithMany(l => l.Items) + .HasForeignKey(i => new { i.GameId, i.LevelId }) + .OnDelete(DeleteBehavior.Restrict); + }); - modelBuilder.Entity( - eb => - { - eb.HasOne(i => i.Level) - .WithMany(l => l.Actors) - .HasForeignKey(i => new { i.GameId, i.LevelId }) - .OnDelete(DeleteBehavior.Restrict); - }); + modelBuilder.Entity(eb => + { + eb.HasOne(i => i.Level) + .WithMany(l => l.Actors) + .HasForeignKey(i => new { i.GameId, i.LevelId }) + .OnDelete(DeleteBehavior.Restrict); + }); modelBuilder .Entity() diff --git a/test/EFCore.Specification.Tests/StoreGeneratedTestBase.cs b/test/EFCore.Specification.Tests/StoreGeneratedTestBase.cs index 2ce9cf634f5..a3b3abd6095 100644 --- a/test/EFCore.Specification.Tests/StoreGeneratedTestBase.cs +++ b/test/EFCore.Specification.Tests/StoreGeneratedTestBase.cs @@ -38,43 +38,30 @@ private Task ValueGenerationPositive(TKey? sentinel) }); } - [ConditionalTheory] - [InlineData(nameof(Anais.NeverThrowBeforeUseAfter))] - [InlineData(nameof(Anais.NeverThrowBeforeIgnoreAfter))] - [InlineData(nameof(Anais.NeverThrowBeforeThrowAfter))] - [InlineData(nameof(Anais.OnAddThrowBeforeUseAfter))] - [InlineData(nameof(Anais.OnAddThrowBeforeIgnoreAfter))] - [InlineData(nameof(Anais.OnAddThrowBeforeThrowAfter))] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeUseAfter))] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeIgnoreAfter))] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeThrowAfter))] - [InlineData(nameof(Anais.OnUpdateThrowBeforeUseAfter))] - [InlineData(nameof(Anais.OnUpdateThrowBeforeIgnoreAfter))] - [InlineData(nameof(Anais.OnUpdateThrowBeforeThrowAfter))] + [ConditionalTheory, InlineData(nameof(Anais.NeverThrowBeforeUseAfter)), InlineData(nameof(Anais.NeverThrowBeforeIgnoreAfter)), + InlineData(nameof(Anais.NeverThrowBeforeThrowAfter)), InlineData(nameof(Anais.OnAddThrowBeforeUseAfter)), + InlineData(nameof(Anais.OnAddThrowBeforeIgnoreAfter)), InlineData(nameof(Anais.OnAddThrowBeforeThrowAfter)), + InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeUseAfter)), InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeIgnoreAfter)), + InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeThrowAfter)), InlineData(nameof(Anais.OnUpdateThrowBeforeUseAfter)), + InlineData(nameof(Anais.OnUpdateThrowBeforeIgnoreAfter)), InlineData(nameof(Anais.OnUpdateThrowBeforeThrowAfter))] public virtual Task Before_save_throw_always_throws_if_value_set(string propertyName) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - context.Add(WithValue(propertyName, Fixture.IntSentinel, Fixture.StringSentinel)); - - Assert.Equal( - CoreStrings.PropertyReadOnlyBeforeSave(propertyName, "Anais"), - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); - - [ConditionalTheory] - [InlineData(nameof(Anais.NeverThrowBeforeUseAfter), null)] - [InlineData(nameof(Anais.NeverThrowBeforeIgnoreAfter), null)] - [InlineData(nameof(Anais.NeverThrowBeforeThrowAfter), null)] - [InlineData(nameof(Anais.OnAddThrowBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddThrowBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddThrowBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateThrowBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateThrowBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateThrowBeforeThrowAfter), "Rabbit")] + => ExecuteWithStrategyInTransactionAsync(async context => + { + context.Add(WithValue(propertyName, Fixture.IntSentinel, Fixture.StringSentinel)); + + Assert.Equal( + CoreStrings.PropertyReadOnlyBeforeSave(propertyName, "Anais"), + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); + + [ConditionalTheory, InlineData(nameof(Anais.NeverThrowBeforeUseAfter), null), + InlineData(nameof(Anais.NeverThrowBeforeIgnoreAfter), null), InlineData(nameof(Anais.NeverThrowBeforeThrowAfter), null), + InlineData(nameof(Anais.OnAddThrowBeforeUseAfter), "Rabbit"), InlineData(nameof(Anais.OnAddThrowBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddThrowBeforeThrowAfter), "Rabbit"), InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeUseAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeThrowAfter), "Rabbit"), + InlineData(nameof(Anais.OnUpdateThrowBeforeUseAfter), "Rabbit"), InlineData(nameof(Anais.OnUpdateThrowBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnUpdateThrowBeforeThrowAfter), "Rabbit")] public virtual Task Before_save_throw_ignores_value_if_not_set(string propertyName, string? expectedValue) { var id = 0; @@ -89,22 +76,13 @@ public virtual Task Before_save_throw_ignores_value_if_not_set(string propertyNa }, async context => Assert.Equal(expectedValue, GetValue((await context.Set().FindAsync(id))!, propertyName))); } - [ConditionalTheory] - [InlineData(nameof(Anais.Never))] - [InlineData(nameof(Anais.OnAdd))] - [InlineData(nameof(Anais.OnUpdate))] - [InlineData(nameof(Anais.NeverUseBeforeUseAfter))] - [InlineData(nameof(Anais.NeverUseBeforeIgnoreAfter))] - [InlineData(nameof(Anais.NeverUseBeforeThrowAfter))] - [InlineData(nameof(Anais.OnAddUseBeforeUseAfter))] - [InlineData(nameof(Anais.OnAddUseBeforeIgnoreAfter))] - [InlineData(nameof(Anais.OnAddUseBeforeThrowAfter))] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeUseAfter))] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeIgnoreAfter))] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeThrowAfter))] - [InlineData(nameof(Anais.OnUpdateUseBeforeUseAfter))] - [InlineData(nameof(Anais.OnUpdateUseBeforeIgnoreAfter))] - [InlineData(nameof(Anais.OnUpdateUseBeforeThrowAfter))] + [ConditionalTheory, InlineData(nameof(Anais.Never)), InlineData(nameof(Anais.OnAdd)), InlineData(nameof(Anais.OnUpdate)), + InlineData(nameof(Anais.NeverUseBeforeUseAfter)), InlineData(nameof(Anais.NeverUseBeforeIgnoreAfter)), + InlineData(nameof(Anais.NeverUseBeforeThrowAfter)), InlineData(nameof(Anais.OnAddUseBeforeUseAfter)), + InlineData(nameof(Anais.OnAddUseBeforeIgnoreAfter)), InlineData(nameof(Anais.OnAddUseBeforeThrowAfter)), + InlineData(nameof(Anais.OnAddOrUpdateUseBeforeUseAfter)), InlineData(nameof(Anais.OnAddOrUpdateUseBeforeIgnoreAfter)), + InlineData(nameof(Anais.OnAddOrUpdateUseBeforeThrowAfter)), InlineData(nameof(Anais.OnUpdateUseBeforeUseAfter)), + InlineData(nameof(Anais.OnUpdateUseBeforeIgnoreAfter)), InlineData(nameof(Anais.OnUpdateUseBeforeThrowAfter))] public virtual Task Before_save_use_always_uses_value_if_set(string propertyName) { var id = 0; @@ -119,22 +97,14 @@ public virtual Task Before_save_use_always_uses_value_if_set(string propertyName }, async context => Assert.Equal("Pink", GetValue((await context.Set().FindAsync(id))!, propertyName))); } - [ConditionalTheory] - [InlineData(nameof(Anais.Never), "S")] - [InlineData(nameof(Anais.OnAdd), "Rabbit")] - [InlineData(nameof(Anais.OnUpdate), "S")] - [InlineData(nameof(Anais.NeverUseBeforeUseAfter), "S")] - [InlineData(nameof(Anais.NeverUseBeforeIgnoreAfter), "S")] - [InlineData(nameof(Anais.NeverUseBeforeThrowAfter), "S")] - [InlineData(nameof(Anais.OnAddUseBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddUseBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddUseBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateUseBeforeUseAfter), "S")] - [InlineData(nameof(Anais.OnUpdateUseBeforeIgnoreAfter), "S")] - [InlineData(nameof(Anais.OnUpdateUseBeforeThrowAfter), "S")] + [ConditionalTheory, InlineData(nameof(Anais.Never), "S"), InlineData(nameof(Anais.OnAdd), "Rabbit"), + InlineData(nameof(Anais.OnUpdate), "S"), InlineData(nameof(Anais.NeverUseBeforeUseAfter), "S"), + InlineData(nameof(Anais.NeverUseBeforeIgnoreAfter), "S"), InlineData(nameof(Anais.NeverUseBeforeThrowAfter), "S"), + InlineData(nameof(Anais.OnAddUseBeforeUseAfter), "Rabbit"), InlineData(nameof(Anais.OnAddUseBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddUseBeforeThrowAfter), "Rabbit"), InlineData(nameof(Anais.OnAddOrUpdateUseBeforeUseAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateUseBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateUseBeforeThrowAfter), "Rabbit"), InlineData(nameof(Anais.OnUpdateUseBeforeUseAfter), "S"), + InlineData(nameof(Anais.OnUpdateUseBeforeIgnoreAfter), "S"), InlineData(nameof(Anais.OnUpdateUseBeforeThrowAfter), "S")] public virtual Task Before_save_use_ignores_value_if_not_set(string propertyName, string? expectedValue) { if (expectedValue == "S") @@ -154,20 +124,14 @@ public virtual Task Before_save_use_ignores_value_if_not_set(string propertyName }, async context => Assert.Equal(expectedValue, GetValue((await context.Set().FindAsync(id))!, propertyName))); } - [ConditionalTheory] - [InlineData(nameof(Anais.OnAddOrUpdate), "Rabbit")] - [InlineData(nameof(Anais.NeverIgnoreBeforeUseAfter), null)] - [InlineData(nameof(Anais.NeverIgnoreBeforeIgnoreAfter), null)] - [InlineData(nameof(Anais.NeverIgnoreBeforeThrowAfter), null)] - [InlineData(nameof(Anais.OnAddIgnoreBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddIgnoreBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeThrowAfter), "Rabbit")] + [ConditionalTheory, InlineData(nameof(Anais.OnAddOrUpdate), "Rabbit"), InlineData(nameof(Anais.NeverIgnoreBeforeUseAfter), null), + InlineData(nameof(Anais.NeverIgnoreBeforeIgnoreAfter), null), InlineData(nameof(Anais.NeverIgnoreBeforeThrowAfter), null), + InlineData(nameof(Anais.OnAddIgnoreBeforeUseAfter), "Rabbit"), InlineData(nameof(Anais.OnAddIgnoreBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddIgnoreBeforeThrowAfter), "Rabbit"), InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeUseAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeThrowAfter), "Rabbit"), + InlineData(nameof(Anais.OnUpdateIgnoreBeforeUseAfter), "Rabbit"), InlineData(nameof(Anais.OnUpdateIgnoreBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnUpdateIgnoreBeforeThrowAfter), "Rabbit")] public virtual Task Before_save_ignore_ignores_value_if_not_set(string propertyName, string? expectedValue) { var id = 0; @@ -182,20 +146,14 @@ public virtual Task Before_save_ignore_ignores_value_if_not_set(string propertyN }, async context => Assert.Equal(expectedValue, GetValue((await context.Set().FindAsync(id))!, propertyName))); } - [ConditionalTheory] - [InlineData(nameof(Anais.OnAddOrUpdate), "Rabbit")] - [InlineData(nameof(Anais.NeverIgnoreBeforeUseAfter), null)] - [InlineData(nameof(Anais.NeverIgnoreBeforeIgnoreAfter), null)] - [InlineData(nameof(Anais.NeverIgnoreBeforeThrowAfter), null)] - [InlineData(nameof(Anais.OnAddIgnoreBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddIgnoreBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeThrowAfter), "Rabbit")] + [ConditionalTheory, InlineData(nameof(Anais.OnAddOrUpdate), "Rabbit"), InlineData(nameof(Anais.NeverIgnoreBeforeUseAfter), null), + InlineData(nameof(Anais.NeverIgnoreBeforeIgnoreAfter), null), InlineData(nameof(Anais.NeverIgnoreBeforeThrowAfter), null), + InlineData(nameof(Anais.OnAddIgnoreBeforeUseAfter), "Rabbit"), InlineData(nameof(Anais.OnAddIgnoreBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddIgnoreBeforeThrowAfter), "Rabbit"), InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeUseAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeThrowAfter), "Rabbit"), + InlineData(nameof(Anais.OnUpdateIgnoreBeforeUseAfter), "Rabbit"), InlineData(nameof(Anais.OnUpdateIgnoreBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnUpdateIgnoreBeforeThrowAfter), "Rabbit")] public virtual Task Before_save_ignore_ignores_value_even_if_set(string propertyName, string? expectedValue) { var id = 0; @@ -210,43 +168,29 @@ public virtual Task Before_save_ignore_ignores_value_even_if_set(string property }, async context => Assert.Equal(expectedValue, GetValue((await context.Set().FindAsync(id))!, propertyName))); } - [ConditionalTheory] - [InlineData(nameof(Anais.NeverUseBeforeThrowAfter))] - [InlineData(nameof(Anais.NeverIgnoreBeforeThrowAfter))] - [InlineData(nameof(Anais.NeverThrowBeforeThrowAfter))] - [InlineData(nameof(Anais.OnAddUseBeforeThrowAfter))] - [InlineData(nameof(Anais.OnAddIgnoreBeforeThrowAfter))] - [InlineData(nameof(Anais.OnAddThrowBeforeThrowAfter))] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeThrowAfter))] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeThrowAfter))] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeThrowAfter))] - [InlineData(nameof(Anais.OnUpdateUseBeforeThrowAfter))] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeThrowAfter))] - [InlineData(nameof(Anais.OnUpdateThrowBeforeThrowAfter))] + [ConditionalTheory, InlineData(nameof(Anais.NeverUseBeforeThrowAfter)), InlineData(nameof(Anais.NeverIgnoreBeforeThrowAfter)), + InlineData(nameof(Anais.NeverThrowBeforeThrowAfter)), InlineData(nameof(Anais.OnAddUseBeforeThrowAfter)), + InlineData(nameof(Anais.OnAddIgnoreBeforeThrowAfter)), InlineData(nameof(Anais.OnAddThrowBeforeThrowAfter)), + InlineData(nameof(Anais.OnAddOrUpdateUseBeforeThrowAfter)), InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeThrowAfter)), + InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeThrowAfter)), InlineData(nameof(Anais.OnUpdateUseBeforeThrowAfter)), + InlineData(nameof(Anais.OnUpdateIgnoreBeforeThrowAfter)), InlineData(nameof(Anais.OnUpdateThrowBeforeThrowAfter))] public virtual Task After_save_throw_always_throws_if_value_modified(string propertyName) - => ExecuteWithStrategyInTransactionAsync( - async context => - { - context.Attach(WithValue(propertyName, 1, Fixture.StringSentinel)).Property(propertyName).IsModified = true; - - Assert.Equal( - CoreStrings.PropertyReadOnlyAfterSave(propertyName, "Anais"), - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); - - [ConditionalTheory] - [InlineData(nameof(Anais.NeverUseBeforeThrowAfter), "S")] - [InlineData(nameof(Anais.NeverIgnoreBeforeThrowAfter), null)] - [InlineData(nameof(Anais.NeverThrowBeforeThrowAfter), null)] - [InlineData(nameof(Anais.OnAddUseBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddIgnoreBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddThrowBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateUseBeforeThrowAfter), "S")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeThrowAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateThrowBeforeThrowAfter), "Rabbit")] + => ExecuteWithStrategyInTransactionAsync(async context => + { + context.Attach(WithValue(propertyName, 1, Fixture.StringSentinel)).Property(propertyName).IsModified = true; + + Assert.Equal( + CoreStrings.PropertyReadOnlyAfterSave(propertyName, "Anais"), + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); + + [ConditionalTheory, InlineData(nameof(Anais.NeverUseBeforeThrowAfter), "S"), + InlineData(nameof(Anais.NeverIgnoreBeforeThrowAfter), null), InlineData(nameof(Anais.NeverThrowBeforeThrowAfter), null), + InlineData(nameof(Anais.OnAddUseBeforeThrowAfter), "Rabbit"), InlineData(nameof(Anais.OnAddIgnoreBeforeThrowAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddThrowBeforeThrowAfter), "Rabbit"), InlineData(nameof(Anais.OnAddOrUpdateUseBeforeThrowAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeThrowAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeThrowAfter), "Rabbit"), InlineData(nameof(Anais.OnUpdateUseBeforeThrowAfter), "S"), + InlineData(nameof(Anais.OnUpdateIgnoreBeforeThrowAfter), "Rabbit"), InlineData(nameof(Anais.OnUpdateThrowBeforeThrowAfter), "Rabbit")] public virtual Task After_save_throw_ignores_value_if_not_modified(string propertyName, string? expectedValue) { if (expectedValue == "S") @@ -276,21 +220,15 @@ public virtual Task After_save_throw_ignores_value_if_not_modified(string proper async context => Assert.Equal(expectedValue, GetValue((await context.Set().FindAsync(id))!, propertyName))); } - [ConditionalTheory] - [InlineData(nameof(Anais.OnAddOrUpdate), "Rabbit")] - [InlineData(nameof(Anais.OnUpdate), "S")] - [InlineData(nameof(Anais.NeverUseBeforeIgnoreAfter), "S")] - [InlineData(nameof(Anais.NeverIgnoreBeforeIgnoreAfter), null)] - [InlineData(nameof(Anais.NeverThrowBeforeIgnoreAfter), null)] - [InlineData(nameof(Anais.OnAddUseBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddThrowBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateUseBeforeIgnoreAfter), "S")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateThrowBeforeIgnoreAfter), "Rabbit")] + [ConditionalTheory, InlineData(nameof(Anais.OnAddOrUpdate), "Rabbit"), InlineData(nameof(Anais.OnUpdate), "S"), + InlineData(nameof(Anais.NeverUseBeforeIgnoreAfter), "S"), InlineData(nameof(Anais.NeverIgnoreBeforeIgnoreAfter), null), + InlineData(nameof(Anais.NeverThrowBeforeIgnoreAfter), null), InlineData(nameof(Anais.OnAddUseBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddIgnoreBeforeIgnoreAfter), "Rabbit"), InlineData(nameof(Anais.OnAddThrowBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateUseBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeIgnoreAfter), "Rabbit"), InlineData(nameof(Anais.OnUpdateUseBeforeIgnoreAfter), "S"), + InlineData(nameof(Anais.OnUpdateIgnoreBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnUpdateThrowBeforeIgnoreAfter), "Rabbit")] public virtual Task After_save_ignore_ignores_value_if_not_modified(string propertyName, string? expectedValue) { if (expectedValue == "S") @@ -320,21 +258,15 @@ public virtual Task After_save_ignore_ignores_value_if_not_modified(string prope async context => Assert.Equal(expectedValue, GetValue((await context.Set().FindAsync(id))!, propertyName))); } - [ConditionalTheory] - [InlineData(nameof(Anais.OnAddOrUpdate), "Rabbit")] - [InlineData(nameof(Anais.OnUpdate), "S")] - [InlineData(nameof(Anais.NeverUseBeforeIgnoreAfter), "S")] - [InlineData(nameof(Anais.NeverIgnoreBeforeIgnoreAfter), null)] - [InlineData(nameof(Anais.NeverThrowBeforeIgnoreAfter), null)] - [InlineData(nameof(Anais.OnAddUseBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddThrowBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateUseBeforeIgnoreAfter), "S")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeIgnoreAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateThrowBeforeIgnoreAfter), "Rabbit")] + [ConditionalTheory, InlineData(nameof(Anais.OnAddOrUpdate), "Rabbit"), InlineData(nameof(Anais.OnUpdate), "S"), + InlineData(nameof(Anais.NeverUseBeforeIgnoreAfter), "S"), InlineData(nameof(Anais.NeverIgnoreBeforeIgnoreAfter), null), + InlineData(nameof(Anais.NeverThrowBeforeIgnoreAfter), null), InlineData(nameof(Anais.OnAddUseBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddIgnoreBeforeIgnoreAfter), "Rabbit"), InlineData(nameof(Anais.OnAddThrowBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateUseBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeIgnoreAfter), "Rabbit"), InlineData(nameof(Anais.OnUpdateUseBeforeIgnoreAfter), "S"), + InlineData(nameof(Anais.OnUpdateIgnoreBeforeIgnoreAfter), "Rabbit"), + InlineData(nameof(Anais.OnUpdateThrowBeforeIgnoreAfter), "Rabbit")] public virtual Task After_save_ignore_ignores_value_even_if_modified(string propertyName, string? expectedValue) { if (expectedValue == "S") @@ -364,23 +296,15 @@ public virtual Task After_save_ignore_ignores_value_even_if_modified(string prop async context => Assert.Equal(expectedValue, GetValue((await context.Set().FindAsync(id))!, propertyName))); } - [ConditionalTheory] - [InlineData(nameof(Anais.Never), "S")] - [InlineData(nameof(Anais.OnAdd), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdate), "Rabbit")] - [InlineData(nameof(Anais.OnUpdate), "S")] - [InlineData(nameof(Anais.NeverUseBeforeUseAfter), "S")] - [InlineData(nameof(Anais.NeverIgnoreBeforeUseAfter), null)] - [InlineData(nameof(Anais.NeverThrowBeforeUseAfter), null)] - [InlineData(nameof(Anais.OnAddUseBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddIgnoreBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddThrowBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateUseBeforeUseAfter), "S")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeUseAfter), "Rabbit")] - [InlineData(nameof(Anais.OnUpdateThrowBeforeUseAfter), "Rabbit")] + [ConditionalTheory, InlineData(nameof(Anais.Never), "S"), InlineData(nameof(Anais.OnAdd), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdate), "Rabbit"), InlineData(nameof(Anais.OnUpdate), "S"), + InlineData(nameof(Anais.NeverUseBeforeUseAfter), "S"), InlineData(nameof(Anais.NeverIgnoreBeforeUseAfter), null), + InlineData(nameof(Anais.NeverThrowBeforeUseAfter), null), InlineData(nameof(Anais.OnAddUseBeforeUseAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddIgnoreBeforeUseAfter), "Rabbit"), InlineData(nameof(Anais.OnAddThrowBeforeUseAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateUseBeforeUseAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeUseAfter), "Rabbit"), + InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeUseAfter), "Rabbit"), InlineData(nameof(Anais.OnUpdateUseBeforeUseAfter), "S"), + InlineData(nameof(Anais.OnUpdateIgnoreBeforeUseAfter), "Rabbit"), InlineData(nameof(Anais.OnUpdateThrowBeforeUseAfter), "Rabbit")] public virtual Task After_save_use_ignores_value_if_not_modified(string propertyName, string? expectedValue) { if (expectedValue == "S") @@ -410,21 +334,14 @@ public virtual Task After_save_use_ignores_value_if_not_modified(string property async context => Assert.Equal(expectedValue, GetValue((await context.Set().FindAsync(id))!, propertyName))); } - [ConditionalTheory] - [InlineData(nameof(Anais.Never), "Daisy")] - [InlineData(nameof(Anais.OnAdd), "Daisy")] - [InlineData(nameof(Anais.NeverUseBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.NeverIgnoreBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.NeverThrowBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.OnAddUseBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.OnAddIgnoreBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.OnAddThrowBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.OnAddOrUpdateUseBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.OnUpdateUseBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.OnUpdateIgnoreBeforeUseAfter), "Daisy")] - [InlineData(nameof(Anais.OnUpdateThrowBeforeUseAfter), "Daisy")] + [ConditionalTheory, InlineData(nameof(Anais.Never), "Daisy"), InlineData(nameof(Anais.OnAdd), "Daisy"), + InlineData(nameof(Anais.NeverUseBeforeUseAfter), "Daisy"), InlineData(nameof(Anais.NeverIgnoreBeforeUseAfter), "Daisy"), + InlineData(nameof(Anais.NeverThrowBeforeUseAfter), "Daisy"), InlineData(nameof(Anais.OnAddUseBeforeUseAfter), "Daisy"), + InlineData(nameof(Anais.OnAddIgnoreBeforeUseAfter), "Daisy"), InlineData(nameof(Anais.OnAddThrowBeforeUseAfter), "Daisy"), + InlineData(nameof(Anais.OnAddOrUpdateUseBeforeUseAfter), "Daisy"), + InlineData(nameof(Anais.OnAddOrUpdateIgnoreBeforeUseAfter), "Daisy"), + InlineData(nameof(Anais.OnAddOrUpdateThrowBeforeUseAfter), "Daisy"), InlineData(nameof(Anais.OnUpdateUseBeforeUseAfter), "Daisy"), + InlineData(nameof(Anais.OnUpdateIgnoreBeforeUseAfter), "Daisy"), InlineData(nameof(Anais.OnUpdateThrowBeforeUseAfter), "Daisy")] public virtual Task After_save_use_uses_value_if_modified(string propertyName, string expectedValue) { var id = 0; @@ -462,15 +379,14 @@ private static Anais SetValue(Anais entity, string propertyName) [ConditionalFact] public virtual Task Identity_key_with_read_only_before_save_throws_if_explicit_values_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - context.Add(Gumball.Create(Fixture.IntSentinel + 1, Fixture.StringSentinel)); + => ExecuteWithStrategyInTransactionAsync(async context => + { + context.Add(Gumball.Create(Fixture.IntSentinel + 1, Fixture.StringSentinel)); - Assert.Equal( - CoreStrings.PropertyReadOnlyBeforeSave("Id", "Gumball"), - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + CoreStrings.PropertyReadOnlyBeforeSave("Id", "Gumball"), + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); [ConditionalFact] public virtual Task Identity_property_on_Added_entity_with_temporary_value_gets_value_from_store() @@ -547,9 +463,7 @@ protected class StoreGenPrincipal public int Id { get; set; } } - [ConditionalTheory] // Issue #22027 #14192 - [InlineData(EntityState.Modified)] - [InlineData(EntityState.Deleted)] + [ConditionalTheory, InlineData(EntityState.Modified), InlineData(EntityState.Deleted)] // Issue #22027 #14192 public Task Change_state_of_entity_with_temp_non_key_does_not_throw(EntityState targetState) => ExecuteWithStrategyInTransactionAsync( async context => @@ -594,124 +508,123 @@ public Task Change_state_of_entity_with_temp_non_key_does_not_throw(EntityState [ConditionalFact] // Issue #19137 public Task Clearing_optional_FK_does_not_leave_temporary_value() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var product = new OptionalProduct { Id = Fixture.IntSentinel }; - context.Add(product); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var product = new OptionalProduct { Id = Fixture.IntSentinel }; + context.Add(product); - Assert.True(context.ChangeTracker.HasChanges()); + Assert.True(context.ChangeTracker.HasChanges()); - var productEntry = context.Entry(product); - Assert.Equal(EntityState.Added, productEntry.State); + var productEntry = context.Entry(product); + Assert.Equal(EntityState.Added, productEntry.State); - Assert.Equal(Fixture.IntSentinel, product.Id); - Assert.True(productEntry.Property(e => e.Id).CurrentValue < 0); - Assert.True(productEntry.Property(e => e.Id).IsTemporary); + Assert.Equal(Fixture.IntSentinel, product.Id); + Assert.True(productEntry.Property(e => e.Id).CurrentValue < 0); + Assert.True(productEntry.Property(e => e.Id).IsTemporary); - Assert.Null(product.CategoryId); - Assert.Null(productEntry.Property(e => e.CategoryId).CurrentValue); - Assert.False(productEntry.Property(e => e.CategoryId).IsTemporary); + Assert.Null(product.CategoryId); + Assert.Null(productEntry.Property(e => e.CategoryId).CurrentValue); + Assert.False(productEntry.Property(e => e.CategoryId).IsTemporary); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - Assert.False(context.ChangeTracker.HasChanges()); + Assert.False(context.ChangeTracker.HasChanges()); - productEntry = context.Entry(product); - Assert.Equal(EntityState.Unchanged, productEntry.State); + productEntry = context.Entry(product); + Assert.Equal(EntityState.Unchanged, productEntry.State); - Assert.Equal(1, product.Id); - Assert.Equal(1, productEntry.Property(e => e.Id).CurrentValue); - Assert.False(productEntry.Property(e => e.Id).IsTemporary); + Assert.Equal(1, product.Id); + Assert.Equal(1, productEntry.Property(e => e.Id).CurrentValue); + Assert.False(productEntry.Property(e => e.Id).IsTemporary); - Assert.Null(product.CategoryId); - Assert.Null(productEntry.Property(e => e.CategoryId).CurrentValue); - Assert.False(productEntry.Property(e => e.CategoryId).IsTemporary); + Assert.Null(product.CategoryId); + Assert.Null(productEntry.Property(e => e.CategoryId).CurrentValue); + Assert.False(productEntry.Property(e => e.CategoryId).IsTemporary); - var category = new OptionalCategory(); - product.Category = category; + var category = new OptionalCategory(); + product.Category = category; - Assert.True(context.ChangeTracker.HasChanges()); + Assert.True(context.ChangeTracker.HasChanges()); - productEntry = context.Entry(product); - Assert.Equal(EntityState.Modified, productEntry.State); + productEntry = context.Entry(product); + Assert.Equal(EntityState.Modified, productEntry.State); - Assert.Equal(1, product.Id); - Assert.Equal(1, productEntry.Property(e => e.Id).CurrentValue); - Assert.False(productEntry.Property(e => e.Id).IsTemporary); + Assert.Equal(1, product.Id); + Assert.Equal(1, productEntry.Property(e => e.Id).CurrentValue); + Assert.False(productEntry.Property(e => e.Id).IsTemporary); - Assert.Null(product.CategoryId); - Assert.True(productEntry.Property(e => e.CategoryId).CurrentValue < 0); - Assert.True(productEntry.Property(e => e.CategoryId).IsTemporary); + Assert.Null(product.CategoryId); + Assert.True(productEntry.Property(e => e.CategoryId).CurrentValue < 0); + Assert.True(productEntry.Property(e => e.CategoryId).IsTemporary); - var categoryEntry = context.Entry(category); - Assert.Equal(EntityState.Added, categoryEntry.State); - Assert.Equal(0, category.Id); - Assert.True(categoryEntry.Property(e => e.Id).CurrentValue < 0); - Assert.True(categoryEntry.Property(e => e.Id).IsTemporary); + var categoryEntry = context.Entry(category); + Assert.Equal(EntityState.Added, categoryEntry.State); + Assert.Equal(0, category.Id); + Assert.True(categoryEntry.Property(e => e.Id).CurrentValue < 0); + Assert.True(categoryEntry.Property(e => e.Id).IsTemporary); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - Assert.False(context.ChangeTracker.HasChanges()); + Assert.False(context.ChangeTracker.HasChanges()); - productEntry = context.Entry(product); - Assert.Equal(EntityState.Unchanged, productEntry.State); + productEntry = context.Entry(product); + Assert.Equal(EntityState.Unchanged, productEntry.State); - Assert.Equal(1, product.Id); - Assert.Equal(1, productEntry.Property(e => e.Id).CurrentValue); - Assert.False(productEntry.Property(e => e.Id).IsTemporary); + Assert.Equal(1, product.Id); + Assert.Equal(1, productEntry.Property(e => e.Id).CurrentValue); + Assert.False(productEntry.Property(e => e.Id).IsTemporary); - Assert.Equal(1, product.CategoryId); - Assert.Equal(1, productEntry.Property(e => e.CategoryId).CurrentValue); - Assert.False(productEntry.Property(e => e.CategoryId).IsTemporary); + Assert.Equal(1, product.CategoryId); + Assert.Equal(1, productEntry.Property(e => e.CategoryId).CurrentValue); + Assert.False(productEntry.Property(e => e.CategoryId).IsTemporary); - categoryEntry = context.Entry(category); - Assert.Equal(EntityState.Unchanged, categoryEntry.State); - Assert.Equal(1, category.Id); - Assert.Equal(1, categoryEntry.Property(e => e.Id).CurrentValue); - Assert.False(categoryEntry.Property(e => e.Id).IsTemporary); + categoryEntry = context.Entry(category); + Assert.Equal(EntityState.Unchanged, categoryEntry.State); + Assert.Equal(1, category.Id); + Assert.Equal(1, categoryEntry.Property(e => e.Id).CurrentValue); + Assert.False(categoryEntry.Property(e => e.Id).IsTemporary); - product.Category = null; + product.Category = null; - productEntry = context.Entry(product); - Assert.Equal(EntityState.Modified, productEntry.State); + productEntry = context.Entry(product); + Assert.Equal(EntityState.Modified, productEntry.State); - Assert.Equal(1, product.Id); - Assert.Equal(1, productEntry.Property(e => e.Id).CurrentValue); - Assert.False(productEntry.Property(e => e.Id).IsTemporary); + Assert.Equal(1, product.Id); + Assert.Equal(1, productEntry.Property(e => e.Id).CurrentValue); + Assert.False(productEntry.Property(e => e.Id).IsTemporary); - Assert.Null(product.CategoryId); - Assert.Null(productEntry.Property(e => e.CategoryId).CurrentValue); - Assert.False(productEntry.Property(e => e.CategoryId).IsTemporary); + Assert.Null(product.CategoryId); + Assert.Null(productEntry.Property(e => e.CategoryId).CurrentValue); + Assert.False(productEntry.Property(e => e.CategoryId).IsTemporary); - categoryEntry = context.Entry(category); - Assert.Equal(EntityState.Unchanged, categoryEntry.State); - Assert.Equal(1, category.Id); - Assert.Equal(1, categoryEntry.Property(e => e.Id).CurrentValue); + categoryEntry = context.Entry(category); + Assert.Equal(EntityState.Unchanged, categoryEntry.State); + Assert.Equal(1, category.Id); + Assert.Equal(1, categoryEntry.Property(e => e.Id).CurrentValue); - Assert.True(context.ChangeTracker.HasChanges()); + Assert.True(context.ChangeTracker.HasChanges()); - await context.SaveChangesAsync(); + await context.SaveChangesAsync(); - Assert.False(context.ChangeTracker.HasChanges()); + Assert.False(context.ChangeTracker.HasChanges()); - productEntry = context.Entry(product); - Assert.Equal(EntityState.Unchanged, productEntry.State); + productEntry = context.Entry(product); + Assert.Equal(EntityState.Unchanged, productEntry.State); - Assert.Equal(1, product.Id); - Assert.Null(product.CategoryId); - Assert.False(productEntry.Property(e => e.Id).IsTemporary); + Assert.Equal(1, product.Id); + Assert.Null(product.CategoryId); + Assert.False(productEntry.Property(e => e.Id).IsTemporary); - Assert.Equal(1, productEntry.Property(e => e.Id).CurrentValue); - Assert.Null(productEntry.Property(e => e.CategoryId).CurrentValue); - Assert.False(productEntry.Property(e => e.CategoryId).IsTemporary); + Assert.Equal(1, productEntry.Property(e => e.Id).CurrentValue); + Assert.Null(productEntry.Property(e => e.CategoryId).CurrentValue); + Assert.False(productEntry.Property(e => e.CategoryId).IsTemporary); - categoryEntry = context.Entry(category); - Assert.Equal(EntityState.Unchanged, categoryEntry.State); - Assert.Equal(1, category.Id); - Assert.Equal(1, categoryEntry.Property(e => e.Id).CurrentValue); - Assert.False(categoryEntry.Property(e => e.Id).IsTemporary); - }); + categoryEntry = context.Entry(category); + Assert.Equal(EntityState.Unchanged, categoryEntry.State); + Assert.Equal(1, category.Id); + Assert.Equal(1, categoryEntry.Property(e => e.Id).CurrentValue); + Assert.False(categoryEntry.Property(e => e.Id).IsTemporary); + }); protected class OptionalProduct { @@ -767,17 +680,16 @@ public virtual Task Identity_property_on_Added_entity_with_default_value_gets_va [ConditionalFact] public virtual Task Identity_property_on_Added_entity_with_read_only_before_save_throws_if_explicit_values_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var gumball = Gumball.Create(Fixture.IntSentinel, Fixture.StringSentinel); - gumball.IdentityReadOnlyBeforeSave = "Masami"; - context.Add(gumball); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var gumball = Gumball.Create(Fixture.IntSentinel, Fixture.StringSentinel); + gumball.IdentityReadOnlyBeforeSave = "Masami"; + context.Add(gumball); - Assert.Equal( - CoreStrings.PropertyReadOnlyBeforeSave("IdentityReadOnlyBeforeSave", "Gumball"), - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + CoreStrings.PropertyReadOnlyBeforeSave("IdentityReadOnlyBeforeSave", "Gumball"), + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); [ConditionalFact] public virtual Task Identity_property_on_Added_entity_can_have_value_set_explicitly() @@ -929,17 +841,16 @@ public virtual Task Always_identity_property_on_Added_entity_with_default_value_ [ConditionalFact] public virtual Task Always_identity_property_on_Added_entity_with_read_only_before_save_throws_if_explicit_values_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var gumball = Gumball.Create(Fixture.IntSentinel, Fixture.StringSentinel); - gumball.AlwaysIdentityReadOnlyBeforeSave = "Masami"; - context.Add(gumball); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var gumball = Gumball.Create(Fixture.IntSentinel, Fixture.StringSentinel); + gumball.AlwaysIdentityReadOnlyBeforeSave = "Masami"; + context.Add(gumball); - Assert.Equal( - CoreStrings.PropertyReadOnlyBeforeSave("AlwaysIdentityReadOnlyBeforeSave", "Gumball"), - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + CoreStrings.PropertyReadOnlyBeforeSave("AlwaysIdentityReadOnlyBeforeSave", "Gumball"), + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); [ConditionalFact] public virtual Task Always_identity_property_on_Modified_entity_with_read_only_after_save_throws_if_value_is_in_modified_state() @@ -1041,17 +952,16 @@ public virtual Task Computed_property_on_Added_entity_with_default_value_gets_va [ConditionalFact] public virtual Task Computed_property_on_Added_entity_with_read_only_before_save_throws_if_explicit_values_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var gumball = Gumball.Create(Fixture.IntSentinel, Fixture.StringSentinel); - gumball.ComputedReadOnlyBeforeSave = "Masami"; - context.Add(gumball); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var gumball = Gumball.Create(Fixture.IntSentinel, Fixture.StringSentinel); + gumball.ComputedReadOnlyBeforeSave = "Masami"; + context.Add(gumball); - Assert.Equal( - CoreStrings.PropertyReadOnlyBeforeSave("ComputedReadOnlyBeforeSave", "Gumball"), - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + CoreStrings.PropertyReadOnlyBeforeSave("ComputedReadOnlyBeforeSave", "Gumball"), + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); [ConditionalFact] public virtual Task Computed_property_on_Added_entity_can_have_value_set_explicitly() @@ -1203,17 +1113,16 @@ public virtual Task Always_computed_property_on_Added_entity_with_default_value_ [ConditionalFact] public virtual Task Always_computed_property_on_Added_entity_with_read_only_before_save_throws_if_explicit_values_set() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var gumball = Gumball.Create(Fixture.IntSentinel, Fixture.StringSentinel); - gumball.AlwaysComputedReadOnlyBeforeSave = "Masami"; - context.Add(gumball); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var gumball = Gumball.Create(Fixture.IntSentinel, Fixture.StringSentinel); + gumball.AlwaysComputedReadOnlyBeforeSave = "Masami"; + context.Add(gumball); - Assert.Equal( - CoreStrings.PropertyReadOnlyBeforeSave("AlwaysComputedReadOnlyBeforeSave", "Gumball"), - (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + CoreStrings.PropertyReadOnlyBeforeSave("AlwaysComputedReadOnlyBeforeSave", "Gumball"), + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); [ConditionalFact] public virtual Task Always_computed_property_on_Modified_entity_with_read_only_after_save_throws_if_value_is_in_modified_state() @@ -4603,393 +4512,365 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().Property(e => e.Id).HasConversion(); modelBuilder.Entity().Property(e => e.Id).HasConversion(); - modelBuilder.Entity( - b => - { - var property = b.Property(e => e.Id).ValueGeneratedOnAdd().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + modelBuilder.Entity(b => + { + var property = b.Property(e => e.Id).ValueGeneratedOnAdd().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.Identity).ValueGeneratedOnAdd().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.Identity).ValueGeneratedOnAdd().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.IdentityReadOnlyBeforeSave).ValueGeneratedOnAdd().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.IdentityReadOnlyBeforeSave).ValueGeneratedOnAdd().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.IdentityReadOnlyAfterSave).ValueGeneratedOnAdd().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.IdentityReadOnlyAfterSave).ValueGeneratedOnAdd().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.AlwaysIdentity).ValueGeneratedOnAdd().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.AlwaysIdentity).ValueGeneratedOnAdd().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.AlwaysIdentityReadOnlyBeforeSave).ValueGeneratedOnAdd().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.AlwaysIdentityReadOnlyBeforeSave).ValueGeneratedOnAdd().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.AlwaysIdentityReadOnlyAfterSave).ValueGeneratedOnAdd().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.AlwaysIdentityReadOnlyAfterSave).ValueGeneratedOnAdd().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.Computed).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.Computed).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.ComputedReadOnlyBeforeSave).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.ComputedReadOnlyBeforeSave).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.ComputedReadOnlyAfterSave).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.ComputedReadOnlyAfterSave).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.AlwaysComputed).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.AlwaysComputed).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.AlwaysComputedReadOnlyBeforeSave).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.AlwaysComputedReadOnlyBeforeSave).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.AlwaysComputedReadOnlyAfterSave).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - }); + property = b.Property(e => e.AlwaysComputedReadOnlyAfterSave).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Never).ValueGeneratedNever(); + modelBuilder.Entity(b => + { + b.Property(e => e.Never).ValueGeneratedNever(); - var property = b.Property(e => e.NeverUseBeforeUseAfter).ValueGeneratedNever().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + var property = b.Property(e => e.NeverUseBeforeUseAfter).ValueGeneratedNever().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.NeverIgnoreBeforeUseAfter).ValueGeneratedNever().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.NeverIgnoreBeforeUseAfter).ValueGeneratedNever().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.NeverThrowBeforeUseAfter).ValueGeneratedNever().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.NeverThrowBeforeUseAfter).ValueGeneratedNever().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.NeverUseBeforeIgnoreAfter).ValueGeneratedNever().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.NeverUseBeforeIgnoreAfter).ValueGeneratedNever().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.NeverIgnoreBeforeIgnoreAfter).ValueGeneratedNever().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.NeverIgnoreBeforeIgnoreAfter).ValueGeneratedNever().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.NeverThrowBeforeIgnoreAfter).ValueGeneratedNever().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.NeverThrowBeforeIgnoreAfter).ValueGeneratedNever().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.NeverUseBeforeThrowAfter).ValueGeneratedNever().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.NeverUseBeforeThrowAfter).ValueGeneratedNever().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.NeverIgnoreBeforeThrowAfter).ValueGeneratedNever().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.NeverIgnoreBeforeThrowAfter).ValueGeneratedNever().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.NeverThrowBeforeThrowAfter).ValueGeneratedNever().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.NeverThrowBeforeThrowAfter).ValueGeneratedNever().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - b.Property(e => e.OnAdd).ValueGeneratedOnAdd(); + b.Property(e => e.OnAdd).ValueGeneratedOnAdd(); - property = b.Property(e => e.OnAddUseBeforeUseAfter).ValueGeneratedOnAdd().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.OnAddUseBeforeUseAfter).ValueGeneratedOnAdd().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.OnAddIgnoreBeforeUseAfter).ValueGeneratedOnAdd().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.OnAddIgnoreBeforeUseAfter).ValueGeneratedOnAdd().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.OnAddThrowBeforeUseAfter).ValueGeneratedOnAdd().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.OnAddThrowBeforeUseAfter).ValueGeneratedOnAdd().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.OnAddUseBeforeIgnoreAfter).ValueGeneratedOnAdd().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.OnAddUseBeforeIgnoreAfter).ValueGeneratedOnAdd().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.OnAddIgnoreBeforeIgnoreAfter).ValueGeneratedOnAdd().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.OnAddIgnoreBeforeIgnoreAfter).ValueGeneratedOnAdd().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.OnAddThrowBeforeIgnoreAfter).ValueGeneratedOnAdd().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.OnAddThrowBeforeIgnoreAfter).ValueGeneratedOnAdd().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.OnAddUseBeforeThrowAfter).ValueGeneratedOnAdd().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.OnAddUseBeforeThrowAfter).ValueGeneratedOnAdd().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.OnAddIgnoreBeforeThrowAfter).ValueGeneratedOnAdd().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.OnAddIgnoreBeforeThrowAfter).ValueGeneratedOnAdd().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.OnAddThrowBeforeThrowAfter).ValueGeneratedOnAdd().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.OnAddThrowBeforeThrowAfter).ValueGeneratedOnAdd().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - b.Property(e => e.OnAddOrUpdate).ValueGeneratedOnAddOrUpdate(); + b.Property(e => e.OnAddOrUpdate).ValueGeneratedOnAddOrUpdate(); - property = b.Property(e => e.OnAddOrUpdateUseBeforeUseAfter).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.OnAddOrUpdateUseBeforeUseAfter).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.OnAddOrUpdateIgnoreBeforeUseAfter).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.OnAddOrUpdateIgnoreBeforeUseAfter).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.OnAddOrUpdateThrowBeforeUseAfter).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.OnAddOrUpdateThrowBeforeUseAfter).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.OnAddOrUpdateUseBeforeIgnoreAfter).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.OnAddOrUpdateUseBeforeIgnoreAfter).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.OnAddOrUpdateIgnoreBeforeIgnoreAfter).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.OnAddOrUpdateIgnoreBeforeIgnoreAfter).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.OnAddOrUpdateThrowBeforeIgnoreAfter).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.OnAddOrUpdateThrowBeforeIgnoreAfter).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.OnAddOrUpdateUseBeforeThrowAfter).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.OnAddOrUpdateUseBeforeThrowAfter).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.OnAddOrUpdateIgnoreBeforeThrowAfter).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.OnAddOrUpdateIgnoreBeforeThrowAfter).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.OnAddOrUpdateThrowBeforeThrowAfter).ValueGeneratedOnAddOrUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.OnAddOrUpdateThrowBeforeThrowAfter).ValueGeneratedOnAddOrUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - b.Property(e => e.OnUpdate).ValueGeneratedOnUpdate(); + b.Property(e => e.OnUpdate).ValueGeneratedOnUpdate(); - property = b.Property(e => e.OnUpdateUseBeforeUseAfter).ValueGeneratedOnUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.OnUpdateUseBeforeUseAfter).ValueGeneratedOnUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.OnUpdateIgnoreBeforeUseAfter).ValueGeneratedOnUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.OnUpdateIgnoreBeforeUseAfter).ValueGeneratedOnUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.OnUpdateThrowBeforeUseAfter).ValueGeneratedOnUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Save); + property = b.Property(e => e.OnUpdateThrowBeforeUseAfter).ValueGeneratedOnUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Save); - property = b.Property(e => e.OnUpdateUseBeforeIgnoreAfter).ValueGeneratedOnUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.OnUpdateUseBeforeIgnoreAfter).ValueGeneratedOnUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.OnUpdateIgnoreBeforeIgnoreAfter).ValueGeneratedOnUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.OnUpdateIgnoreBeforeIgnoreAfter).ValueGeneratedOnUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.OnUpdateThrowBeforeIgnoreAfter).ValueGeneratedOnUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); + property = b.Property(e => e.OnUpdateThrowBeforeIgnoreAfter).ValueGeneratedOnUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); - property = b.Property(e => e.OnUpdateUseBeforeThrowAfter).ValueGeneratedOnUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.OnUpdateUseBeforeThrowAfter).ValueGeneratedOnUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Save); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.OnUpdateIgnoreBeforeThrowAfter).ValueGeneratedOnUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + property = b.Property(e => e.OnUpdateIgnoreBeforeThrowAfter).ValueGeneratedOnUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - property = b.Property(e => e.OnUpdateThrowBeforeThrowAfter).ValueGeneratedOnUpdate().Metadata; - property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); - property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); - }); + property = b.Property(e => e.OnUpdateThrowBeforeThrowAfter).ValueGeneratedOnUpdate().Metadata; + property.SetBeforeSaveBehavior(PropertySaveBehavior.Throw); + property.SetAfterSaveBehavior(PropertySaveBehavior.Throw); + }); - modelBuilder.Entity( - b => - { - b.HasOne(e => e.Species).WithOne().HasForeignKey(e => e.DarwinId); - b.HasMany(e => e.MixedMetaphors).WithOne().HasForeignKey(e => e.MetaphoricId); - }); + modelBuilder.Entity(b => + { + b.HasOne(e => e.Species).WithOne().HasForeignKey(e => e.DarwinId); + b.HasMany(e => e.MixedMetaphors).WithOne().HasForeignKey(e => e.MetaphoricId); + }); - modelBuilder.Entity( - b => - { - b.Property(e => e.Id).HasField("_id"); - b.Property(e => e.NullableAsNonNullable).HasField("_nullableAsNonNullable").ValueGeneratedOnAddOrUpdate(); - b.Property(e => e.NonNullableAsNullable) - .HasField("_nonNullableAsNullable") - .ValueGeneratedOnAddOrUpdate() - .UsePropertyAccessMode(PropertyAccessMode.Property); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Id).HasField("_id"); + b.Property(e => e.NullableAsNonNullable).HasField("_nullableAsNonNullable").ValueGeneratedOnAddOrUpdate(); + b.Property(e => e.NonNullableAsNullable) + .HasField("_nonNullableAsNullable") + .ValueGeneratedOnAddOrUpdate() + .UsePropertyAccessMode(PropertyAccessMode.Property); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - eb => - { - eb.Property(e => e.HasTemp) - .ValueGeneratedOnAddOrUpdate() - .HasValueGenerator(); - }); + modelBuilder.Entity(eb => + { + eb.Property(e => e.HasTemp) + .ValueGeneratedOnAddOrUpdate() + .HasValueGenerator(); + }); - modelBuilder.Entity( - entity => - { - entity.HasKey(x => x.Id); - entity.Property(x => x.Id) - .ValueGeneratedOnAdd(); - entity.HasOne(x => x.Current) - .WithOne() - .HasForeignKey(x => new { x.Id, x.CurrentNumber }); - }); - - modelBuilder.Entity( - entity => - { - entity.HasKey(x => new { x.PrincipalId, x.Number }); - entity.HasOne(x => x.Principal) - .WithMany(x => x.Periods) - .HasForeignKey(x => x.PrincipalId); - }); - - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); + modelBuilder.Entity(entity => + { + entity.HasKey(x => x.Id); + entity.Property(x => x.Id) + .ValueGeneratedOnAdd(); + entity.HasOne(x => x.Current) + .WithOne() + .HasForeignKey(x => new { x.Id, x.CurrentNumber }); + }); - modelBuilder.Entity( - entity => - { - var keyConverter = new ValueConverter( - v => (int)v, - v => v); + modelBuilder.Entity(entity => + { + entity.HasKey(x => new { x.PrincipalId, x.Number }); + entity.HasOne(x => x.Principal) + .WithMany(x => x.Periods) + .HasForeignKey(x => x.PrincipalId); + }); - entity.Property(e => e.Id).HasConversion(keyConverter); - }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); + modelBuilder.Entity(entity => + { + var keyConverter = new ValueConverter( + v => (int)v, + v => v); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); + entity.Property(e => e.Id).HasConversion(keyConverter); + }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.NonKey).HasValueGenerator(); - }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.NonKey).HasValueGenerator(); + }); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.Id).HasConversion(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.Id).HasConversion(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.Id).HasConversion(); - entity.Property(e => e.PrincipalId).HasConversion(); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.Id).HasConversion(); - entity.Property(e => e.PrincipalId).HasConversion(); - }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).HasConversion(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).HasConversion(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).HasConversion(); + entity.Property(e => e.PrincipalId).HasConversion(); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).HasConversion(); + entity.Property(e => e.PrincipalId).HasConversion(); + }); var stringToGuidConverter = new ValueConverter( v => new Guid(v), v => v.ToString()); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.Id).HasConversion(stringToGuidConverter); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.Id).HasConversion(stringToGuidConverter); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.Id).HasConversion(stringToGuidConverter); - entity.Property(e => e.PrincipalId).HasConversion(stringToGuidConverter!); - }); - modelBuilder.Entity( - entity => - { - entity.Property(e => e.Id).HasConversion(stringToGuidConverter); - entity.Property(e => e.PrincipalId).HasConversion(stringToGuidConverter); - }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).HasConversion(stringToGuidConverter); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).HasConversion(stringToGuidConverter); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).HasConversion(stringToGuidConverter); + entity.Property(e => e.PrincipalId).HasConversion(stringToGuidConverter!); + }); + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).HasConversion(stringToGuidConverter); + entity.Property(e => e.PrincipalId).HasConversion(stringToGuidConverter); + }); } protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) diff --git a/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityDbContext``.cs b/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityDbContext``.cs index ef3b9628646..79c6b5a1100 100644 --- a/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityDbContext``.cs +++ b/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityDbContext``.cs @@ -33,37 +33,32 @@ protected IdentityDbContext() protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); - builder.Entity( - b => - { - b.HasMany().WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); - }); + builder.Entity(b => + { + b.HasMany().WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); + }); - builder.Entity( - b => - { - b.HasKey(r => r.Id); - b.HasIndex(r => r.NormalizedName).IsUnique(); - b.Property(r => r.ConcurrencyStamp).IsConcurrencyToken(); + builder.Entity(b => + { + b.HasKey(r => r.Id); + b.HasIndex(r => r.NormalizedName).IsUnique(); + b.Property(r => r.ConcurrencyStamp).IsConcurrencyToken(); - b.Property(u => u.Name).HasMaxLength(256); - b.Property(u => u.NormalizedName).HasMaxLength(256); + b.Property(u => u.Name).HasMaxLength(256); + b.Property(u => u.NormalizedName).HasMaxLength(256); - b.HasMany().WithOne().HasForeignKey(ur => ur.RoleId).IsRequired(); - b.HasMany().WithOne().HasForeignKey(rc => rc.RoleId).IsRequired(); - }); + b.HasMany().WithOne().HasForeignKey(ur => ur.RoleId).IsRequired(); + b.HasMany().WithOne().HasForeignKey(rc => rc.RoleId).IsRequired(); + }); - builder.Entity( - b => - { - b.HasKey(rc => rc.Id); - }); + builder.Entity(b => + { + b.HasKey(rc => rc.Id); + }); - builder.Entity( - b => - { - b.HasKey( - r => new { r.UserId, r.RoleId }); - }); + builder.Entity(b => + { + b.HasKey(r => new { r.UserId, r.RoleId }); + }); } } diff --git a/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityUserContext.cs b/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityUserContext.cs index 652146b6cbd..e60f98553cf 100644 --- a/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityUserContext.cs +++ b/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityUserContext.cs @@ -45,89 +45,83 @@ protected override void OnModelCreating(ModelBuilder builder) const bool encryptPersonalData = true; var converter = new PersonalDataConverter(new PersonalDataProtector()); - builder.Entity( - b => + builder.Entity(b => + { + b.HasKey(u => u.Id); + b.HasIndex(u => u.NormalizedUserName).IsUnique(); + b.HasIndex(u => u.NormalizedEmail); + b.Property(u => u.ConcurrencyStamp).IsConcurrencyToken(); + + b.Property(u => u.UserName).HasMaxLength(256); + b.Property(u => u.NormalizedUserName).HasMaxLength(256); + b.Property(u => u.Email).HasMaxLength(256); + b.Property(u => u.NormalizedEmail).HasMaxLength(256); + + if (encryptPersonalData) { - b.HasKey(u => u.Id); - b.HasIndex(u => u.NormalizedUserName).IsUnique(); - b.HasIndex(u => u.NormalizedEmail); - b.Property(u => u.ConcurrencyStamp).IsConcurrencyToken(); - - b.Property(u => u.UserName).HasMaxLength(256); - b.Property(u => u.NormalizedUserName).HasMaxLength(256); - b.Property(u => u.Email).HasMaxLength(256); - b.Property(u => u.NormalizedEmail).HasMaxLength(256); - - if (encryptPersonalData) + var personalDataProps = typeof(TUser).GetProperties() + .Where(prop => Attribute.IsDefined(prop, typeof(ProtectedPersonalDataAttribute))); + foreach (var p in personalDataProps) { - var personalDataProps = typeof(TUser).GetProperties().Where( - prop => Attribute.IsDefined(prop, typeof(ProtectedPersonalDataAttribute))); - foreach (var p in personalDataProps) + if (p.PropertyType != typeof(string)) { - if (p.PropertyType != typeof(string)) - { - throw new InvalidOperationException("Resources.CanOnlyProtectStrings"); - } - - b.Property(typeof(string), p.Name).HasConversion(converter); + throw new InvalidOperationException("Resources.CanOnlyProtectStrings"); } + + b.Property(typeof(string), p.Name).HasConversion(converter); } + } - b.HasMany().WithOne().HasForeignKey(uc => uc.UserId).IsRequired(); - b.HasMany().WithOne().HasForeignKey(ul => ul.UserId).IsRequired(); - b.HasMany().WithOne().HasForeignKey(ut => ut.UserId).IsRequired(); - }); + b.HasMany().WithOne().HasForeignKey(uc => uc.UserId).IsRequired(); + b.HasMany().WithOne().HasForeignKey(ul => ul.UserId).IsRequired(); + b.HasMany().WithOne().HasForeignKey(ut => ut.UserId).IsRequired(); + }); - builder.Entity( - b => - { - b.HasKey(uc => uc.Id); - }); + builder.Entity(b => + { + b.HasKey(uc => uc.Id); + }); - builder.Entity( - b => - { - b.HasKey( - l => new { l.LoginProvider, l.ProviderKey }); + builder.Entity(b => + { + b.HasKey(l => new { l.LoginProvider, l.ProviderKey }); - if (maxKeyLength > 0) - { - b.Property(l => l.LoginProvider).HasMaxLength(maxKeyLength); - b.Property(l => l.ProviderKey).HasMaxLength(maxKeyLength); - } + if (maxKeyLength > 0) + { + b.Property(l => l.LoginProvider).HasMaxLength(maxKeyLength); + b.Property(l => l.ProviderKey).HasMaxLength(maxKeyLength); + } + }); + + builder.Entity(b => + { + b.HasKey(t => new + { + t.UserId, + t.LoginProvider, + t.Name }); - builder.Entity( - b => + if (maxKeyLength > 0) { - b.HasKey( - t => new - { - t.UserId, - t.LoginProvider, - t.Name - }); - - if (maxKeyLength > 0) - { - b.Property(t => t.LoginProvider).HasMaxLength(maxKeyLength); - b.Property(t => t.Name).HasMaxLength(maxKeyLength); - } + b.Property(t => t.LoginProvider).HasMaxLength(maxKeyLength); + b.Property(t => t.Name).HasMaxLength(maxKeyLength); + } - if (encryptPersonalData) + if (encryptPersonalData) + { + var tokenProps = typeof(TUserToken).GetProperties() + .Where(prop => Attribute.IsDefined(prop, typeof(ProtectedPersonalDataAttribute))); + foreach (var p in tokenProps) { - var tokenProps = typeof(TUserToken).GetProperties().Where( - prop => Attribute.IsDefined(prop, typeof(ProtectedPersonalDataAttribute))); - foreach (var p in tokenProps) + if (p.PropertyType != typeof(string)) { - if (p.PropertyType != typeof(string)) - { - throw new InvalidOperationException("Resources.CanOnlyProtectStrings"); - } - - b.Property(typeof(string), p.Name).HasConversion(converter); + throw new InvalidOperationException("Resources.CanOnlyProtectStrings"); } + + b.Property(typeof(string), p.Name).HasConversion(converter); } - }); + } + }); } } diff --git a/test/EFCore.Specification.Tests/TestModels/BasicTypesModel/BasicTypesData.cs b/test/EFCore.Specification.Tests/TestModels/BasicTypesModel/BasicTypesData.cs index 88dfc71c308..41263346e4d 100644 --- a/test/EFCore.Specification.Tests/TestModels/BasicTypesModel/BasicTypesData.cs +++ b/test/EFCore.Specification.Tests/TestModels/BasicTypesModel/BasicTypesData.cs @@ -32,7 +32,6 @@ public static IReadOnlyList CreateBasicTypesEntities() new() { Id = 0, - Byte = 0, Short = 0, Int = 0, @@ -40,27 +39,22 @@ public static IReadOnlyList CreateBasicTypesEntities() Float = 0, Double = 0, Decimal = 0, - String = string.Empty, - DateTime = new DateTime(2000, 1, 1, 0, 0, 0), DateOnly = new DateOnly(2000, 1, 1), TimeOnly = new TimeOnly(0, 0, 0), DateTimeOffset = new DateTimeOffset(2000, 1, 1, 0, 0, 0, TimeSpan.Zero), // TODO: Need to test non-zero days (not supported on SQL Server so need to tweak seeding data, which is currently hard) TimeSpan = TimeSpan.Zero, - Bool = false, Guid = Guid.Empty, ByteArray = [], - Enum = 0, FlagsEnum = BasicFlagsEnum.Zero, }, new() { Id = 1, - Byte = 8, Short = 8, Int = 8, @@ -68,9 +62,7 @@ public static IReadOnlyList CreateBasicTypesEntities() Float = 8.6f, Double = 8.6, Decimal = 8.6m, - String = "Seattle", - DateTime = new DateTime(1998, 5, 4, 15, 30, 10), DateOnly = new DateOnly(2020, 1, 1), TimeOnly = new TimeOnly(15, 30, 10), @@ -79,18 +71,15 @@ public static IReadOnlyList CreateBasicTypesEntities() // about the offset - working. DateTimeOffset = new DateTimeOffset(1998, 5, 4, 15, 30, 10, TimeSpan.Zero), TimeSpan = new TimeSpan(1, 2, 3), - Bool = true, Guid = new Guid("DF36F493-463F-4123-83F9-6B135DEEB7BA"), ByteArray = [0xDE, 0xAD, 0xBE, 0xEF], - Enum = BasicEnum.One, FlagsEnum = BasicFlagsEnum.Eight, }, new() { Id = 2, - Byte = 8, Short = 8, Int = 8, @@ -98,27 +87,22 @@ public static IReadOnlyList CreateBasicTypesEntities() Float = 8.6f, Double = 8.6, Decimal = 8.6m, - String = "London", - DateTime = new DateTime(1998, 5, 4, 15, 30, 10, 123, 456).AddTicks(400), DateOnly = new DateOnly(1990, 11, 10), TimeOnly = new TimeOnly(15, 30, 10, 123, 456), DateTimeOffset = new DateTimeOffset(1998, 5, 4, 15, 30, 10, 123, 456, TimeSpan.Zero) .Add(TimeSpan.FromTicks(4)), /* 400 nanoseconds */ TimeSpan = new TimeSpan(0, 3, 4, 5, 678, 912).Add(TimeSpan.FromTicks(4)), /* 400 nanoseconds */ - Bool = false, Guid = new Guid("B39A6FBA-9026-4D69-828E-FD7068673E57"), ByteArray = [1, 2, 3, 4, 5, 6, 7, 8, 9], - Enum = BasicEnum.Two, FlagsEnum = BasicFlagsEnum.Eight | BasicFlagsEnum.One, }, new() { Id = 3, - Byte = 255, Short = 255, Int = 255, @@ -126,9 +110,7 @@ public static IReadOnlyList CreateBasicTypesEntities() Float = 255.12f, Double = 255.12, Decimal = 255.12m, - String = "Toronto", - DateTime = new DateTime(1, 1, 1, 0, 0, 0), DateOnly = new DateOnly(1, 1, 1), TimeOnly = new TimeOnly(0, 0, 0), @@ -139,14 +121,12 @@ public static IReadOnlyList CreateBasicTypesEntities() // Bool = false, // Guid = new Guid("088ca6e6-c756-42f8-a298-8c28e63fdba6"), ByteArray = [], - Enum = BasicEnum.Three, FlagsEnum = BasicFlagsEnum.Sixteen | BasicFlagsEnum.Four | BasicFlagsEnum.One, }, new() { Id = 4, - Byte = 9, Short = -9, Int = -9, @@ -157,13 +137,12 @@ public static IReadOnlyList CreateBasicTypesEntities() // String = " Boston ", String = " Boston ", - DateTime = new DateTime(1, 1, 1, 0, 0, 0, 10, 200).AddTicks(4), /* 400 nanoseconds */ DateOnly = new DateOnly(1, 1, 1), TimeOnly = new TimeOnly(0, 0, 0, 10, 200).Add(TimeSpan.FromTicks(4)), /* 400 nanoseconds */ - DateTimeOffset = new DateTimeOffset(11, 5, 3, 12, 0, 0, 0, 200, new TimeSpan()).Add(TimeSpan.FromTicks(4)), /* 400 nanoseconds */ + DateTimeOffset = + new DateTimeOffset(11, 5, 3, 12, 0, 0, 0, 200, new TimeSpan()).Add(TimeSpan.FromTicks(4)), /* 400 nanoseconds */ TimeSpan = new TimeSpan(0, 2, 0, 15, 456, 200).Add(TimeSpan.FromTicks(4)), /* 400 nanoseconds */ - Bool = true, // Guid = new Guid("088ca6e6-c756-42f8-a298-8c28e63fdba6"), ByteArray = [], @@ -174,7 +153,6 @@ public static IReadOnlyList CreateBasicTypesEntities() new() { Id = 5, - Byte = 12, Short = 12, Int = 12, @@ -182,7 +160,6 @@ public static IReadOnlyList CreateBasicTypesEntities() Float = 12, Double = 12, Decimal = 12, - String = "Berlin", // DateTime = DateTime.MinValue, @@ -201,7 +178,6 @@ public static IReadOnlyList CreateBasicTypesEntities() new() { Id = 6, - Byte = 1, Short = 2, Int = 3, @@ -209,7 +185,6 @@ public static IReadOnlyList CreateBasicTypesEntities() Float = 5.6f, Double = 6.7f, Decimal = 8.8m, - String = "Seattle", // DateTime = DateTime.MinValue, @@ -232,10 +207,10 @@ public static IReadOnlyList CreateNullableBasicTypesEn // entity instance with all-nulls. return CreateBasicTypesEntities() .Select(ConvertToNullable) - .Append(new() + .Append( + new NullableBasicTypesEntity { Id = -1, - Byte = null, Short = null, Int = null, @@ -243,18 +218,14 @@ public static IReadOnlyList CreateNullableBasicTypesEn Float = null, Double = null, Decimal = null, - String = null, - DateTime = null, DateOnly = null, TimeOnly = null, DateTimeOffset = null, - Bool = null, Guid = null, ByteArray = null, - Enum = null, FlagsEnum = null }) @@ -264,7 +235,6 @@ NullableBasicTypesEntity ConvertToNullable(BasicTypesEntity b) => new() { Id = b.Id, - Byte = b.Byte, Short = b.Short, Int = b.Int, @@ -272,19 +242,15 @@ NullableBasicTypesEntity ConvertToNullable(BasicTypesEntity b) Float = b.Float, Double = b.Double, Decimal = b.Decimal, - String = b.String, - DateTime = b.DateTime, DateOnly = b.DateOnly, TimeOnly = b.TimeOnly, DateTimeOffset = b.DateTimeOffset, TimeSpan = b.TimeSpan, - Bool = b.Bool, Guid = b.Guid, ByteArray = b.ByteArray, - Enum = b.Enum, FlagsEnum = b.FlagsEnum, }; diff --git a/test/EFCore.Specification.Tests/TestModels/ComplexTypeModel/Model.cs b/test/EFCore.Specification.Tests/TestModels/ComplexTypeModel/Model.cs index ff3dbbc3968..479de7483e3 100644 --- a/test/EFCore.Specification.Tests/TestModels/ComplexTypeModel/Model.cs +++ b/test/EFCore.Specification.Tests/TestModels/ComplexTypeModel/Model.cs @@ -17,7 +17,7 @@ public record Address public required string AddressLine1 { get; set; } public string? AddressLine2 { get; set; } public int ZipCode { get; set; } - public List Tags { get; set; } = new(); + public List Tags { get; set; } = []; public required Country Country { get; set; } } diff --git a/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Attendee.cs b/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Attendee.cs index 1999c690c6d..472e198896e 100644 --- a/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Attendee.cs +++ b/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Attendee.cs @@ -11,16 +11,13 @@ public class Attendee { public int Id { get; set; } - [Required] - [StringLength(200)] + [Required, StringLength(200)] public virtual string FirstName { get; set; } - [Required] - [StringLength(200)] + [Required, StringLength(200)] public virtual string LastName { get; set; } - [Required] - [StringLength(200)] + [Required, StringLength(200)] public string UserName { get; set; } [StringLength(256)] diff --git a/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Session.cs b/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Session.cs index 7f971754528..edba1e59053 100644 --- a/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Session.cs +++ b/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Session.cs @@ -11,8 +11,7 @@ public class Session { public int Id { get; set; } - [Required] - [StringLength(200)] + [Required, StringLength(200)] public string Title { get; set; } [StringLength(4000)] diff --git a/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Speaker.cs b/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Speaker.cs index 6f5422621d9..085cc6d36fe 100644 --- a/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Speaker.cs +++ b/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Speaker.cs @@ -11,8 +11,7 @@ public class Speaker { public int Id { get; set; } - [Required] - [StringLength(200)] + [Required, StringLength(200)] public string Name { get; set; } [StringLength(4000)] diff --git a/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Track.cs b/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Track.cs index fea42c0a3ea..8ca17aef2b8 100644 --- a/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Track.cs +++ b/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/ConferenceDTO/Track.cs @@ -11,7 +11,6 @@ public class Track { public int Id { get; set; } - [Required] - [StringLength(200)] + [Required, StringLength(200)] public string Name { get; set; } } diff --git a/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/EntityExtensions.cs b/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/EntityExtensions.cs index 6b8ec266bcc..c7b7b493ebb 100644 --- a/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/EntityExtensions.cs +++ b/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/EntityExtensions.cs @@ -32,9 +32,8 @@ public static SpeakerResponse MapSpeakerResponse(this Speaker speaker) Bio = speaker.Bio, WebSite = speaker.WebSite, Sessions = speaker.SessionSpeakers? - .Select( - ss => - new ConferenceDTO.Session { Id = ss.SessionId, Title = ss.Session.Title }) + .Select(ss => + new ConferenceDTO.Session { Id = ss.SessionId, Title = ss.Session.Title }) .ToList() }; @@ -47,15 +46,14 @@ public static AttendeeResponse MapAttendeeResponse(this Attendee attendee) UserName = attendee.UserName, EmailAddress = attendee.EmailAddress, Sessions = attendee.SessionsAttendees? - .Select( - sa => - new ConferenceDTO.Session - { - Id = sa.SessionId, - Title = sa.Session.Title, - StartTime = sa.Session.StartTime, - EndTime = sa.Session.EndTime - }) + .Select(sa => + new ConferenceDTO.Session + { + Id = sa.SessionId, + Title = sa.Session.Title, + StartTime = sa.Session.StartTime, + EndTime = sa.Session.EndTime + }) .ToList() }; } diff --git a/test/EFCore.Specification.Tests/TestModels/InheritanceModel/InheritanceData.cs b/test/EFCore.Specification.Tests/TestModels/InheritanceModel/InheritanceData.cs index 94c126ea5b1..f81de4c2da9 100644 --- a/test/EFCore.Specification.Tests/TestModels/InheritanceModel/InheritanceData.cs +++ b/test/EFCore.Specification.Tests/TestModels/InheritanceModel/InheritanceData.cs @@ -23,24 +23,23 @@ public InheritanceData(bool useGeneratedKeys) WireUp(Animals, Countries); - AnimalQueries = Animals.Select( - a => a is Eagle - ? (AnimalQuery)new EagleQuery - { - Name = a.Name, - CountryId = a.CountryId, - EagleId = ((Bird)a).EagleId, - IsFlightless = ((Bird)a).IsFlightless, - Group = ((Eagle)a).Group, - } - : new KiwiQuery - { - Name = a.Name, - CountryId = a.CountryId, - EagleId = ((Bird)a).EagleId, - IsFlightless = ((Bird)a).IsFlightless, - FoundOn = ((Kiwi)a).FoundOn, - }).ToList(); + AnimalQueries = Animals.Select(a => a is Eagle + ? (AnimalQuery)new EagleQuery + { + Name = a.Name, + CountryId = a.CountryId, + EagleId = ((Bird)a).EagleId, + IsFlightless = ((Bird)a).IsFlightless, + Group = ((Eagle)a).Group, + } + : new KiwiQuery + { + Name = a.Name, + CountryId = a.CountryId, + EagleId = ((Bird)a).EagleId, + IsFlightless = ((Bird)a).IsFlightless, + FoundOn = ((Kiwi)a).FoundOn, + }).ToList(); } public InheritanceData( diff --git a/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonEntityAllTypes.cs b/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonEntityAllTypes.cs index 1bc8effc7b3..81cba0b0dfd 100644 --- a/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonEntityAllTypes.cs +++ b/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonEntityAllTypes.cs @@ -40,7 +40,7 @@ public class JsonEntityAllTypes public decimal[] TestDecimalCollection { get; set; } public List TestDateTimeCollection { get; set; } public IList TestDateTimeOffsetCollection { get; set; } - public TimeSpan[] TestTimeSpanCollection { get; set; } = [new TimeSpan(1, 1, 1)]; + public TimeSpan[] TestTimeSpanCollection { get; set; } = [new(1, 1, 1)]; public ReadOnlyCollection TestInt64Collection { get; set; } = new([]); public IList TestDoubleCollection { get; set; } = new List(); diff --git a/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonOwnedAllTypes.cs b/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonOwnedAllTypes.cs index d455de89c9a..6b2bfbd8df9 100644 --- a/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonOwnedAllTypes.cs +++ b/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonOwnedAllTypes.cs @@ -49,8 +49,8 @@ public class JsonOwnedAllTypes public JsonEnum? TestNullableEnumWithConverterThatHandlesNulls { get; set; } public List> TestInt64CollectionCollection { get; set; } = []; - public List TestDoubleCollectionCollection { get; set; } = new(); - public List TestSingleCollectionCollection { get; set; } = new([( [1.1f, 1.2f])]); + public List TestDoubleCollectionCollection { get; set; } = []; + public List TestSingleCollectionCollection { get; set; } = [( [1.1f, 1.2f])]; public bool[][] TestBooleanCollectionCollection { get; set; } = []; public ObservableCollection> TestCharacterCollectionCollection { get; set; } = []; @@ -83,7 +83,7 @@ public IList TestDoubleCollection public decimal[] TestDecimalCollection { get; set; } public List TestDateTimeCollection { get; set; } public IList TestDateTimeOffsetCollection { get; set; } - public TimeSpan[] TestTimeSpanCollection { get; set; } = [new TimeSpan(1, 1, 1)]; + public TimeSpan[] TestTimeSpanCollection { get; set; } = [new(1, 1, 1)]; public DateOnly[] TestDateOnlyCollection { get; set; } public TimeOnly[] TestTimeOnlyCollection { get; set; } diff --git a/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonQueryData.cs b/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonQueryData.cs index 1ef27b1d854..3a48005e755 100644 --- a/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonQueryData.cs +++ b/test/EFCore.Specification.Tests/TestModels/JsonQuery/JsonQueryData.cs @@ -391,20 +391,17 @@ public static IReadOnlyList CreateJsonEntitiesCustomNami { var e1_r_r = new JsonOwnedCustomNameBranch { - Date = new DateTime(2100, 1, 1), - Fraction = 10.0, + Date = new DateTime(2100, 1, 1), Fraction = 10.0, }; var e1_r_c1 = new JsonOwnedCustomNameBranch { - Date = new DateTime(2101, 1, 1), - Fraction = 10.1, + Date = new DateTime(2101, 1, 1), Fraction = 10.1, }; var e1_r_c2 = new JsonOwnedCustomNameBranch { - Date = new DateTime(2102, 1, 1), - Fraction = 10.2, + Date = new DateTime(2102, 1, 1), Fraction = 10.2, }; var e1_r = new JsonOwnedCustomNameRoot @@ -418,20 +415,17 @@ public static IReadOnlyList CreateJsonEntitiesCustomNami var e1_c1_r = new JsonOwnedCustomNameBranch { - Date = new DateTime(2110, 1, 1), - Fraction = 11.0, + Date = new DateTime(2110, 1, 1), Fraction = 11.0, }; var e1_c1_c1 = new JsonOwnedCustomNameBranch { - Date = new DateTime(2111, 1, 1), - Fraction = 11.1, + Date = new DateTime(2111, 1, 1), Fraction = 11.1, }; var e1_c1_c2 = new JsonOwnedCustomNameBranch { - Date = new DateTime(2112, 1, 1), - Fraction = 11.2, + Date = new DateTime(2112, 1, 1), Fraction = 11.2, }; var e1_c1 = new JsonOwnedCustomNameRoot @@ -445,20 +439,17 @@ public static IReadOnlyList CreateJsonEntitiesCustomNami var e1_c2_r = new JsonOwnedCustomNameBranch { - Date = new DateTime(2120, 1, 1), - Fraction = 12.0, + Date = new DateTime(2120, 1, 1), Fraction = 12.0, }; var e1_c2_c1 = new JsonOwnedCustomNameBranch { - Date = new DateTime(2121, 1, 1), - Fraction = 12.1, + Date = new DateTime(2121, 1, 1), Fraction = 12.1, }; var e1_c2_c2 = new JsonOwnedCustomNameBranch { - Date = new DateTime(2122, 1, 1), - Fraction = 12.2, + Date = new DateTime(2122, 1, 1), Fraction = 12.2, }; var e1_c2 = new JsonOwnedCustomNameRoot @@ -753,7 +744,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() "S2", "S3" ]), - TestBooleanCollection = new[] { true, false }, + TestBooleanCollection = [true, false], TestCharacterCollection = [ 'A', @@ -761,11 +752,11 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() '\"' ], TestDateTimeCollection = [DateTime.Parse("01/01/2000 12:34:56"), DateTime.Parse("01/01/3000 12:34:56")], - TestDateTimeOffsetCollection = new[] { new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0)) }, - TestDoubleCollection = new[] { -1.23456789, 1.23456789, 0.0 }, + TestDateTimeOffsetCollection = [new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0))], + TestDoubleCollection = [-1.23456789, 1.23456789, 0.0], TestDecimalCollection = [-1234567890.01M], TestGuidCollection = [new Guid("12345678-1234-4321-7777-987654321000")], - TestInt16Collection = new[] { short.MinValue, (short)0, short.MaxValue }, + TestInt16Collection = [short.MinValue, (short)0, short.MaxValue], TestInt32Collection = [int.MinValue, 0, int.MaxValue], TestInt64Collection = [ @@ -805,7 +796,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() int.MaxValue, null ], - TestEnumCollection = new[] { JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7) }, + TestEnumCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestEnumWithIntConverterCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestNullableEnumCollection = [ @@ -882,7 +873,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() "S2", "S3" ]), - TestBooleanCollection = new[] { true, false }, + TestBooleanCollection = [true, false], TestCharacterCollection = [ 'A', @@ -890,11 +881,11 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() '\"' ], TestDateTimeCollection = [DateTime.Parse("01/01/2000 12:34:56"), DateTime.Parse("01/01/3000 12:34:56")], - TestDateTimeOffsetCollection = new[] { new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0)) }, - TestDoubleCollection = new[] { -1.23456789, 1.23456789, 0.0 }, + TestDateTimeOffsetCollection = [new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0))], + TestDoubleCollection = [-1.23456789, 1.23456789, 0.0], TestDecimalCollection = [-1234567890.01M], TestGuidCollection = [new Guid("12345678-1234-4321-7777-987654321000")], - TestInt16Collection = new[] { short.MinValue, (short)0, short.MaxValue }, + TestInt16Collection = [short.MinValue, (short)0, short.MaxValue], TestInt32Collection = [int.MinValue, 0, int.MaxValue], TestInt64Collection = [ @@ -912,7 +903,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() TestTimeSpanCollection = [new TimeSpan(0, 10, 9, 8, 7), new TimeSpan(0, -10, 9, 8, 7)], TestDateOnlyCollection = [new DateOnly(2234, 1, 23), new DateOnly(5321, 1, 21)], TestTimeOnlyCollection = [new TimeOnly(21, 42, 23), new TimeOnly(17, 17, 27)], - TestUnsignedInt16Collection = new[] { ushort.MinValue, (ushort)0, ushort.MaxValue }, + TestUnsignedInt16Collection = [ushort.MinValue, (ushort)0, ushort.MaxValue], TestUnsignedInt32Collection = [uint.MinValue, 0, uint.MaxValue], TestUnsignedInt64Collection = [ @@ -929,7 +920,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() int.MaxValue, null ], - TestEnumCollection = new[] { JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7) }, + TestEnumCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestEnumWithIntConverterCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestNullableEnumCollection = [ @@ -1006,7 +997,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() "S2", "S3" ]), - TestBooleanCollection = new[] { true, false }, + TestBooleanCollection = [true, false], TestCharacterCollection = [ 'A', @@ -1014,11 +1005,11 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() '\"' ], TestDateTimeCollection = [DateTime.Parse("01/01/2000 12:34:56"), DateTime.Parse("01/01/3000 12:34:56")], - TestDateTimeOffsetCollection = new[] { new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0)) }, - TestDoubleCollection = new[] { -1.23456789, 1.23456789, 0.0 }, + TestDateTimeOffsetCollection = [new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0))], + TestDoubleCollection = [-1.23456789, 1.23456789, 0.0], TestDecimalCollection = [-1234567890.01M], TestGuidCollection = [new Guid("12345678-1234-4321-7777-987654321000")], - TestInt16Collection = new[] { short.MinValue, (short)0, short.MaxValue }, + TestInt16Collection = [short.MinValue, (short)0, short.MaxValue], TestInt32Collection = [int.MinValue, 0, int.MaxValue], TestInt64Collection = [ @@ -1036,7 +1027,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() TestTimeSpanCollection = [new TimeSpan(0, 10, 9, 8, 7), new TimeSpan(0, -10, 9, 8, 7)], TestDateOnlyCollection = [new DateOnly(3234, 1, 23), new DateOnly(4331, 1, 21)], TestTimeOnlyCollection = [new TimeOnly(13, 42, 23), new TimeOnly(7, 17, 25)], - TestUnsignedInt16Collection = new[] { ushort.MinValue, (ushort)0, ushort.MaxValue }, + TestUnsignedInt16Collection = [ushort.MinValue, (ushort)0, ushort.MaxValue], TestUnsignedInt32Collection = [uint.MinValue, 0, uint.MaxValue], TestUnsignedInt64Collection = [ @@ -1053,7 +1044,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() int.MaxValue, null ], - TestEnumCollection = new[] { JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7) }, + TestEnumCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestEnumWithIntConverterCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestNullableEnumCollection = new ObservableCollection { @@ -1130,7 +1121,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() "S2", "S3" ]), - TestBooleanCollection = new[] { true, false }, + TestBooleanCollection = [true, false], TestCharacterCollection = [ 'A', @@ -1138,11 +1129,11 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() '\"' ], TestDateTimeCollection = [DateTime.Parse("01/01/2000 12:34:56"), DateTime.Parse("01/01/3000 12:34:56")], - TestDateTimeOffsetCollection = new[] { new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0)) }, - TestDoubleCollection = new[] { -1.23456789, 1.23456789, 0.0 }, + TestDateTimeOffsetCollection = [new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0))], + TestDoubleCollection = [-1.23456789, 1.23456789, 0.0], TestDecimalCollection = [-1234567890.01M], TestGuidCollection = [new Guid("12345678-1234-4321-7777-987654321000")], - TestInt16Collection = new[] { short.MinValue, (short)0, short.MaxValue }, + TestInt16Collection = [short.MinValue, (short)0, short.MaxValue], TestInt32Collection = [int.MinValue, 0, int.MaxValue], TestInt64Collection = [ @@ -1160,7 +1151,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() TestTimeSpanCollection = [new TimeSpan(0, 10, 9, 8, 7), new TimeSpan(0, -10, 9, 8, 7)], TestDateOnlyCollection = [new DateOnly(1638, 1, 23), new DateOnly(4321, 1, 21)], TestTimeOnlyCollection = [new TimeOnly(8, 22, 23), new TimeOnly(7, 27, 37)], - TestUnsignedInt16Collection = new[] { ushort.MinValue, (ushort)0, ushort.MaxValue }, + TestUnsignedInt16Collection = [ushort.MinValue, (ushort)0, ushort.MaxValue], TestUnsignedInt32Collection = [uint.MinValue, 0, uint.MaxValue], TestUnsignedInt64Collection = [ @@ -1177,7 +1168,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() int.MaxValue, null ], - TestEnumCollection = new[] { JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7) }, + TestEnumCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestEnumWithIntConverterCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestNullableEnumCollection = new ObservableCollection { @@ -1231,7 +1222,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() "S2", "S3" ], - TestBooleanCollection = new[] { true, false }, + TestBooleanCollection = [true, false], TestByteCollection = [], TestCharacterCollection = [ @@ -1242,11 +1233,11 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() TestDateTimeCollection = [DateTime.Parse("01/01/2000 12:34:56"), DateTime.Parse("01/01/3000 12:34:56")], TestDateTimeOffsetCollection = - new[] { new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0)) }, - TestDoubleCollection = new[] { -1.23456789, 1.23456789, 0.0 }, + [new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0))], + TestDoubleCollection = [-1.23456789, 1.23456789, 0.0], TestDecimalCollection = [-1234567890.01M], TestGuidCollection = new ReadOnlyCollection([new Guid("12345678-1234-4321-7777-987654321000")]), - TestInt16Collection = new[] { short.MinValue, (short)0, short.MaxValue }, + TestInt16Collection = [short.MinValue, (short)0, short.MaxValue], TestInt32Collection = [int.MinValue, 0, int.MaxValue], TestInt64Collection = new ReadOnlyCollection( [ @@ -1284,7 +1275,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() int.MaxValue, null ], - TestEnumCollection = new[] { JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7) }, + TestEnumCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestEnumWithIntConverterCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestNullableEnumCollection = [ @@ -1342,7 +1333,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() "S2", "S3" ], - TestBooleanCollection = new[] { true, false }, + TestBooleanCollection = [true, false], TestByteCollection = [], TestCharacterCollection = [ @@ -1353,11 +1344,11 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() TestDateTimeCollection = [DateTime.Parse("01/01/2000 12:34:56"), DateTime.Parse("01/01/3000 12:34:56")], TestDateTimeOffsetCollection = - new[] { new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0)) }, - TestDoubleCollection = new[] { -1.23456789, 1.23456789, 0.0 }, + [new DateTimeOffset(DateTime.Parse("01/01/2000 12:34:56"), TimeSpan.FromHours(-8.0))], + TestDoubleCollection = [-1.23456789, 1.23456789, 0.0], TestDecimalCollection = [-1234567890.01M], TestGuidCollection = new ReadOnlyCollection([new Guid("12345678-1234-4321-7777-987654321000")]), - TestInt16Collection = new[] { short.MinValue, (short)0, short.MaxValue }, + TestInt16Collection = [short.MinValue, (short)0, short.MaxValue], TestInt32Collection = [int.MinValue, 0, int.MaxValue], TestInt64Collection = new ReadOnlyCollection( [ @@ -1395,7 +1386,7 @@ public static IReadOnlyList CreateJsonEntitiesAllTypes() int.MaxValue, null ], - TestEnumCollection = new[] { JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7) }, + TestEnumCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestEnumWithIntConverterCollection = [JsonEnum.One, JsonEnum.Three, (JsonEnum)(-7)], TestNullableEnumCollection = [ diff --git a/test/EFCore.Specification.Tests/TestModels/MonsterContext`.cs b/test/EFCore.Specification.Tests/TestModels/MonsterContext`.cs index a3b6ca82d09..9ad181619d1 100644 --- a/test/EFCore.Specification.Tests/TestModels/MonsterContext`.cs +++ b/test/EFCore.Specification.Tests/TestModels/MonsterContext`.cs @@ -153,8 +153,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity(); modelBuilder.Entity().HasKey(e => e.Username); - modelBuilder.Entity().HasKey( - e => new { e.MessageId, e.FromUsername }); + modelBuilder.Entity().HasKey(e => new { e.MessageId, e.FromUsername }); modelBuilder.Entity().HasKey(e => e.NoteId); @@ -166,171 +165,151 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity().HasKey(e => e.Name); - modelBuilder.Entity( - b => - { - b.HasMany(e => (IEnumerable)e.OrderLines).WithOne(e => (TAnOrder)e.Order) - .HasForeignKey(e => e.OrderId); + modelBuilder.Entity(b => + { + b.HasMany(e => (IEnumerable)e.OrderLines).WithOne(e => (TAnOrder)e.Order) + .HasForeignKey(e => e.OrderId); - b.HasMany(e => (IEnumerable)e.Notes).WithOne(e => (TAnOrder)e.Order) - .HasPrincipalKey(e => e.AlternateId); + b.HasMany(e => (IEnumerable)e.Notes).WithOne(e => (TAnOrder)e.Order) + .HasPrincipalKey(e => e.AlternateId); - b.OwnsOne(e => (TConcurrencyInfo)e.Concurrency).Property(c => c.Token).IsConcurrencyToken(); - }); + b.OwnsOne(e => (TConcurrencyInfo)e.Concurrency).Property(c => c.Token).IsConcurrencyToken(); + }); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.OrderId); + modelBuilder.Entity(b => + { + b.HasKey(e => e.OrderId); - b.HasOne(e => (TAnOrder)e.Order).WithOne() - .HasForeignKey(e => e.OrderId) - .HasPrincipalKey(e => e.AlternateId); - }); + b.HasOne(e => (TAnOrder)e.Order).WithOne() + .HasForeignKey(e => e.OrderId) + .HasPrincipalKey(e => e.AlternateId); + }); - modelBuilder.Entity( - b => - { - b.HasMany(e => (IEnumerable)e.Reviews).WithOne(e => (TProduct)e.Product); - b.HasMany(e => (IEnumerable)e.Barcodes).WithOne(e => (TProduct)e.Product); - b.HasMany(e => (IEnumerable)e.Photos).WithOne(); - b.HasOne(e => (TProductDetail)e.Detail).WithOne(e => (TProduct)e.Product) - .HasForeignKey(e => e.ProductId); + modelBuilder.Entity(b => + { + b.HasMany(e => (IEnumerable)e.Reviews).WithOne(e => (TProduct)e.Product); + b.HasMany(e => (IEnumerable)e.Barcodes).WithOne(e => (TProduct)e.Product); + b.HasMany(e => (IEnumerable)e.Photos).WithOne(); + b.HasOne(e => (TProductDetail)e.Detail).WithOne(e => (TProduct)e.Product) + .HasForeignKey(e => e.ProductId); - b.OwnsOne(e => (TConcurrencyInfo)e.ComplexConcurrency).Property(c => c.Token).IsConcurrencyToken(); + b.OwnsOne(e => (TConcurrencyInfo)e.ComplexConcurrency).Property(c => c.Token).IsConcurrencyToken(); - b.OwnsOne( - e => (TAuditInfo)e.NestedComplexConcurrency, - ab => ab.OwnsOne(a => (TConcurrencyInfo)a.Concurrency).Property(c => c.Token).IsConcurrencyToken()); + b.OwnsOne( + e => (TAuditInfo)e.NestedComplexConcurrency, + ab => ab.OwnsOne(a => (TConcurrencyInfo)a.Concurrency).Property(c => c.Token).IsConcurrencyToken()); - b.OwnsOne(e => (TDimensions)e.Dimensions); + b.OwnsOne(e => (TDimensions)e.Dimensions); - b.Ignore(e => e.Suppliers); - }); + b.Ignore(e => e.Suppliers); + }); - modelBuilder.Entity( - b => - { - b.HasKey( - e => new { e.OrderId, e.ProductId }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.OrderId, e.ProductId }); - b.HasOne(e => (TProduct)e.Product).WithMany().HasForeignKey(e => e.ProductId); - }); + b.HasOne(e => (TProduct)e.Product).WithMany().HasForeignKey(e => e.ProductId); + }); - modelBuilder.Entity( - b => - { - b.HasOne(e => (TSupplierLogo)e.Logo).WithOne().HasForeignKey(e => e.SupplierId); - b.Ignore(e => e.Products); - }); + modelBuilder.Entity(b => + { + b.HasOne(e => (TSupplierLogo)e.Logo).WithOne().HasForeignKey(e => e.SupplierId); + b.Ignore(e => e.Products); + }); - modelBuilder.Entity( - b => - { - b.HasMany(e => (IEnumerable)e.Orders).WithOne(e => (TCustomer)e.Customer); - b.HasMany(e => (IEnumerable)e.Logins).WithOne(e => (TCustomer)e.Customer); - b.HasOne(e => (TCustomerInfo)e.Info).WithOne().HasForeignKey(e => e.CustomerInfoId); - - b.HasOne(e => (TCustomer)e.Husband).WithOne(e => (TCustomer)e.Wife) - .HasForeignKey(e => e.HusbandId); - - b.OwnsOne( - e => (TAuditInfo)e.Auditing, - ab => ab.OwnsOne(a => (TConcurrencyInfo)a.Concurrency).Property(c => c.Token).IsConcurrencyToken()); - b.OwnsOne( - e => (TContactDetails)e.ContactInfo, - cb => - { - cb.OwnsOne(c => (TPhone)c.HomePhone); - cb.OwnsOne(c => (TPhone)c.MobilePhone); - cb.OwnsOne(c => (TPhone)c.WorkPhone); - }); - }); + modelBuilder.Entity(b => + { + b.HasMany(e => (IEnumerable)e.Orders).WithOne(e => (TCustomer)e.Customer); + b.HasMany(e => (IEnumerable)e.Logins).WithOne(e => (TCustomer)e.Customer); + b.HasOne(e => (TCustomerInfo)e.Info).WithOne().HasForeignKey(e => e.CustomerInfoId); + + b.HasOne(e => (TCustomer)e.Husband).WithOne(e => (TCustomer)e.Wife) + .HasForeignKey(e => e.HusbandId); + + b.OwnsOne( + e => (TAuditInfo)e.Auditing, + ab => ab.OwnsOne(a => (TConcurrencyInfo)a.Concurrency).Property(c => c.Token).IsConcurrencyToken()); + b.OwnsOne( + e => (TContactDetails)e.ContactInfo, + cb => + { + cb.OwnsOne(c => (TPhone)c.HomePhone); + cb.OwnsOne(c => (TPhone)c.MobilePhone); + cb.OwnsOne(c => (TPhone)c.WorkPhone); + }); + }); - modelBuilder.Entity( - b => - { - b.HasOne(e => (TCustomer)e.Customer) - .WithMany() - .HasForeignKey(e => e.CustomerId); + modelBuilder.Entity(b => + { + b.HasOne(e => (TCustomer)e.Customer) + .WithMany() + .HasForeignKey(e => e.CustomerId); - b.HasOne(e => (TResolution)e.Resolution).WithOne(e => (TComplaint)e.Complaint) - .HasPrincipalKey(e => e.AlternateId); - }); + b.HasOne(e => (TResolution)e.Resolution).WithOne(e => (TComplaint)e.Complaint) + .HasPrincipalKey(e => e.AlternateId); + }); - modelBuilder.Entity( - b => - { - b.HasKey( - e => new { e.PhotoId, e.ProductId }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.PhotoId, e.ProductId }); - b.HasMany(e => (IEnumerable)e.Features).WithOne(e => (TProductPhoto)e.Photo) - .HasForeignKey( - e => new { e.PhotoId, e.ProductId }) - .HasPrincipalKey( - e => new { e.PhotoId, e.ProductId }); - }); + b.HasMany(e => (IEnumerable)e.Features).WithOne(e => (TProductPhoto)e.Photo) + .HasForeignKey(e => new { e.PhotoId, e.ProductId }) + .HasPrincipalKey(e => new { e.PhotoId, e.ProductId }); + }); - modelBuilder.Entity( - b => - { - b.HasKey( - e => new { e.ReviewId, e.ProductId }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.ReviewId, e.ProductId }); - b.HasMany(e => (IEnumerable)e.Features).WithOne(e => (TProductReview)e.Review) - .HasForeignKey( - e => new { e.ReviewId, e.ProductId }) - .HasPrincipalKey( - e => new { e.ReviewId, e.ProductId }); - }); + b.HasMany(e => (IEnumerable)e.Features).WithOne(e => (TProductReview)e.Review) + .HasForeignKey(e => new { e.ReviewId, e.ProductId }) + .HasPrincipalKey(e => new { e.ReviewId, e.ProductId }); + }); - modelBuilder.Entity( - b => - { - var key = b.HasKey(e => e.Username); + modelBuilder.Entity(b => + { + var key = b.HasKey(e => e.Username); - b.HasMany(e => (IEnumerable)e.SentMessages).WithOne(e => (TLogin)e.Sender) - .HasForeignKey(e => e.FromUsername); + b.HasMany(e => (IEnumerable)e.SentMessages).WithOne(e => (TLogin)e.Sender) + .HasForeignKey(e => e.FromUsername); - b.HasMany(e => (IEnumerable)e.ReceivedMessages).WithOne(e => (TLogin)e.Recipient) - .HasForeignKey(e => e.ToUsername); + b.HasMany(e => (IEnumerable)e.ReceivedMessages).WithOne(e => (TLogin)e.Recipient) + .HasForeignKey(e => e.ToUsername); - b.HasMany(e => (IEnumerable)e.Orders).WithOne(e => (TLogin)e.Login) - .HasForeignKey(e => e.Username); + b.HasMany(e => (IEnumerable)e.Orders).WithOne(e => (TLogin)e.Login) + .HasForeignKey(e => e.Username); - var entityType = b.Metadata; - var activityEntityType = entityType.Model.FindEntityType(typeof(TSuspiciousActivity)); - activityEntityType.AddForeignKey(activityEntityType.FindProperty("Username"), key.Metadata, entityType); + var entityType = b.Metadata; + var activityEntityType = entityType.Model.FindEntityType(typeof(TSuspiciousActivity)); + activityEntityType.AddForeignKey(activityEntityType.FindProperty("Username"), key.Metadata, entityType); - b.HasOne(e => (TLastLogin)e.LastLogin).WithOne(e => (TLogin)e.Login) - .HasForeignKey(e => e.Username); - }); + b.HasOne(e => (TLastLogin)e.LastLogin).WithOne(e => (TLogin)e.Login) + .HasForeignKey(e => e.Username); + }); - modelBuilder.Entity( - b => - { - b.HasKey( - e => new { e.ResetNo, e.Username }); + modelBuilder.Entity(b => + { + b.HasKey(e => new { e.ResetNo, e.Username }); - b.HasOne(e => (TLogin)e.Login).WithMany() - .HasForeignKey(e => e.Username) - .HasPrincipalKey(e => e.AlternateUsername); - }); + b.HasOne(e => (TLogin)e.Login).WithMany() + .HasForeignKey(e => e.Username) + .HasPrincipalKey(e => e.AlternateUsername); + }); modelBuilder.Entity().HasOne(e => (TLogin)e.Login).WithMany() .HasForeignKey(e => e.Username); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Code); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Code); - b.HasMany(e => (IEnumerable)e.BadScans).WithOne(e => (TBarcode)e.ExpectedBarcode) - .HasForeignKey(e => e.ExpectedCode); + b.HasMany(e => (IEnumerable)e.BadScans).WithOne(e => (TBarcode)e.ExpectedBarcode) + .HasForeignKey(e => e.ExpectedCode); - b.HasOne(e => (TBarcodeDetail)e.Detail).WithOne() - .HasForeignKey(e => e.Code); - }); + b.HasOne(e => (TBarcodeDetail)e.Detail).WithOne() + .HasForeignKey(e => e.Code); + }); modelBuilder.Entity().HasOne(e => (TBarcode)e.ActualBarcode).WithMany() .HasForeignKey(e => e.ActualCode); @@ -342,51 +321,45 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity().OwnsOne(cd => (TDimensions)cd.Dimensions); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Name); - b.HasOne(e => (TLicense)e.License).WithOne(e => (TDriver)e.Driver) - .HasPrincipalKey(e => e.Name); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Name); + b.HasOne(e => (TLicense)e.License).WithOne(e => (TDriver)e.Driver) + .HasPrincipalKey(e => e.Name); + }); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Username); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Username); - b.HasOne(e => (TLogin)e.Login).WithOne() - .HasForeignKey(e => e.Username); + b.HasOne(e => (TLogin)e.Login).WithOne() + .HasForeignKey(e => e.Username); - b.HasOne(e => (TLastLogin)e.LastLogin).WithOne() - .HasForeignKey(e => e.SmartcardUsername); - }); + b.HasOne(e => (TLastLogin)e.LastLogin).WithOne() + .HasForeignKey(e => e.SmartcardUsername); + }); - modelBuilder.Entity( - b => - { - b.HasKey(e => e.Serial); - b.HasOne(e => (TLogin)e.Login).WithOne() - .HasForeignKey(e => e.Username); - }); + modelBuilder.Entity(b => + { + b.HasKey(e => e.Serial); + b.HasOne(e => (TLogin)e.Login).WithOne() + .HasForeignKey(e => e.Username); + }); // TODO: Many-to-many //modelBuilder.Entity().ForeignKeys(fk => fk.HasForeignKey(e => e.SupplierId)); - modelBuilder.Entity( - bb => bb.HasOne(b => (TSupplier)b.Supplier) - .WithMany(s => (ICollection)s.BackOrderLines) - .HasForeignKey(e => e.SupplierId)); + modelBuilder.Entity(bb => bb.HasOne(b => (TSupplier)b.Supplier) + .WithMany(s => (ICollection)s.BackOrderLines) + .HasForeignKey(e => e.SupplierId)); - modelBuilder.Entity( - db => db.HasOne(d => (TProduct)d.ReplacedBy) - .WithMany(p => (ICollection)p.Replaces) - .HasForeignKey(e => e.ReplacementProductId)); + modelBuilder.Entity(db => db.HasOne(d => (TProduct)d.ReplacedBy) + .WithMany(p => (ICollection)p.Replaces) + .HasForeignKey(e => e.ReplacementProductId)); - modelBuilder.Entity( - pb => pb.HasOne(p => (TProduct)p.Product) - .WithMany() - .HasForeignKey(e => e.ProductId)); + modelBuilder.Entity(pb => pb.HasOne(p => (TProduct)p.Product) + .WithMany() + .HasForeignKey(e => e.ProductId)); } public override Task SeedUsingFKs() diff --git a/test/EFCore.Specification.Tests/TestModels/MusicStore/Album.cs b/test/EFCore.Specification.Tests/TestModels/MusicStore/Album.cs index cdadf301907..85a097daa4d 100644 --- a/test/EFCore.Specification.Tests/TestModels/MusicStore/Album.cs +++ b/test/EFCore.Specification.Tests/TestModels/MusicStore/Album.cs @@ -17,25 +17,19 @@ public class Album public int ArtistId { get; set; } - [Required] - [StringLength(160, MinimumLength = 2)] + [Required, StringLength(160, MinimumLength = 2)] public string Title { get; set; } - [Required] - [Range(0.01, 100.00)] - [DataType(DataType.Currency)] - [Column(TypeName = "decimal(18,2)")] + [Required, Range(0.01, 100.00), DataType(DataType.Currency), Column(TypeName = "decimal(18,2)")] public decimal Price { get; set; } - [Display(Name = "Album Art URL")] - [StringLength(1024)] + [Display(Name = "Album Art URL"), StringLength(1024)] public string AlbumArtUrl { get; set; } public virtual Genre Genre { get; set; } public virtual Artist Artist { get; set; } public virtual List OrderDetails { get; set; } - [ScaffoldColumn(false)] - [Required] + [ScaffoldColumn(false), Required] public DateTime Created { get; set; } = DateTime.UtcNow; } diff --git a/test/EFCore.Specification.Tests/TestModels/MusicStore/Order.cs b/test/EFCore.Specification.Tests/TestModels/MusicStore/Order.cs index fac3f21907b..ffc81432f92 100644 --- a/test/EFCore.Specification.Tests/TestModels/MusicStore/Order.cs +++ b/test/EFCore.Specification.Tests/TestModels/MusicStore/Order.cs @@ -19,52 +19,36 @@ public class Order [ScaffoldColumn(false)] public string Username { get; set; } - [Required] - [Display(Name = "First Name")] - [StringLength(160)] + [Required, Display(Name = "First Name"), StringLength(160)] public string FirstName { get; set; } - [Required] - [Display(Name = "Last Name")] - [StringLength(160)] + [Required, Display(Name = "Last Name"), StringLength(160)] public string LastName { get; set; } - [Required] - [StringLength(70, MinimumLength = 3)] + [Required, StringLength(70, MinimumLength = 3)] public string Address { get; set; } - [Required] - [StringLength(40)] + [Required, StringLength(40)] public string City { get; set; } - [Required] - [StringLength(40)] + [Required, StringLength(40)] public string State { get; set; } - [Required] - [Display(Name = "Postal Code")] - [StringLength(10, MinimumLength = 5)] + [Required, Display(Name = "Postal Code"), StringLength(10, MinimumLength = 5)] public string PostalCode { get; set; } - [Required] - [StringLength(40)] + [Required, StringLength(40)] public string Country { get; set; } - [Required] - [StringLength(24)] - [DataType(DataType.PhoneNumber)] + [Required, StringLength(24), DataType(DataType.PhoneNumber)] public string Phone { get; set; } - [Required] - [Display(Name = "Email Address")] - [RegularExpression( - @"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}", - ErrorMessage = "Email is not valid.")] - [DataType(DataType.EmailAddress)] + [Required, Display(Name = "Email Address"), RegularExpression( + @"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}", + ErrorMessage = "Email is not valid."), DataType(DataType.EmailAddress)] public string Email { get; set; } - [ScaffoldColumn(false)] - [Column(TypeName = "decimal(18,2)")] + [ScaffoldColumn(false), Column(TypeName = "decimal(18,2)")] public decimal Total { get; set; } public List OrderDetails { get; set; } diff --git a/test/EFCore.Specification.Tests/TestModels/MusicStore/ShoppingCart.cs b/test/EFCore.Specification.Tests/TestModels/MusicStore/ShoppingCart.cs index e6c2967d550..81f40a14e05 100644 --- a/test/EFCore.Specification.Tests/TestModels/MusicStore/ShoppingCart.cs +++ b/test/EFCore.Specification.Tests/TestModels/MusicStore/ShoppingCart.cs @@ -20,9 +20,8 @@ public static ShoppingCart GetCart(MusicStoreContext db, string cartId) public async Task AddToCart(Album album) { // Get the matching cart and album instances - var cartItem = await _dbContext.CartItems.SingleOrDefaultAsync( - c => c.CartId == _shoppingCartId - && c.AlbumId == album.AlbumId); + var cartItem = await _dbContext.CartItems.SingleOrDefaultAsync(c => c.CartId == _shoppingCartId + && c.AlbumId == album.AlbumId); if (cartItem == null) { @@ -47,9 +46,8 @@ public async Task AddToCart(Album album) public int RemoveFromCart(int id) { // Get the cart - var cartItem = _dbContext.CartItems.SingleOrDefault( - cart => cart.CartId == _shoppingCartId - && cart.CartItemId == id); + var cartItem = _dbContext.CartItems.SingleOrDefault(cart => cart.CartId == _shoppingCartId + && cart.CartItemId == id); var itemCount = 0; diff --git a/test/EFCore.Specification.Tests/TestModels/Northwind/Customer.cs b/test/EFCore.Specification.Tests/TestModels/Northwind/Customer.cs index ccabdd5406e..b9e6ed5ef3e 100644 --- a/test/EFCore.Specification.Tests/TestModels/Northwind/Customer.cs +++ b/test/EFCore.Specification.Tests/TestModels/Northwind/Customer.cs @@ -21,12 +21,10 @@ public Customer() public Customer(DbContext context, ILazyLoader lazyLoader, string customerID) => CustomerID = customerID; - [MaxLength(5)] - [Required] + [MaxLength(5), Required] public string CustomerID { get; set; } - [MaxLength(40)] - [Required] + [MaxLength(40), Required] public string CompanyName { get; set; } [MaxLength(30)] @@ -58,8 +56,7 @@ public Customer(DbContext context, ILazyLoader lazyLoader, string customerID) public virtual List Orders { get; set; } - [JsonIgnore] - [Newtonsoft.Json.JsonIgnore] + [JsonIgnore, Newtonsoft.Json.JsonIgnore] public NorthwindContext Context { get; set; } [NotMapped] diff --git a/test/EFCore.Specification.Tests/TestModels/Northwind/Employee.cs b/test/EFCore.Specification.Tests/TestModels/Northwind/Employee.cs index 0d738d5ea4e..bf2b88abcce 100644 --- a/test/EFCore.Specification.Tests/TestModels/Northwind/Employee.cs +++ b/test/EFCore.Specification.Tests/TestModels/Northwind/Employee.cs @@ -17,12 +17,10 @@ public uint EmployeeID set => _employeeId = value; } - [MaxLength(20)] - [Required] + [MaxLength(20), Required] public string LastName { get; set; } - [MaxLength(10)] - [Required] + [MaxLength(10), Required] public string FirstName { get; set; } [MaxLength(30)] diff --git a/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindContext.cs b/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindContext.cs index 7e63a90966a..dc8fd786ee1 100644 --- a/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindContext.cs +++ b/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindContext.cs @@ -18,64 +18,59 @@ public class NorthwindContext(DbContextOptions options) : PoolableDbContext(opti protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity( - e => - { - e.Ignore(em => em.Address); - e.Ignore(em => em.BirthDate); - e.Ignore(em => em.Extension); - e.Ignore(em => em.HireDate); - e.Ignore(em => em.HomePhone); - e.Ignore(em => em.LastName); - e.Ignore(em => em.Notes); - e.Ignore(em => em.Photo); - e.Ignore(em => em.PhotoPath); - e.Ignore(em => em.PostalCode); - e.Ignore(em => em.Region); - e.Ignore(em => em.TitleOfCourtesy); - - e.HasOne(e1 => e1.Manager).WithMany().HasForeignKey(e1 => e1.ReportsTo); - }); - - modelBuilder.Entity( - e => - { - e.HasIndex(e => e.City); - e.HasIndex(e => e.CompanyName); - e.HasIndex(e => e.PostalCode); - e.HasIndex(e => e.Region); - }); - - modelBuilder.Entity( - e => - { - e.Ignore(p => p.CategoryID); - e.Ignore(p => p.QuantityPerUnit); - e.Ignore(p => p.ReorderLevel); - e.Ignore(p => p.UnitsOnOrder); - - e.HasIndex(e => e.ProductName); - }); - - modelBuilder.Entity( - e => - { - e.Ignore(o => o.Freight); - e.Ignore(o => o.RequiredDate); - e.Ignore(o => o.ShipAddress); - e.Ignore(o => o.ShipCity); - e.Ignore(o => o.ShipCountry); - e.Ignore(o => o.ShipName); - e.Ignore(o => o.ShipPostalCode); - e.Ignore(o => o.ShipRegion); - e.Ignore(o => o.ShipVia); - e.Ignore(o => o.ShippedDate); - - e.HasIndex(e => e.OrderDate); - }); - - modelBuilder.Entity( - e => e.HasKey(od => new { od.OrderID, od.ProductID })); + modelBuilder.Entity(e => + { + e.Ignore(em => em.Address); + e.Ignore(em => em.BirthDate); + e.Ignore(em => em.Extension); + e.Ignore(em => em.HireDate); + e.Ignore(em => em.HomePhone); + e.Ignore(em => em.LastName); + e.Ignore(em => em.Notes); + e.Ignore(em => em.Photo); + e.Ignore(em => em.PhotoPath); + e.Ignore(em => em.PostalCode); + e.Ignore(em => em.Region); + e.Ignore(em => em.TitleOfCourtesy); + + e.HasOne(e1 => e1.Manager).WithMany().HasForeignKey(e1 => e1.ReportsTo); + }); + + modelBuilder.Entity(e => + { + e.HasIndex(e => e.City); + e.HasIndex(e => e.CompanyName); + e.HasIndex(e => e.PostalCode); + e.HasIndex(e => e.Region); + }); + + modelBuilder.Entity(e => + { + e.Ignore(p => p.CategoryID); + e.Ignore(p => p.QuantityPerUnit); + e.Ignore(p => p.ReorderLevel); + e.Ignore(p => p.UnitsOnOrder); + + e.HasIndex(e => e.ProductName); + }); + + modelBuilder.Entity(e => + { + e.Ignore(o => o.Freight); + e.Ignore(o => o.RequiredDate); + e.Ignore(o => o.ShipAddress); + e.Ignore(o => o.ShipCity); + e.Ignore(o => o.ShipCountry); + e.Ignore(o => o.ShipName); + e.Ignore(o => o.ShipPostalCode); + e.Ignore(o => o.ShipRegion); + e.Ignore(o => o.ShipVia); + e.Ignore(o => o.ShippedDate); + + e.HasIndex(e => e.OrderDate); + }); + + modelBuilder.Entity(e => e.HasKey(od => new { od.OrderID, od.ProductID })); modelBuilder.Entity().HasNoKey(); modelBuilder.Entity().HasNoKey(); diff --git a/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindData.Objects.cs b/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindData.Objects.cs index 56e1523fa19..ed9854ff3fe 100644 --- a/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindData.Objects.cs +++ b/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindData.Objects.cs @@ -10,7 +10,7 @@ public partial class NorthwindData public static Customer[] CreateCustomers() => [ - new Customer + new() { CustomerID = "ALFKI", CompanyName = "Alfreds Futterkiste", @@ -24,7 +24,7 @@ public static Customer[] CreateCustomers() Phone = "030-0074321", Fax = "030-0076545" }, - new Customer + new() { CustomerID = "ANATR", CompanyName = "Ana Trujillo Emparedados y helados", @@ -38,7 +38,7 @@ public static Customer[] CreateCustomers() Phone = "(5) 555-4729", Fax = "(5) 555-3745" }, - new Customer + new() { CustomerID = "ANTON", CompanyName = "Antonio Moreno Taquería", @@ -52,7 +52,7 @@ public static Customer[] CreateCustomers() Phone = "(5) 555-3932", Fax = null }, - new Customer + new() { CustomerID = "AROUT", CompanyName = "Around the Horn", @@ -66,7 +66,7 @@ public static Customer[] CreateCustomers() Phone = "(171) 555-7788", Fax = "(171) 555-6750" }, - new Customer + new() { CustomerID = "BERGS", CompanyName = "Berglunds snabbköp", @@ -80,7 +80,7 @@ public static Customer[] CreateCustomers() Phone = "0921-12 34 65", Fax = "0921-12 34 67" }, - new Customer + new() { CustomerID = "BLAUS", CompanyName = "Blauer See Delikatessen", @@ -94,7 +94,7 @@ public static Customer[] CreateCustomers() Phone = "0621-08460", Fax = "0621-08924" }, - new Customer + new() { CustomerID = "BLONP", CompanyName = "Blondesddsl père et fils", @@ -108,7 +108,7 @@ public static Customer[] CreateCustomers() Phone = "88.60.15.31", Fax = "88.60.15.32" }, - new Customer + new() { CustomerID = "BOLID", CompanyName = "Bólido Comidas preparadas", @@ -122,7 +122,7 @@ public static Customer[] CreateCustomers() Phone = "(91) 555 22 82", Fax = "(91) 555 91 99" }, - new Customer + new() { CustomerID = "BONAP", CompanyName = "Bon app'", @@ -136,7 +136,7 @@ public static Customer[] CreateCustomers() Phone = "91.24.45.40", Fax = "91.24.45.41" }, - new Customer + new() { CustomerID = "BOTTM", CompanyName = "Bottom-Dollar Markets", @@ -150,7 +150,7 @@ public static Customer[] CreateCustomers() Phone = "(604) 555-4729", Fax = "(604) 555-3745" }, - new Customer + new() { CustomerID = "BSBEV", CompanyName = "B's Beverages", @@ -164,7 +164,7 @@ public static Customer[] CreateCustomers() Phone = "(171) 555-1212", Fax = null }, - new Customer + new() { CustomerID = "CACTU", CompanyName = "Cactus Comidas para llevar", @@ -178,7 +178,7 @@ public static Customer[] CreateCustomers() Phone = "(1) 135-5555", Fax = "(1) 135-4892" }, - new Customer + new() { CustomerID = "CENTC", CompanyName = "Centro comercial Moctezuma", @@ -192,7 +192,7 @@ public static Customer[] CreateCustomers() Phone = "(5) 555-3392", Fax = "(5) 555-7293" }, - new Customer + new() { CustomerID = "CHOPS", CompanyName = "Chop-suey Chinese", @@ -206,7 +206,7 @@ public static Customer[] CreateCustomers() Phone = "0452-076545", Fax = null }, - new Customer + new() { CustomerID = "COMMI", CompanyName = "Comércio Mineiro", @@ -220,7 +220,7 @@ public static Customer[] CreateCustomers() Phone = "(11) 555-7647", Fax = null }, - new Customer + new() { CustomerID = "CONSH", CompanyName = "Consolidated Holdings", @@ -234,7 +234,7 @@ public static Customer[] CreateCustomers() Phone = "(171) 555-2282", Fax = "(171) 555-9199" }, - new Customer + new() { CustomerID = "DRACD", CompanyName = "Drachenblut Delikatessen", @@ -248,7 +248,7 @@ public static Customer[] CreateCustomers() Phone = "0241-039123", Fax = "0241-059428" }, - new Customer + new() { CustomerID = "DUMON", CompanyName = "Du monde entier", @@ -262,7 +262,7 @@ public static Customer[] CreateCustomers() Phone = "40.67.88.88", Fax = "40.67.89.89" }, - new Customer + new() { CustomerID = "EASTC", CompanyName = "Eastern Connection", @@ -276,7 +276,7 @@ public static Customer[] CreateCustomers() Phone = "(171) 555-0297", Fax = "(171) 555-3373" }, - new Customer + new() { CustomerID = "ERNSH", CompanyName = "Ernst Handel", @@ -290,7 +290,7 @@ public static Customer[] CreateCustomers() Phone = "7675-3425", Fax = "7675-3426" }, - new Customer + new() { CustomerID = "FAMIA", CompanyName = "Familia Arquibaldo", @@ -304,7 +304,7 @@ public static Customer[] CreateCustomers() Phone = "(11) 555-9857", Fax = null }, - new Customer + new() { CustomerID = "FISSA", CompanyName = "FISSA Fabrica Inter. Salchichas S.A.", @@ -318,7 +318,7 @@ public static Customer[] CreateCustomers() Phone = "(91) 555 94 44", Fax = "(91) 555 55 93" }, - new Customer + new() { CustomerID = "FOLIG", CompanyName = "Folies gourmandes", @@ -332,7 +332,7 @@ public static Customer[] CreateCustomers() Phone = "20.16.10.16", Fax = "20.16.10.17" }, - new Customer + new() { CustomerID = "FOLKO", CompanyName = "Folk och fä HB", @@ -346,7 +346,7 @@ public static Customer[] CreateCustomers() Phone = "0695-34 67 21", Fax = null }, - new Customer + new() { CustomerID = "FRANK", CompanyName = "Frankenversand", @@ -360,7 +360,7 @@ public static Customer[] CreateCustomers() Phone = "089-0877310", Fax = "089-0877451" }, - new Customer + new() { CustomerID = "FRANR", CompanyName = "France restauration", @@ -374,7 +374,7 @@ public static Customer[] CreateCustomers() Phone = "40.32.21.21", Fax = "40.32.21.20" }, - new Customer + new() { CustomerID = "FRANS", CompanyName = "Franchi S.p.A.", @@ -388,7 +388,7 @@ public static Customer[] CreateCustomers() Phone = "011-4988260", Fax = "011-4988261" }, - new Customer + new() { CustomerID = "FURIB", CompanyName = "Furia Bacalhau e Frutos do Mar", @@ -402,7 +402,7 @@ public static Customer[] CreateCustomers() Phone = "(1) 354-2534", Fax = "(1) 354-2535" }, - new Customer + new() { CustomerID = "GALED", CompanyName = "Galería del gastrónomo", @@ -416,7 +416,7 @@ public static Customer[] CreateCustomers() Phone = "(93) 203 4560", Fax = "(93) 203 4561" }, - new Customer + new() { CustomerID = "GODOS", CompanyName = "Godos Cocina Típica", @@ -430,7 +430,7 @@ public static Customer[] CreateCustomers() Phone = "(95) 555 82 82", Fax = null }, - new Customer + new() { CustomerID = "GOURL", CompanyName = "Gourmet Lanchonetes", @@ -444,7 +444,7 @@ public static Customer[] CreateCustomers() Phone = "(11) 555-9482", Fax = null }, - new Customer + new() { CustomerID = "GREAL", CompanyName = "Great Lakes Food Market", @@ -458,7 +458,7 @@ public static Customer[] CreateCustomers() Phone = "(503) 555-7555", Fax = null }, - new Customer + new() { CustomerID = "GROSR", CompanyName = "GROSELLA-Restaurante", @@ -472,7 +472,7 @@ public static Customer[] CreateCustomers() Phone = "(2) 283-2951", Fax = "(2) 283-3397" }, - new Customer + new() { CustomerID = "HANAR", CompanyName = "Hanari Carnes", @@ -486,7 +486,7 @@ public static Customer[] CreateCustomers() Phone = "(21) 555-0091", Fax = "(21) 555-8765" }, - new Customer + new() { CustomerID = "HILAA", CompanyName = "HILARION-Abastos", @@ -500,7 +500,7 @@ public static Customer[] CreateCustomers() Phone = "(5) 555-1340", Fax = "(5) 555-1948" }, - new Customer + new() { CustomerID = "HUNGC", CompanyName = "Hungry Coyote Import Store", @@ -514,7 +514,7 @@ public static Customer[] CreateCustomers() Phone = "(503) 555-6874", Fax = "(503) 555-2376" }, - new Customer + new() { CustomerID = "HUNGO", CompanyName = "Hungry Owl All-Night Grocers", @@ -528,7 +528,7 @@ public static Customer[] CreateCustomers() Phone = "2967 542", Fax = "2967 3333" }, - new Customer + new() { CustomerID = "ISLAT", CompanyName = "Island Trading", @@ -542,7 +542,7 @@ public static Customer[] CreateCustomers() Phone = "(198) 555-8888", Fax = null }, - new Customer + new() { CustomerID = "KOENE", CompanyName = "Königlich Essen", @@ -556,7 +556,7 @@ public static Customer[] CreateCustomers() Phone = "0555-09876", Fax = null }, - new Customer + new() { CustomerID = "LACOR", CompanyName = "La corne d'abondance", @@ -570,7 +570,7 @@ public static Customer[] CreateCustomers() Phone = "30.59.84.10", Fax = "30.59.85.11" }, - new Customer + new() { CustomerID = "LAMAI", CompanyName = "La maison d'Asie", @@ -584,7 +584,7 @@ public static Customer[] CreateCustomers() Phone = "61.77.61.10", Fax = "61.77.61.11" }, - new Customer + new() { CustomerID = "LAUGB", CompanyName = "Laughing Bacchus Wine Cellars", @@ -598,7 +598,7 @@ public static Customer[] CreateCustomers() Phone = "(604) 555-3392", Fax = "(604) 555-7293" }, - new Customer + new() { CustomerID = "LAZYK", CompanyName = "Lazy K Kountry Store", @@ -612,7 +612,7 @@ public static Customer[] CreateCustomers() Phone = "(509) 555-7969", Fax = "(509) 555-6221" }, - new Customer + new() { CustomerID = "LEHMS", CompanyName = "Lehmanns Marktstand", @@ -626,7 +626,7 @@ public static Customer[] CreateCustomers() Phone = "069-0245984", Fax = "069-0245874" }, - new Customer + new() { CustomerID = "LETSS", CompanyName = "Let's Stop N Shop", @@ -640,7 +640,7 @@ public static Customer[] CreateCustomers() Phone = "(415) 555-5938", Fax = null }, - new Customer + new() { CustomerID = "LILAS", CompanyName = "LILA-Supermercado", @@ -654,7 +654,7 @@ public static Customer[] CreateCustomers() Phone = "(9) 331-6954", Fax = "(9) 331-7256" }, - new Customer + new() { CustomerID = "LINOD", CompanyName = "LINO-Delicateses", @@ -668,7 +668,7 @@ public static Customer[] CreateCustomers() Phone = "(8) 34-56-12", Fax = "(8) 34-93-93" }, - new Customer + new() { CustomerID = "LONEP", CompanyName = "Lonesome Pine Restaurant", @@ -682,7 +682,7 @@ public static Customer[] CreateCustomers() Phone = "(503) 555-9573", Fax = "(503) 555-9646" }, - new Customer + new() { CustomerID = "MAGAA", CompanyName = "Magazzini Alimentari Riuniti", @@ -696,7 +696,7 @@ public static Customer[] CreateCustomers() Phone = "035-640230", Fax = "035-640231" }, - new Customer + new() { CustomerID = "MAISD", CompanyName = "Maison Dewey", @@ -710,7 +710,7 @@ public static Customer[] CreateCustomers() Phone = "(02) 201 24 67", Fax = "(02) 201 24 68" }, - new Customer + new() { CustomerID = "MEREP", CompanyName = "Mère Paillarde", @@ -724,7 +724,7 @@ public static Customer[] CreateCustomers() Phone = "(514) 555-8054", Fax = "(514) 555-8055" }, - new Customer + new() { CustomerID = "MORGK", CompanyName = "Morgenstern Gesundkost", @@ -738,7 +738,7 @@ public static Customer[] CreateCustomers() Phone = "0342-023176", Fax = null }, - new Customer + new() { CustomerID = "NORTS", CompanyName = "North/South", @@ -752,7 +752,7 @@ public static Customer[] CreateCustomers() Phone = "(171) 555-7733", Fax = "(171) 555-2530" }, - new Customer + new() { CustomerID = "OCEAN", CompanyName = "Océano Atlántico Ltda.", @@ -766,7 +766,7 @@ public static Customer[] CreateCustomers() Phone = "(1) 135-5333", Fax = "(1) 135-5535" }, - new Customer + new() { CustomerID = "OLDWO", CompanyName = "Old World Delicatessen", @@ -780,7 +780,7 @@ public static Customer[] CreateCustomers() Phone = "(907) 555-7584", Fax = "(907) 555-2880" }, - new Customer + new() { CustomerID = "OTTIK", CompanyName = "Ottilies Käseladen", @@ -794,7 +794,7 @@ public static Customer[] CreateCustomers() Phone = "0221-0644327", Fax = "0221-0765721" }, - new Customer + new() { CustomerID = "PARIS", CompanyName = "Paris spécialités", @@ -808,7 +808,7 @@ public static Customer[] CreateCustomers() Phone = "(1) 42.34.22.66", Fax = "(1) 42.34.22.77" }, - new Customer + new() { CustomerID = "PERIC", CompanyName = "Pericles Comidas clásicas", @@ -822,7 +822,7 @@ public static Customer[] CreateCustomers() Phone = "(5) 552-3745", Fax = "(5) 545-3745" }, - new Customer + new() { CustomerID = "PICCO", CompanyName = "Piccolo und mehr", @@ -836,7 +836,7 @@ public static Customer[] CreateCustomers() Phone = "6562-9722", Fax = "6562-9723" }, - new Customer + new() { CustomerID = "PRINI", CompanyName = "Princesa Isabel Vinhos", @@ -850,7 +850,7 @@ public static Customer[] CreateCustomers() Phone = "(1) 356-5634", Fax = null }, - new Customer + new() { CustomerID = "QUEDE", CompanyName = "Que Delícia", @@ -864,7 +864,7 @@ public static Customer[] CreateCustomers() Phone = "(21) 555-4252", Fax = "(21) 555-4545" }, - new Customer + new() { CustomerID = "QUEEN", CompanyName = "Queen Cozinha", @@ -878,7 +878,7 @@ public static Customer[] CreateCustomers() Phone = "(11) 555-1189", Fax = null }, - new Customer + new() { CustomerID = "QUICK", CompanyName = "QUICK-Stop", @@ -892,7 +892,7 @@ public static Customer[] CreateCustomers() Phone = "0372-035188", Fax = null }, - new Customer + new() { CustomerID = "RANCH", CompanyName = "Rancho grande", @@ -906,7 +906,7 @@ public static Customer[] CreateCustomers() Phone = "(1) 123-5555", Fax = "(1) 123-5556" }, - new Customer + new() { CustomerID = "RATTC", CompanyName = "Rattlesnake Canyon Grocery", @@ -920,7 +920,7 @@ public static Customer[] CreateCustomers() Phone = "(505) 555-5939", Fax = "(505) 555-3620" }, - new Customer + new() { CustomerID = "REGGC", CompanyName = "Reggiani Caseifici", @@ -934,7 +934,7 @@ public static Customer[] CreateCustomers() Phone = "0522-556721", Fax = "0522-556722" }, - new Customer + new() { CustomerID = "RICAR", CompanyName = "Ricardo Adocicados", @@ -948,7 +948,7 @@ public static Customer[] CreateCustomers() Phone = "(21) 555-3412", Fax = null }, - new Customer + new() { CustomerID = "RICSU", CompanyName = "Richter Supermarkt", @@ -962,7 +962,7 @@ public static Customer[] CreateCustomers() Phone = "0897-034214", Fax = null }, - new Customer + new() { CustomerID = "ROMEY", CompanyName = "Romero y tomillo", @@ -976,7 +976,7 @@ public static Customer[] CreateCustomers() Phone = "(91) 745 6200", Fax = "(91) 745 6210" }, - new Customer + new() { CustomerID = "SANTG", CompanyName = "Santé Gourmet", @@ -990,7 +990,7 @@ public static Customer[] CreateCustomers() Phone = "07-98 92 35", Fax = "07-98 92 47" }, - new Customer + new() { CustomerID = "SAVEA", CompanyName = "Save-a-lot Markets", @@ -1004,7 +1004,7 @@ public static Customer[] CreateCustomers() Phone = "(208) 555-8097", Fax = null }, - new Customer + new() { CustomerID = "SEVES", CompanyName = "Seven Seas Imports", @@ -1018,7 +1018,7 @@ public static Customer[] CreateCustomers() Phone = "(171) 555-1717", Fax = "(171) 555-5646" }, - new Customer + new() { CustomerID = "SIMOB", CompanyName = "Simons bistro", @@ -1032,7 +1032,7 @@ public static Customer[] CreateCustomers() Phone = "31 12 34 56", Fax = "31 13 35 57" }, - new Customer + new() { CustomerID = "SPECD", CompanyName = "Spécialités du monde", @@ -1046,7 +1046,7 @@ public static Customer[] CreateCustomers() Phone = "(1) 47.55.60.10", Fax = "(1) 47.55.60.20" }, - new Customer + new() { CustomerID = "SPLIR", CompanyName = "Split Rail Beer & Ale", @@ -1060,7 +1060,7 @@ public static Customer[] CreateCustomers() Phone = "(307) 555-4680", Fax = "(307) 555-6525" }, - new Customer + new() { CustomerID = "SUPRD", CompanyName = "Suprêmes délices", @@ -1074,7 +1074,7 @@ public static Customer[] CreateCustomers() Phone = "(071) 23 67 22 20", Fax = "(071) 23 67 22 21" }, - new Customer + new() { CustomerID = "THEBI", CompanyName = "The Big Cheese", @@ -1088,7 +1088,7 @@ public static Customer[] CreateCustomers() Phone = "(503) 555-3612", Fax = null }, - new Customer + new() { CustomerID = "THECR", CompanyName = "The Cracker Box", @@ -1102,7 +1102,7 @@ public static Customer[] CreateCustomers() Phone = "(406) 555-5834", Fax = "(406) 555-8083" }, - new Customer + new() { CustomerID = "TOMSP", CompanyName = "Toms Spezialitäten", @@ -1116,7 +1116,7 @@ public static Customer[] CreateCustomers() Phone = "0251-031259", Fax = "0251-035695" }, - new Customer + new() { CustomerID = "TORTU", CompanyName = "Tortuga Restaurante", @@ -1130,7 +1130,7 @@ public static Customer[] CreateCustomers() Phone = "(5) 555-2933", Fax = null }, - new Customer + new() { CustomerID = "TRADH", CompanyName = "Tradição Hipermercados", @@ -1144,7 +1144,7 @@ public static Customer[] CreateCustomers() Phone = "(11) 555-2167", Fax = "(11) 555-2168" }, - new Customer + new() { CustomerID = "TRAIH", CompanyName = "Trail's Head Gourmet Provisioners", @@ -1158,7 +1158,7 @@ public static Customer[] CreateCustomers() Phone = "(206) 555-8257", Fax = "(206) 555-2174" }, - new Customer + new() { CustomerID = "VAFFE", CompanyName = "Vaffeljernet", @@ -1172,7 +1172,7 @@ public static Customer[] CreateCustomers() Phone = "86 21 32 43", Fax = "86 22 33 44" }, - new Customer + new() { CustomerID = "VICTE", CompanyName = "Victuailles en stock", @@ -1186,7 +1186,7 @@ public static Customer[] CreateCustomers() Phone = "78.32.54.86", Fax = "78.32.54.87" }, - new Customer + new() { CustomerID = "VINET", CompanyName = "Vins et alcools Chevalier", @@ -1200,7 +1200,7 @@ public static Customer[] CreateCustomers() Phone = "26.47.15.10", Fax = "26.47.15.11" }, - new Customer + new() { CustomerID = "WANDK", CompanyName = "Die Wandernde Kuh", @@ -1214,7 +1214,7 @@ public static Customer[] CreateCustomers() Phone = "0711-020361", Fax = "0711-035428" }, - new Customer + new() { CustomerID = "WARTH", CompanyName = "Wartian Herkku", @@ -1228,7 +1228,7 @@ public static Customer[] CreateCustomers() Phone = "981-443655", Fax = "981-443655" }, - new Customer + new() { CustomerID = "WELLI", CompanyName = "Wellington Importadora", @@ -1242,7 +1242,7 @@ public static Customer[] CreateCustomers() Phone = "(14) 555-8122", Fax = null }, - new Customer + new() { CustomerID = "WHITC", CompanyName = "White Clover Markets", @@ -1256,7 +1256,7 @@ public static Customer[] CreateCustomers() Phone = "(206) 555-4112", Fax = "(206) 555-4115" }, - new Customer + new() { CustomerID = "WILMK", CompanyName = "Wilman Kala", @@ -1270,7 +1270,7 @@ public static Customer[] CreateCustomers() Phone = "90-224 8858", Fax = "90-224 8858" }, - new Customer + new() { CustomerID = "WOLZA", CompanyName = "Wolski Zajazd", @@ -1293,7 +1293,7 @@ public static Customer[] CreateCustomers() public static Employee[] CreateEmployees() => [ - new Employee + new() { EmployeeID = 1, LastName = "Davolio", @@ -1318,7 +1318,7 @@ public static Employee[] CreateEmployees() ReportsTo = 2, PhotoPath = "http://accweb/emmployees/davolio.bmp" }, - new Employee + new() { EmployeeID = 2, LastName = "Fuller", @@ -1341,7 +1341,7 @@ public static Employee[] CreateEmployees() "Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager in January 1992 and to vice president of sales in March 1993. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.", PhotoPath = "http://accweb/emmployees/fuller.bmp" }, - new Employee + new() { EmployeeID = 3, LastName = "Leverling", @@ -1365,7 +1365,7 @@ public static Employee[] CreateEmployees() ReportsTo = 2, PhotoPath = "http://accweb/emmployees/leverling.bmp" }, - new Employee + new() { EmployeeID = 4, LastName = "Peacock", @@ -1389,7 +1389,7 @@ public static Employee[] CreateEmployees() ReportsTo = 2, PhotoPath = "http://accweb/emmployees/peacock.bmp" }, - new Employee + new() { EmployeeID = 5, LastName = "Buchanan", @@ -1413,7 +1413,7 @@ public static Employee[] CreateEmployees() ReportsTo = 2, PhotoPath = "http://accweb/emmployees/buchanan.bmp" }, - new Employee + new() { EmployeeID = 6, LastName = "Suyama", @@ -1438,7 +1438,7 @@ public static Employee[] CreateEmployees() ReportsTo = 5, PhotoPath = "http://accweb/emmployees/davolio.bmp" }, - new Employee + new() { EmployeeID = 7, LastName = "King", @@ -1463,7 +1463,7 @@ public static Employee[] CreateEmployees() ReportsTo = 5, PhotoPath = "http://accweb/emmployees/davolio.bmp" }, - new Employee + new() { EmployeeID = 8, LastName = "Callahan", @@ -1487,7 +1487,7 @@ public static Employee[] CreateEmployees() ReportsTo = 2, PhotoPath = "http://accweb/emmployees/davolio.bmp" }, - new Employee + new() { EmployeeID = 9, LastName = "Dodsworth", @@ -1520,7 +1520,7 @@ public static Employee[] CreateEmployees() public static Product[] CreateProducts() => [ - new Product + new() { ProductID = 1, ProductName = "Chai", @@ -1533,7 +1533,7 @@ public static Product[] CreateProducts() ReorderLevel = 10, Discontinued = false }, - new Product + new() { ProductID = 2, ProductName = "Chang", @@ -1546,7 +1546,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 3, ProductName = "Aniseed Syrup", @@ -1559,7 +1559,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 4, ProductName = "Chef Anton's Cajun Seasoning", @@ -1572,7 +1572,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 5, ProductName = "Chef Anton's Gumbo Mix", @@ -1585,7 +1585,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = true }, - new Product + new() { ProductID = 6, ProductName = "Grandma's Boysenberry Spread", @@ -1598,7 +1598,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 7, ProductName = "Uncle Bob's Organic Dried Pears", @@ -1611,7 +1611,7 @@ public static Product[] CreateProducts() ReorderLevel = 10, Discontinued = false }, - new Product + new() { ProductID = 8, ProductName = "Northwoods Cranberry Sauce", @@ -1624,7 +1624,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 9, ProductName = "Mishi Kobe Niku", @@ -1637,7 +1637,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = true }, - new Product + new() { ProductID = 10, ProductName = "Ikura", @@ -1650,7 +1650,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 11, ProductName = "Queso Cabrales", @@ -1663,7 +1663,7 @@ public static Product[] CreateProducts() ReorderLevel = 30, Discontinued = false }, - new Product + new() { ProductID = 12, ProductName = "Queso Manchego La Pastora", @@ -1676,7 +1676,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 13, ProductName = "Konbu", @@ -1689,7 +1689,7 @@ public static Product[] CreateProducts() ReorderLevel = 5, Discontinued = false }, - new Product + new() { ProductID = 14, ProductName = "Tofu", @@ -1702,7 +1702,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 15, ProductName = "Genen Shouyu", @@ -1715,7 +1715,7 @@ public static Product[] CreateProducts() ReorderLevel = 5, Discontinued = false }, - new Product + new() { ProductID = 16, ProductName = "Pavlova", @@ -1728,7 +1728,7 @@ public static Product[] CreateProducts() ReorderLevel = 10, Discontinued = false }, - new Product + new() { ProductID = 17, ProductName = "Alice Mutton", @@ -1741,7 +1741,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = true }, - new Product + new() { ProductID = 18, ProductName = "Carnarvon Tigers", @@ -1754,7 +1754,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 19, ProductName = "Teatime Chocolate Biscuits", @@ -1767,7 +1767,7 @@ public static Product[] CreateProducts() ReorderLevel = 5, Discontinued = false }, - new Product + new() { ProductID = 20, ProductName = "Sir Rodney's Marmalade", @@ -1780,7 +1780,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 21, ProductName = "Sir Rodney's Scones", @@ -1793,7 +1793,7 @@ public static Product[] CreateProducts() ReorderLevel = 5, Discontinued = false }, - new Product + new() { ProductID = 22, ProductName = "Gustaf's Knäckebröd", @@ -1806,7 +1806,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 23, ProductName = "Tunnbröd", @@ -1819,7 +1819,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 24, ProductName = "Guaraná Fantástica", @@ -1832,7 +1832,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = true }, - new Product + new() { ProductID = 25, ProductName = "NuNuCa Nuß-Nougat-Creme", @@ -1845,7 +1845,7 @@ public static Product[] CreateProducts() ReorderLevel = 30, Discontinued = false }, - new Product + new() { ProductID = 26, ProductName = "Gumbär Gummibärchen", @@ -1858,7 +1858,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 27, ProductName = "Schoggi Schokolade", @@ -1871,7 +1871,7 @@ public static Product[] CreateProducts() ReorderLevel = 30, Discontinued = false }, - new Product + new() { ProductID = 28, ProductName = "Rössle Sauerkraut", @@ -1884,7 +1884,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = true }, - new Product + new() { ProductID = 29, ProductName = "Thüringer Rostbratwurst", @@ -1897,7 +1897,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = true }, - new Product + new() { ProductID = 30, ProductName = "Nord-Ost Matjeshering", @@ -1910,7 +1910,7 @@ public static Product[] CreateProducts() ReorderLevel = 15, Discontinued = false }, - new Product + new() { ProductID = 31, ProductName = "Gorgonzola Telino", @@ -1923,7 +1923,7 @@ public static Product[] CreateProducts() ReorderLevel = 20, Discontinued = false }, - new Product + new() { ProductID = 32, ProductName = "Mascarpone Fabioli", @@ -1936,7 +1936,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 33, ProductName = "Geitost", @@ -1949,7 +1949,7 @@ public static Product[] CreateProducts() ReorderLevel = 20, Discontinued = false }, - new Product + new() { ProductID = 34, ProductName = "Sasquatch Ale", @@ -1962,7 +1962,7 @@ public static Product[] CreateProducts() ReorderLevel = 15, Discontinued = false }, - new Product + new() { ProductID = 35, ProductName = "Steeleye Stout", @@ -1975,7 +1975,7 @@ public static Product[] CreateProducts() ReorderLevel = 15, Discontinued = false }, - new Product + new() { ProductID = 36, ProductName = "Inlagd Sill", @@ -1988,7 +1988,7 @@ public static Product[] CreateProducts() ReorderLevel = 20, Discontinued = false }, - new Product + new() { ProductID = 37, ProductName = "Gravad lax", @@ -2001,7 +2001,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 38, ProductName = "Côte de Blaye", @@ -2014,7 +2014,7 @@ public static Product[] CreateProducts() ReorderLevel = 15, Discontinued = false }, - new Product + new() { ProductID = 39, ProductName = "Chartreuse verte", @@ -2027,7 +2027,7 @@ public static Product[] CreateProducts() ReorderLevel = 5, Discontinued = false }, - new Product + new() { ProductID = 40, ProductName = "Boston Crab Meat", @@ -2040,7 +2040,7 @@ public static Product[] CreateProducts() ReorderLevel = 30, Discontinued = false }, - new Product + new() { ProductID = 41, ProductName = "Jack's New England Clam Chowder", @@ -2053,7 +2053,7 @@ public static Product[] CreateProducts() ReorderLevel = 10, Discontinued = false }, - new Product + new() { ProductID = 42, ProductName = "Singaporean Hokkien Fried Mee", @@ -2066,7 +2066,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = true }, - new Product + new() { ProductID = 43, ProductName = "Ipoh Coffee", @@ -2079,7 +2079,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 44, ProductName = "Gula Malacca", @@ -2092,7 +2092,7 @@ public static Product[] CreateProducts() ReorderLevel = 15, Discontinued = false }, - new Product + new() { ProductID = 45, ProductName = "Rogede sild", @@ -2105,7 +2105,7 @@ public static Product[] CreateProducts() ReorderLevel = 15, Discontinued = false }, - new Product + new() { ProductID = 46, ProductName = "Spegesild", @@ -2118,7 +2118,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 47, ProductName = "Zaanse koeken", @@ -2131,7 +2131,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 48, ProductName = "Chocolade", @@ -2144,7 +2144,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 49, ProductName = "Maxilaku", @@ -2157,7 +2157,7 @@ public static Product[] CreateProducts() ReorderLevel = 15, Discontinued = false }, - new Product + new() { ProductID = 50, ProductName = "Valkoinen suklaa", @@ -2170,7 +2170,7 @@ public static Product[] CreateProducts() ReorderLevel = 30, Discontinued = false }, - new Product + new() { ProductID = 51, ProductName = "Manjimup Dried Apples", @@ -2183,7 +2183,7 @@ public static Product[] CreateProducts() ReorderLevel = 10, Discontinued = false }, - new Product + new() { ProductID = 52, ProductName = "Filo Mix", @@ -2196,7 +2196,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 53, ProductName = "Perth Pasties", @@ -2209,7 +2209,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = true }, - new Product + new() { ProductID = 54, ProductName = "Tourtière", @@ -2222,7 +2222,7 @@ public static Product[] CreateProducts() ReorderLevel = 10, Discontinued = false }, - new Product + new() { ProductID = 55, ProductName = "Pâté chinois", @@ -2235,7 +2235,7 @@ public static Product[] CreateProducts() ReorderLevel = 20, Discontinued = false }, - new Product + new() { ProductID = 56, ProductName = "Gnocchi di nonna Alice", @@ -2248,7 +2248,7 @@ public static Product[] CreateProducts() ReorderLevel = 30, Discontinued = false }, - new Product + new() { ProductID = 57, ProductName = "Ravioli Angelo", @@ -2261,7 +2261,7 @@ public static Product[] CreateProducts() ReorderLevel = 20, Discontinued = false }, - new Product + new() { ProductID = 58, ProductName = "Escargots de Bourgogne", @@ -2274,7 +2274,7 @@ public static Product[] CreateProducts() ReorderLevel = 20, Discontinued = false }, - new Product + new() { ProductID = 59, ProductName = "Raclette Courdavault", @@ -2287,7 +2287,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 60, ProductName = "Camembert Pierrot", @@ -2300,7 +2300,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 61, ProductName = "Sirop d'érable", @@ -2313,7 +2313,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 62, ProductName = "Tarte au sucre", @@ -2326,7 +2326,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 63, ProductName = "Vegie-spread", @@ -2339,7 +2339,7 @@ public static Product[] CreateProducts() ReorderLevel = 5, Discontinued = false }, - new Product + new() { ProductID = 64, ProductName = "Wimmers gute Semmelknödel", @@ -2352,7 +2352,7 @@ public static Product[] CreateProducts() ReorderLevel = 30, Discontinued = false }, - new Product + new() { ProductID = 65, ProductName = "Louisiana Fiery Hot Pepper Sauce", @@ -2365,7 +2365,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 66, ProductName = "Louisiana Hot Spiced Okra", @@ -2378,7 +2378,7 @@ public static Product[] CreateProducts() ReorderLevel = 20, Discontinued = false }, - new Product + new() { ProductID = 67, ProductName = "Laughing Lumberjack Lager", @@ -2391,7 +2391,7 @@ public static Product[] CreateProducts() ReorderLevel = 10, Discontinued = false }, - new Product + new() { ProductID = 68, ProductName = "Scottish Longbreads", @@ -2404,7 +2404,7 @@ public static Product[] CreateProducts() ReorderLevel = 15, Discontinued = false }, - new Product + new() { ProductID = 69, ProductName = "Gudbrandsdalsost", @@ -2417,7 +2417,7 @@ public static Product[] CreateProducts() ReorderLevel = 15, Discontinued = false }, - new Product + new() { ProductID = 70, ProductName = "Outback Lager", @@ -2430,7 +2430,7 @@ public static Product[] CreateProducts() ReorderLevel = 30, Discontinued = false }, - new Product + new() { ProductID = 71, ProductName = "Flotemysost", @@ -2443,7 +2443,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 72, ProductName = "Mozzarella di Giovanni", @@ -2456,7 +2456,7 @@ public static Product[] CreateProducts() ReorderLevel = 0, Discontinued = false }, - new Product + new() { ProductID = 73, ProductName = "Röd Kaviar", @@ -2469,7 +2469,7 @@ public static Product[] CreateProducts() ReorderLevel = 5, Discontinued = false }, - new Product + new() { ProductID = 74, ProductName = "Longlife Tofu", @@ -2482,7 +2482,7 @@ public static Product[] CreateProducts() ReorderLevel = 5, Discontinued = false }, - new Product + new() { ProductID = 75, ProductName = "Rhönbräu Klosterbier", @@ -2495,7 +2495,7 @@ public static Product[] CreateProducts() ReorderLevel = 25, Discontinued = false }, - new Product + new() { ProductID = 76, ProductName = "Lakkalikööri", @@ -2508,7 +2508,7 @@ public static Product[] CreateProducts() ReorderLevel = 20, Discontinued = false }, - new Product + new() { ProductID = 77, ProductName = "Original Frankfurter grüne Soße", @@ -2530,7 +2530,7 @@ public static Product[] CreateProducts() public static Order[] CreateOrders() => [ - new Order + new() { OrderID = 10248, CustomerID = "VINET", @@ -2548,7 +2548,7 @@ public static Order[] CreateOrders() ShipPostalCode = "51100", ShipCountry = "France" }, - new Order + new() { OrderID = 10249, CustomerID = "TOMSP", @@ -2566,7 +2566,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44087", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10250, CustomerID = "HANAR", @@ -2584,7 +2584,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10251, CustomerID = "VICTE", @@ -2602,7 +2602,7 @@ public static Order[] CreateOrders() ShipPostalCode = "69004", ShipCountry = "France" }, - new Order + new() { OrderID = 10252, CustomerID = "SUPRD", @@ -2620,7 +2620,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10253, CustomerID = "HANAR", @@ -2638,7 +2638,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10254, CustomerID = "CHOPS", @@ -2656,7 +2656,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3012", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10255, CustomerID = "RICSU", @@ -2674,7 +2674,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1204", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10256, CustomerID = "WELLI", @@ -2692,7 +2692,7 @@ public static Order[] CreateOrders() ShipPostalCode = "08737-363", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10257, CustomerID = "HILAA", @@ -2710,7 +2710,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10258, CustomerID = "ERNSH", @@ -2728,7 +2728,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10259, CustomerID = "CENTC", @@ -2746,7 +2746,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05022", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10260, CustomerID = "OTTIK", @@ -2764,7 +2764,7 @@ public static Order[] CreateOrders() ShipPostalCode = "50739", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10261, CustomerID = "QUEDE", @@ -2782,7 +2782,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-673", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10262, CustomerID = "RATTC", @@ -2800,7 +2800,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10263, CustomerID = "ERNSH", @@ -2818,7 +2818,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10264, CustomerID = "FOLKO", @@ -2836,7 +2836,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10265, CustomerID = "BLONP", @@ -2854,7 +2854,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10266, CustomerID = "WARTH", @@ -2872,7 +2872,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10267, CustomerID = "FRANK", @@ -2890,7 +2890,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10268, CustomerID = "GROSR", @@ -2908,7 +2908,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1081", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10269, CustomerID = "WHITC", @@ -2926,7 +2926,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10270, CustomerID = "WARTH", @@ -2944,7 +2944,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10271, CustomerID = "SPLIR", @@ -2962,7 +2962,7 @@ public static Order[] CreateOrders() ShipPostalCode = "82520", ShipCountry = "USA" }, - new Order + new() { OrderID = 10272, CustomerID = "RATTC", @@ -2980,7 +2980,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10273, CustomerID = "QUICK", @@ -2998,7 +2998,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10274, CustomerID = "VINET", @@ -3016,7 +3016,7 @@ public static Order[] CreateOrders() ShipPostalCode = "51100", ShipCountry = "France" }, - new Order + new() { OrderID = 10275, CustomerID = "MAGAA", @@ -3034,7 +3034,7 @@ public static Order[] CreateOrders() ShipPostalCode = "24100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10276, CustomerID = "TORTU", @@ -3052,7 +3052,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10277, CustomerID = "MORGK", @@ -3070,7 +3070,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04179", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10278, CustomerID = "BERGS", @@ -3088,7 +3088,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10279, CustomerID = "LEHMS", @@ -3106,7 +3106,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10280, CustomerID = "BERGS", @@ -3124,7 +3124,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10281, CustomerID = "ROMEY", @@ -3142,7 +3142,7 @@ public static Order[] CreateOrders() ShipPostalCode = "28001", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10282, CustomerID = "ROMEY", @@ -3160,7 +3160,7 @@ public static Order[] CreateOrders() ShipPostalCode = "28001", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10283, CustomerID = "LILAS", @@ -3178,7 +3178,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10284, CustomerID = "LEHMS", @@ -3196,7 +3196,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10285, CustomerID = "QUICK", @@ -3214,7 +3214,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10286, CustomerID = "QUICK", @@ -3232,7 +3232,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10287, CustomerID = "RICAR", @@ -3250,7 +3250,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10288, CustomerID = "REGGC", @@ -3268,7 +3268,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10289, CustomerID = "BSBEV", @@ -3286,7 +3286,7 @@ public static Order[] CreateOrders() ShipPostalCode = "EC2 5NT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10290, CustomerID = "COMMI", @@ -3304,7 +3304,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05432-043", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10291, CustomerID = "QUEDE", @@ -3322,7 +3322,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-673", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10292, CustomerID = "TRADH", @@ -3340,7 +3340,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05634-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10293, CustomerID = "TORTU", @@ -3358,7 +3358,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10294, CustomerID = "RATTC", @@ -3376,7 +3376,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10295, CustomerID = "VINET", @@ -3394,7 +3394,7 @@ public static Order[] CreateOrders() ShipPostalCode = "51100", ShipCountry = "France" }, - new Order + new() { OrderID = 10296, CustomerID = "LILAS", @@ -3412,7 +3412,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10297, CustomerID = "BLONP", @@ -3430,7 +3430,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10298, CustomerID = "HUNGO", @@ -3448,7 +3448,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10299, CustomerID = "RICAR", @@ -3466,7 +3466,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10300, CustomerID = "MAGAA", @@ -3484,7 +3484,7 @@ public static Order[] CreateOrders() ShipPostalCode = "24100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10301, CustomerID = "WANDK", @@ -3502,7 +3502,7 @@ public static Order[] CreateOrders() ShipPostalCode = "70563", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10302, CustomerID = "SUPRD", @@ -3520,7 +3520,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10303, CustomerID = "GODOS", @@ -3538,7 +3538,7 @@ public static Order[] CreateOrders() ShipPostalCode = "41101", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10304, CustomerID = "TORTU", @@ -3556,7 +3556,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10305, CustomerID = "OLDWO", @@ -3574,7 +3574,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99508", ShipCountry = "USA" }, - new Order + new() { OrderID = 10306, CustomerID = "ROMEY", @@ -3592,7 +3592,7 @@ public static Order[] CreateOrders() ShipPostalCode = "28001", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10307, CustomerID = "LONEP", @@ -3610,7 +3610,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97219", ShipCountry = "USA" }, - new Order + new() { OrderID = 10308, CustomerID = "ANATR", @@ -3628,7 +3628,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05021", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10309, CustomerID = "HUNGO", @@ -3646,7 +3646,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10310, CustomerID = "THEBI", @@ -3664,7 +3664,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97201", ShipCountry = "USA" }, - new Order + new() { OrderID = 10311, CustomerID = "DUMON", @@ -3682,7 +3682,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44000", ShipCountry = "France" }, - new Order + new() { OrderID = 10312, CustomerID = "WANDK", @@ -3700,7 +3700,7 @@ public static Order[] CreateOrders() ShipPostalCode = "70563", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10313, CustomerID = "QUICK", @@ -3718,7 +3718,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10314, CustomerID = "RATTC", @@ -3736,7 +3736,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10315, CustomerID = "ISLAT", @@ -3754,7 +3754,7 @@ public static Order[] CreateOrders() ShipPostalCode = "PO31 7PJ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10316, CustomerID = "RATTC", @@ -3772,7 +3772,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10317, CustomerID = "LONEP", @@ -3790,7 +3790,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97219", ShipCountry = "USA" }, - new Order + new() { OrderID = 10318, CustomerID = "ISLAT", @@ -3808,7 +3808,7 @@ public static Order[] CreateOrders() ShipPostalCode = "PO31 7PJ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10319, CustomerID = "TORTU", @@ -3826,7 +3826,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10320, CustomerID = "WARTH", @@ -3844,7 +3844,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10321, CustomerID = "ISLAT", @@ -3862,7 +3862,7 @@ public static Order[] CreateOrders() ShipPostalCode = "PO31 7PJ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10322, CustomerID = "PERIC", @@ -3880,7 +3880,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10323, CustomerID = "KOENE", @@ -3898,7 +3898,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10324, CustomerID = "SAVEA", @@ -3916,7 +3916,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10325, CustomerID = "KOENE", @@ -3934,7 +3934,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10326, CustomerID = "BOLID", @@ -3952,7 +3952,7 @@ public static Order[] CreateOrders() ShipPostalCode = "28023", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10327, CustomerID = "FOLKO", @@ -3970,7 +3970,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10328, CustomerID = "FURIB", @@ -3988,7 +3988,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1675", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10329, CustomerID = "SPLIR", @@ -4006,7 +4006,7 @@ public static Order[] CreateOrders() ShipPostalCode = "82520", ShipCountry = "USA" }, - new Order + new() { OrderID = 10330, CustomerID = "LILAS", @@ -4024,7 +4024,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10331, CustomerID = "BONAP", @@ -4042,7 +4042,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10332, CustomerID = "MEREP", @@ -4060,7 +4060,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10333, CustomerID = "WARTH", @@ -4078,7 +4078,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10334, CustomerID = "VICTE", @@ -4096,7 +4096,7 @@ public static Order[] CreateOrders() ShipPostalCode = "69004", ShipCountry = "France" }, - new Order + new() { OrderID = 10335, CustomerID = "HUNGO", @@ -4114,7 +4114,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10336, CustomerID = "PRINI", @@ -4132,7 +4132,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1756", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10337, CustomerID = "FRANK", @@ -4150,7 +4150,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10338, CustomerID = "OLDWO", @@ -4168,7 +4168,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99508", ShipCountry = "USA" }, - new Order + new() { OrderID = 10339, CustomerID = "MEREP", @@ -4186,7 +4186,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10340, CustomerID = "BONAP", @@ -4204,7 +4204,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10341, CustomerID = "SIMOB", @@ -4222,7 +4222,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1734", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10342, CustomerID = "FRANK", @@ -4240,7 +4240,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10343, CustomerID = "LEHMS", @@ -4258,7 +4258,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10344, CustomerID = "WHITC", @@ -4276,7 +4276,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10345, CustomerID = "QUICK", @@ -4294,7 +4294,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10346, CustomerID = "RATTC", @@ -4312,7 +4312,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10347, CustomerID = "FAMIA", @@ -4330,7 +4330,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05442-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10348, CustomerID = "WANDK", @@ -4348,7 +4348,7 @@ public static Order[] CreateOrders() ShipPostalCode = "70563", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10349, CustomerID = "SPLIR", @@ -4366,7 +4366,7 @@ public static Order[] CreateOrders() ShipPostalCode = "82520", ShipCountry = "USA" }, - new Order + new() { OrderID = 10350, CustomerID = "LAMAI", @@ -4384,7 +4384,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10351, CustomerID = "ERNSH", @@ -4402,7 +4402,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10352, CustomerID = "FURIB", @@ -4420,7 +4420,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1675", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10353, CustomerID = "PICCO", @@ -4438,7 +4438,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5020", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10354, CustomerID = "PERIC", @@ -4456,7 +4456,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10355, CustomerID = "AROUT", @@ -4474,7 +4474,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10356, CustomerID = "WANDK", @@ -4492,7 +4492,7 @@ public static Order[] CreateOrders() ShipPostalCode = "70563", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10357, CustomerID = "LILAS", @@ -4510,7 +4510,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10358, CustomerID = "LAMAI", @@ -4528,7 +4528,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10359, CustomerID = "SEVES", @@ -4546,7 +4546,7 @@ public static Order[] CreateOrders() ShipPostalCode = "OX15 4NB", ShipCountry = "UK" }, - new Order + new() { OrderID = 10360, CustomerID = "BLONP", @@ -4564,7 +4564,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10361, CustomerID = "QUICK", @@ -4582,7 +4582,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10362, CustomerID = "BONAP", @@ -4600,7 +4600,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10363, CustomerID = "DRACD", @@ -4618,7 +4618,7 @@ public static Order[] CreateOrders() ShipPostalCode = "52066", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10364, CustomerID = "EASTC", @@ -4636,7 +4636,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX3 6FW", ShipCountry = "UK" }, - new Order + new() { OrderID = 10365, CustomerID = "ANTON", @@ -4654,7 +4654,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05023", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10366, CustomerID = "GALED", @@ -4672,7 +4672,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8022", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10367, CustomerID = "VAFFE", @@ -4690,7 +4690,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10368, CustomerID = "ERNSH", @@ -4708,7 +4708,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10369, CustomerID = "SPLIR", @@ -4726,7 +4726,7 @@ public static Order[] CreateOrders() ShipPostalCode = "82520", ShipCountry = "USA" }, - new Order + new() { OrderID = 10370, CustomerID = "CHOPS", @@ -4744,7 +4744,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3012", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10371, CustomerID = "LAMAI", @@ -4762,7 +4762,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10372, CustomerID = "QUEEN", @@ -4780,7 +4780,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10373, CustomerID = "HUNGO", @@ -4798,7 +4798,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10374, CustomerID = "WOLZA", @@ -4816,7 +4816,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01-012", ShipCountry = "Poland" }, - new Order + new() { OrderID = 10375, CustomerID = "HUNGC", @@ -4834,7 +4834,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97827", ShipCountry = "USA" }, - new Order + new() { OrderID = 10376, CustomerID = "MEREP", @@ -4852,7 +4852,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10377, CustomerID = "SEVES", @@ -4870,7 +4870,7 @@ public static Order[] CreateOrders() ShipPostalCode = "OX15 4NB", ShipCountry = "UK" }, - new Order + new() { OrderID = 10378, CustomerID = "FOLKO", @@ -4888,7 +4888,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10379, CustomerID = "QUEDE", @@ -4906,7 +4906,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-673", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10380, CustomerID = "HUNGO", @@ -4924,7 +4924,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10381, CustomerID = "LILAS", @@ -4942,7 +4942,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10382, CustomerID = "ERNSH", @@ -4960,7 +4960,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10383, CustomerID = "AROUT", @@ -4978,7 +4978,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10384, CustomerID = "BERGS", @@ -4996,7 +4996,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10385, CustomerID = "SPLIR", @@ -5014,7 +5014,7 @@ public static Order[] CreateOrders() ShipPostalCode = "82520", ShipCountry = "USA" }, - new Order + new() { OrderID = 10386, CustomerID = "FAMIA", @@ -5032,7 +5032,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05442-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10387, CustomerID = "SANTG", @@ -5050,7 +5050,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4110", ShipCountry = "Norway" }, - new Order + new() { OrderID = 10388, CustomerID = "SEVES", @@ -5068,7 +5068,7 @@ public static Order[] CreateOrders() ShipPostalCode = "OX15 4NB", ShipCountry = "UK" }, - new Order + new() { OrderID = 10389, CustomerID = "BOTTM", @@ -5086,7 +5086,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10390, CustomerID = "ERNSH", @@ -5104,7 +5104,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10391, CustomerID = "DRACD", @@ -5122,7 +5122,7 @@ public static Order[] CreateOrders() ShipPostalCode = "52066", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10392, CustomerID = "PICCO", @@ -5140,7 +5140,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5020", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10393, CustomerID = "SAVEA", @@ -5158,7 +5158,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10394, CustomerID = "HUNGC", @@ -5176,7 +5176,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97827", ShipCountry = "USA" }, - new Order + new() { OrderID = 10395, CustomerID = "HILAA", @@ -5194,7 +5194,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10396, CustomerID = "FRANK", @@ -5212,7 +5212,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10397, CustomerID = "PRINI", @@ -5230,7 +5230,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1756", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10398, CustomerID = "SAVEA", @@ -5248,7 +5248,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10399, CustomerID = "VAFFE", @@ -5266,7 +5266,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10400, CustomerID = "EASTC", @@ -5284,7 +5284,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX3 6FW", ShipCountry = "UK" }, - new Order + new() { OrderID = 10401, CustomerID = "RATTC", @@ -5302,7 +5302,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10402, CustomerID = "ERNSH", @@ -5320,7 +5320,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10403, CustomerID = "ERNSH", @@ -5338,7 +5338,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10404, CustomerID = "MAGAA", @@ -5356,7 +5356,7 @@ public static Order[] CreateOrders() ShipPostalCode = "24100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10405, CustomerID = "LINOD", @@ -5374,7 +5374,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10406, CustomerID = "QUEEN", @@ -5392,7 +5392,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10407, CustomerID = "OTTIK", @@ -5410,7 +5410,7 @@ public static Order[] CreateOrders() ShipPostalCode = "50739", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10408, CustomerID = "FOLIG", @@ -5428,7 +5428,7 @@ public static Order[] CreateOrders() ShipPostalCode = "59000", ShipCountry = "France" }, - new Order + new() { OrderID = 10409, CustomerID = "OCEAN", @@ -5446,7 +5446,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10410, CustomerID = "BOTTM", @@ -5464,7 +5464,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10411, CustomerID = "BOTTM", @@ -5482,7 +5482,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10412, CustomerID = "WARTH", @@ -5500,7 +5500,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10413, CustomerID = "LAMAI", @@ -5518,7 +5518,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10414, CustomerID = "FAMIA", @@ -5536,7 +5536,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05442-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10415, CustomerID = "HUNGC", @@ -5554,7 +5554,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97827", ShipCountry = "USA" }, - new Order + new() { OrderID = 10416, CustomerID = "WARTH", @@ -5572,7 +5572,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10417, CustomerID = "SIMOB", @@ -5590,7 +5590,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1734", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10418, CustomerID = "QUICK", @@ -5608,7 +5608,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10419, CustomerID = "RICSU", @@ -5626,7 +5626,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1204", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10420, CustomerID = "WELLI", @@ -5644,7 +5644,7 @@ public static Order[] CreateOrders() ShipPostalCode = "08737-363", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10421, CustomerID = "QUEDE", @@ -5662,7 +5662,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-673", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10422, CustomerID = "FRANS", @@ -5680,7 +5680,7 @@ public static Order[] CreateOrders() ShipPostalCode = "10100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10423, CustomerID = "GOURL", @@ -5698,7 +5698,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04876-786", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10424, CustomerID = "MEREP", @@ -5716,7 +5716,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10425, CustomerID = "LAMAI", @@ -5734,7 +5734,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10426, CustomerID = "GALED", @@ -5752,7 +5752,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8022", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10427, CustomerID = "PICCO", @@ -5770,7 +5770,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5020", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10428, CustomerID = "REGGC", @@ -5788,7 +5788,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10429, CustomerID = "HUNGO", @@ -5806,7 +5806,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10430, CustomerID = "ERNSH", @@ -5824,7 +5824,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10431, CustomerID = "BOTTM", @@ -5842,7 +5842,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10432, CustomerID = "SPLIR", @@ -5860,7 +5860,7 @@ public static Order[] CreateOrders() ShipPostalCode = "82520", ShipCountry = "USA" }, - new Order + new() { OrderID = 10433, CustomerID = "PRINI", @@ -5878,7 +5878,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1756", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10434, CustomerID = "FOLKO", @@ -5896,7 +5896,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10435, CustomerID = "CONSH", @@ -5914,7 +5914,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX1 6LT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10436, CustomerID = "BLONP", @@ -5932,7 +5932,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10437, CustomerID = "WARTH", @@ -5950,7 +5950,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10438, CustomerID = "TOMSP", @@ -5968,7 +5968,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44087", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10439, CustomerID = "MEREP", @@ -5986,7 +5986,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10440, CustomerID = "SAVEA", @@ -6004,7 +6004,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10441, CustomerID = "OLDWO", @@ -6022,7 +6022,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99508", ShipCountry = "USA" }, - new Order + new() { OrderID = 10442, CustomerID = "ERNSH", @@ -6040,7 +6040,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10443, CustomerID = "REGGC", @@ -6058,7 +6058,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10444, CustomerID = "BERGS", @@ -6076,7 +6076,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10445, CustomerID = "BERGS", @@ -6094,7 +6094,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10446, CustomerID = "TOMSP", @@ -6112,7 +6112,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44087", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10447, CustomerID = "RICAR", @@ -6130,7 +6130,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10448, CustomerID = "RANCH", @@ -6148,7 +6148,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10449, CustomerID = "BLONP", @@ -6166,7 +6166,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10450, CustomerID = "VICTE", @@ -6184,7 +6184,7 @@ public static Order[] CreateOrders() ShipPostalCode = "69004", ShipCountry = "France" }, - new Order + new() { OrderID = 10451, CustomerID = "QUICK", @@ -6202,7 +6202,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10452, CustomerID = "SAVEA", @@ -6220,7 +6220,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10453, CustomerID = "AROUT", @@ -6238,7 +6238,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10454, CustomerID = "LAMAI", @@ -6256,7 +6256,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10455, CustomerID = "WARTH", @@ -6274,7 +6274,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10456, CustomerID = "KOENE", @@ -6292,7 +6292,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10457, CustomerID = "KOENE", @@ -6310,7 +6310,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10458, CustomerID = "SUPRD", @@ -6328,7 +6328,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10459, CustomerID = "VICTE", @@ -6346,7 +6346,7 @@ public static Order[] CreateOrders() ShipPostalCode = "69004", ShipCountry = "France" }, - new Order + new() { OrderID = 10460, CustomerID = "FOLKO", @@ -6364,7 +6364,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10461, CustomerID = "LILAS", @@ -6382,7 +6382,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10462, CustomerID = "CONSH", @@ -6400,7 +6400,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX1 6LT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10463, CustomerID = "SUPRD", @@ -6418,7 +6418,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10464, CustomerID = "FURIB", @@ -6436,7 +6436,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1675", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10465, CustomerID = "VAFFE", @@ -6454,7 +6454,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10466, CustomerID = "COMMI", @@ -6472,7 +6472,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05432-043", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10467, CustomerID = "MAGAA", @@ -6490,7 +6490,7 @@ public static Order[] CreateOrders() ShipPostalCode = "24100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10468, CustomerID = "KOENE", @@ -6508,7 +6508,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10469, CustomerID = "WHITC", @@ -6526,7 +6526,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10470, CustomerID = "BONAP", @@ -6544,7 +6544,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10471, CustomerID = "BSBEV", @@ -6562,7 +6562,7 @@ public static Order[] CreateOrders() ShipPostalCode = "EC2 5NT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10472, CustomerID = "SEVES", @@ -6580,7 +6580,7 @@ public static Order[] CreateOrders() ShipPostalCode = "OX15 4NB", ShipCountry = "UK" }, - new Order + new() { OrderID = 10473, CustomerID = "ISLAT", @@ -6598,7 +6598,7 @@ public static Order[] CreateOrders() ShipPostalCode = "PO31 7PJ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10474, CustomerID = "PERIC", @@ -6616,7 +6616,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10475, CustomerID = "SUPRD", @@ -6634,7 +6634,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10476, CustomerID = "HILAA", @@ -6652,7 +6652,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10477, CustomerID = "PRINI", @@ -6670,7 +6670,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1756", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10478, CustomerID = "VICTE", @@ -6688,7 +6688,7 @@ public static Order[] CreateOrders() ShipPostalCode = "69004", ShipCountry = "France" }, - new Order + new() { OrderID = 10479, CustomerID = "RATTC", @@ -6706,7 +6706,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10480, CustomerID = "FOLIG", @@ -6724,7 +6724,7 @@ public static Order[] CreateOrders() ShipPostalCode = "59000", ShipCountry = "France" }, - new Order + new() { OrderID = 10481, CustomerID = "RICAR", @@ -6742,7 +6742,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10482, CustomerID = "LAZYK", @@ -6760,7 +6760,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99362", ShipCountry = "USA" }, - new Order + new() { OrderID = 10483, CustomerID = "WHITC", @@ -6778,7 +6778,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10484, CustomerID = "BSBEV", @@ -6796,7 +6796,7 @@ public static Order[] CreateOrders() ShipPostalCode = "EC2 5NT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10485, CustomerID = "LINOD", @@ -6814,7 +6814,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10486, CustomerID = "HILAA", @@ -6832,7 +6832,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10487, CustomerID = "QUEEN", @@ -6850,7 +6850,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10488, CustomerID = "FRANK", @@ -6868,7 +6868,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10489, CustomerID = "PICCO", @@ -6886,7 +6886,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5020", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10490, CustomerID = "HILAA", @@ -6904,7 +6904,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10491, CustomerID = "FURIB", @@ -6922,7 +6922,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1675", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10492, CustomerID = "BOTTM", @@ -6940,7 +6940,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10493, CustomerID = "LAMAI", @@ -6958,7 +6958,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10494, CustomerID = "COMMI", @@ -6976,7 +6976,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05432-043", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10495, CustomerID = "LAUGB", @@ -6994,7 +6994,7 @@ public static Order[] CreateOrders() ShipPostalCode = "V3F 2K1", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10496, CustomerID = "TRADH", @@ -7012,7 +7012,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05634-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10497, CustomerID = "LEHMS", @@ -7030,7 +7030,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10498, CustomerID = "HILAA", @@ -7048,7 +7048,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10499, CustomerID = "LILAS", @@ -7066,7 +7066,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10500, CustomerID = "LAMAI", @@ -7084,7 +7084,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10501, CustomerID = "BLAUS", @@ -7102,7 +7102,7 @@ public static Order[] CreateOrders() ShipPostalCode = "68306", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10502, CustomerID = "PERIC", @@ -7120,7 +7120,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10503, CustomerID = "HUNGO", @@ -7138,7 +7138,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10504, CustomerID = "WHITC", @@ -7156,7 +7156,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10505, CustomerID = "MEREP", @@ -7174,7 +7174,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10506, CustomerID = "KOENE", @@ -7192,7 +7192,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10507, CustomerID = "ANTON", @@ -7210,7 +7210,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05023", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10508, CustomerID = "OTTIK", @@ -7228,7 +7228,7 @@ public static Order[] CreateOrders() ShipPostalCode = "50739", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10509, CustomerID = "BLAUS", @@ -7246,7 +7246,7 @@ public static Order[] CreateOrders() ShipPostalCode = "68306", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10510, CustomerID = "SAVEA", @@ -7264,7 +7264,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10511, CustomerID = "BONAP", @@ -7282,7 +7282,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10512, CustomerID = "FAMIA", @@ -7300,7 +7300,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05442-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10513, CustomerID = "WANDK", @@ -7318,7 +7318,7 @@ public static Order[] CreateOrders() ShipPostalCode = "70563", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10514, CustomerID = "ERNSH", @@ -7336,7 +7336,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10515, CustomerID = "QUICK", @@ -7354,7 +7354,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10516, CustomerID = "HUNGO", @@ -7372,7 +7372,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10517, CustomerID = "NORTS", @@ -7390,7 +7390,7 @@ public static Order[] CreateOrders() ShipPostalCode = "SW7 1RZ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10518, CustomerID = "TORTU", @@ -7408,7 +7408,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10519, CustomerID = "CHOPS", @@ -7426,7 +7426,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3012", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10520, CustomerID = "SANTG", @@ -7444,7 +7444,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4110", ShipCountry = "Norway" }, - new Order + new() { OrderID = 10521, CustomerID = "CACTU", @@ -7462,7 +7462,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10522, CustomerID = "LEHMS", @@ -7480,7 +7480,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10523, CustomerID = "SEVES", @@ -7498,7 +7498,7 @@ public static Order[] CreateOrders() ShipPostalCode = "OX15 4NB", ShipCountry = "UK" }, - new Order + new() { OrderID = 10524, CustomerID = "BERGS", @@ -7516,7 +7516,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10525, CustomerID = "BONAP", @@ -7534,7 +7534,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10526, CustomerID = "WARTH", @@ -7552,7 +7552,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10527, CustomerID = "QUICK", @@ -7570,7 +7570,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10528, CustomerID = "GREAL", @@ -7588,7 +7588,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 10529, CustomerID = "MAISD", @@ -7606,7 +7606,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-1180", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10530, CustomerID = "PICCO", @@ -7624,7 +7624,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5020", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10531, CustomerID = "OCEAN", @@ -7642,7 +7642,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10532, CustomerID = "EASTC", @@ -7660,7 +7660,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX3 6FW", ShipCountry = "UK" }, - new Order + new() { OrderID = 10533, CustomerID = "FOLKO", @@ -7678,7 +7678,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10534, CustomerID = "LEHMS", @@ -7696,7 +7696,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10535, CustomerID = "ANTON", @@ -7714,7 +7714,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05023", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10536, CustomerID = "LEHMS", @@ -7732,7 +7732,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10537, CustomerID = "RICSU", @@ -7750,7 +7750,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1204", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10538, CustomerID = "BSBEV", @@ -7768,7 +7768,7 @@ public static Order[] CreateOrders() ShipPostalCode = "EC2 5NT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10539, CustomerID = "BSBEV", @@ -7786,7 +7786,7 @@ public static Order[] CreateOrders() ShipPostalCode = "EC2 5NT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10540, CustomerID = "QUICK", @@ -7804,7 +7804,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10541, CustomerID = "HANAR", @@ -7822,7 +7822,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10542, CustomerID = "KOENE", @@ -7840,7 +7840,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10543, CustomerID = "LILAS", @@ -7858,7 +7858,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10544, CustomerID = "LONEP", @@ -7876,7 +7876,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97219", ShipCountry = "USA" }, - new Order + new() { OrderID = 10545, CustomerID = "LAZYK", @@ -7894,7 +7894,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99362", ShipCountry = "USA" }, - new Order + new() { OrderID = 10546, CustomerID = "VICTE", @@ -7912,7 +7912,7 @@ public static Order[] CreateOrders() ShipPostalCode = "69004", ShipCountry = "France" }, - new Order + new() { OrderID = 10547, CustomerID = "SEVES", @@ -7930,7 +7930,7 @@ public static Order[] CreateOrders() ShipPostalCode = "OX15 4NB", ShipCountry = "UK" }, - new Order + new() { OrderID = 10548, CustomerID = "TOMSP", @@ -7948,7 +7948,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44087", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10549, CustomerID = "QUICK", @@ -7966,7 +7966,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10550, CustomerID = "GODOS", @@ -7984,7 +7984,7 @@ public static Order[] CreateOrders() ShipPostalCode = "41101", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10551, CustomerID = "FURIB", @@ -8002,7 +8002,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1675", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10552, CustomerID = "HILAA", @@ -8020,7 +8020,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10553, CustomerID = "WARTH", @@ -8038,7 +8038,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10554, CustomerID = "OTTIK", @@ -8056,7 +8056,7 @@ public static Order[] CreateOrders() ShipPostalCode = "50739", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10555, CustomerID = "SAVEA", @@ -8074,7 +8074,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10556, CustomerID = "SIMOB", @@ -8092,7 +8092,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1734", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10557, CustomerID = "LEHMS", @@ -8110,7 +8110,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10558, CustomerID = "AROUT", @@ -8128,7 +8128,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10559, CustomerID = "BLONP", @@ -8146,7 +8146,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10560, CustomerID = "FRANK", @@ -8164,7 +8164,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10561, CustomerID = "FOLKO", @@ -8182,7 +8182,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10562, CustomerID = "REGGC", @@ -8200,7 +8200,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10563, CustomerID = "RICAR", @@ -8218,7 +8218,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10564, CustomerID = "RATTC", @@ -8236,7 +8236,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10565, CustomerID = "MEREP", @@ -8254,7 +8254,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10566, CustomerID = "BLONP", @@ -8272,7 +8272,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10567, CustomerID = "HUNGO", @@ -8290,7 +8290,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10568, CustomerID = "GALED", @@ -8308,7 +8308,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8022", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10569, CustomerID = "RATTC", @@ -8326,7 +8326,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10570, CustomerID = "MEREP", @@ -8344,7 +8344,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10571, CustomerID = "ERNSH", @@ -8362,7 +8362,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10572, CustomerID = "BERGS", @@ -8380,7 +8380,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10573, CustomerID = "ANTON", @@ -8398,7 +8398,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05023", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10574, CustomerID = "TRAIH", @@ -8416,7 +8416,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98034", ShipCountry = "USA" }, - new Order + new() { OrderID = 10575, CustomerID = "MORGK", @@ -8434,7 +8434,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04179", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10576, CustomerID = "TORTU", @@ -8452,7 +8452,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10577, CustomerID = "TRAIH", @@ -8470,7 +8470,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98034", ShipCountry = "USA" }, - new Order + new() { OrderID = 10578, CustomerID = "BSBEV", @@ -8488,7 +8488,7 @@ public static Order[] CreateOrders() ShipPostalCode = "EC2 5NT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10579, CustomerID = "LETSS", @@ -8506,7 +8506,7 @@ public static Order[] CreateOrders() ShipPostalCode = "94117", ShipCountry = "USA" }, - new Order + new() { OrderID = 10580, CustomerID = "OTTIK", @@ -8524,7 +8524,7 @@ public static Order[] CreateOrders() ShipPostalCode = "50739", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10581, CustomerID = "FAMIA", @@ -8542,7 +8542,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05442-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10582, CustomerID = "BLAUS", @@ -8560,7 +8560,7 @@ public static Order[] CreateOrders() ShipPostalCode = "68306", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10583, CustomerID = "WARTH", @@ -8578,7 +8578,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10584, CustomerID = "BLONP", @@ -8596,7 +8596,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10585, CustomerID = "WELLI", @@ -8614,7 +8614,7 @@ public static Order[] CreateOrders() ShipPostalCode = "08737-363", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10586, CustomerID = "REGGC", @@ -8632,7 +8632,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10587, CustomerID = "QUEDE", @@ -8650,7 +8650,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-673", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10588, CustomerID = "QUICK", @@ -8668,7 +8668,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10589, CustomerID = "GREAL", @@ -8686,7 +8686,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 10590, CustomerID = "MEREP", @@ -8704,7 +8704,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10591, CustomerID = "VAFFE", @@ -8722,7 +8722,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10592, CustomerID = "LEHMS", @@ -8740,7 +8740,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10593, CustomerID = "LEHMS", @@ -8758,7 +8758,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10594, CustomerID = "OLDWO", @@ -8776,7 +8776,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99508", ShipCountry = "USA" }, - new Order + new() { OrderID = 10595, CustomerID = "ERNSH", @@ -8794,7 +8794,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10596, CustomerID = "WHITC", @@ -8812,7 +8812,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10597, CustomerID = "PICCO", @@ -8830,7 +8830,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5020", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10598, CustomerID = "RATTC", @@ -8848,7 +8848,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10599, CustomerID = "BSBEV", @@ -8866,7 +8866,7 @@ public static Order[] CreateOrders() ShipPostalCode = "EC2 5NT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10600, CustomerID = "HUNGC", @@ -8884,7 +8884,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97827", ShipCountry = "USA" }, - new Order + new() { OrderID = 10601, CustomerID = "HILAA", @@ -8902,7 +8902,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10602, CustomerID = "VAFFE", @@ -8920,7 +8920,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10603, CustomerID = "SAVEA", @@ -8938,7 +8938,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10604, CustomerID = "FURIB", @@ -8956,7 +8956,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1675", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10605, CustomerID = "MEREP", @@ -8974,7 +8974,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10606, CustomerID = "TRADH", @@ -8992,7 +8992,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05634-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10607, CustomerID = "SAVEA", @@ -9010,7 +9010,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10608, CustomerID = "TOMSP", @@ -9028,7 +9028,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44087", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10609, CustomerID = "DUMON", @@ -9046,7 +9046,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44000", ShipCountry = "France" }, - new Order + new() { OrderID = 10610, CustomerID = "LAMAI", @@ -9064,7 +9064,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10611, CustomerID = "WOLZA", @@ -9082,7 +9082,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01-012", ShipCountry = "Poland" }, - new Order + new() { OrderID = 10612, CustomerID = "SAVEA", @@ -9100,7 +9100,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10613, CustomerID = "HILAA", @@ -9118,7 +9118,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10614, CustomerID = "BLAUS", @@ -9136,7 +9136,7 @@ public static Order[] CreateOrders() ShipPostalCode = "68306", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10615, CustomerID = "WILMK", @@ -9154,7 +9154,7 @@ public static Order[] CreateOrders() ShipPostalCode = "21240", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10616, CustomerID = "GREAL", @@ -9172,7 +9172,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 10617, CustomerID = "GREAL", @@ -9190,7 +9190,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 10618, CustomerID = "MEREP", @@ -9208,7 +9208,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10619, CustomerID = "MEREP", @@ -9226,7 +9226,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10620, CustomerID = "LAUGB", @@ -9244,7 +9244,7 @@ public static Order[] CreateOrders() ShipPostalCode = "V3F 2K1", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10621, CustomerID = "ISLAT", @@ -9262,7 +9262,7 @@ public static Order[] CreateOrders() ShipPostalCode = "PO31 7PJ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10622, CustomerID = "RICAR", @@ -9280,7 +9280,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10623, CustomerID = "FRANK", @@ -9298,7 +9298,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10624, CustomerID = "THECR", @@ -9316,7 +9316,7 @@ public static Order[] CreateOrders() ShipPostalCode = "59801", ShipCountry = "USA" }, - new Order + new() { OrderID = 10625, CustomerID = "ANATR", @@ -9334,7 +9334,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05021", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10626, CustomerID = "BERGS", @@ -9352,7 +9352,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10627, CustomerID = "SAVEA", @@ -9370,7 +9370,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10628, CustomerID = "BLONP", @@ -9388,7 +9388,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10629, CustomerID = "GODOS", @@ -9406,7 +9406,7 @@ public static Order[] CreateOrders() ShipPostalCode = "41101", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10630, CustomerID = "KOENE", @@ -9424,7 +9424,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10631, CustomerID = "LAMAI", @@ -9442,7 +9442,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10632, CustomerID = "WANDK", @@ -9460,7 +9460,7 @@ public static Order[] CreateOrders() ShipPostalCode = "70563", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10633, CustomerID = "ERNSH", @@ -9478,7 +9478,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10634, CustomerID = "FOLIG", @@ -9496,7 +9496,7 @@ public static Order[] CreateOrders() ShipPostalCode = "59000", ShipCountry = "France" }, - new Order + new() { OrderID = 10635, CustomerID = "MAGAA", @@ -9514,7 +9514,7 @@ public static Order[] CreateOrders() ShipPostalCode = "24100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10636, CustomerID = "WARTH", @@ -9532,7 +9532,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10637, CustomerID = "QUEEN", @@ -9550,7 +9550,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10638, CustomerID = "LINOD", @@ -9568,7 +9568,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10639, CustomerID = "SANTG", @@ -9586,7 +9586,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4110", ShipCountry = "Norway" }, - new Order + new() { OrderID = 10640, CustomerID = "WANDK", @@ -9604,7 +9604,7 @@ public static Order[] CreateOrders() ShipPostalCode = "70563", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10641, CustomerID = "HILAA", @@ -9622,7 +9622,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10642, CustomerID = "SIMOB", @@ -9640,7 +9640,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1734", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10643, CustomerID = "ALFKI", @@ -9658,7 +9658,7 @@ public static Order[] CreateOrders() ShipPostalCode = "12209", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10644, CustomerID = "WELLI", @@ -9676,7 +9676,7 @@ public static Order[] CreateOrders() ShipPostalCode = "08737-363", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10645, CustomerID = "HANAR", @@ -9694,7 +9694,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10646, CustomerID = "HUNGO", @@ -9712,7 +9712,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10647, CustomerID = "QUEDE", @@ -9730,7 +9730,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-673", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10648, CustomerID = "RICAR", @@ -9748,7 +9748,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10649, CustomerID = "MAISD", @@ -9766,7 +9766,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-1180", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10650, CustomerID = "FAMIA", @@ -9784,7 +9784,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05442-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10651, CustomerID = "WANDK", @@ -9802,7 +9802,7 @@ public static Order[] CreateOrders() ShipPostalCode = "70563", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10652, CustomerID = "GOURL", @@ -9820,7 +9820,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04876-786", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10653, CustomerID = "FRANK", @@ -9838,7 +9838,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10654, CustomerID = "BERGS", @@ -9856,7 +9856,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10655, CustomerID = "REGGC", @@ -9874,7 +9874,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10656, CustomerID = "GREAL", @@ -9892,7 +9892,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 10657, CustomerID = "SAVEA", @@ -9910,7 +9910,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10658, CustomerID = "QUICK", @@ -9928,7 +9928,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10659, CustomerID = "QUEEN", @@ -9946,7 +9946,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10660, CustomerID = "HUNGC", @@ -9964,7 +9964,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97827", ShipCountry = "USA" }, - new Order + new() { OrderID = 10661, CustomerID = "HUNGO", @@ -9982,7 +9982,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10662, CustomerID = "LONEP", @@ -10000,7 +10000,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97219", ShipCountry = "USA" }, - new Order + new() { OrderID = 10663, CustomerID = "BONAP", @@ -10018,7 +10018,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10664, CustomerID = "FURIB", @@ -10036,7 +10036,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1675", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10665, CustomerID = "LONEP", @@ -10054,7 +10054,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97219", ShipCountry = "USA" }, - new Order + new() { OrderID = 10666, CustomerID = "RICSU", @@ -10072,7 +10072,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1204", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10667, CustomerID = "ERNSH", @@ -10090,7 +10090,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10668, CustomerID = "WANDK", @@ -10108,7 +10108,7 @@ public static Order[] CreateOrders() ShipPostalCode = "70563", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10669, CustomerID = "SIMOB", @@ -10126,7 +10126,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1734", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10670, CustomerID = "FRANK", @@ -10144,7 +10144,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10671, CustomerID = "FRANR", @@ -10162,7 +10162,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44000", ShipCountry = "France" }, - new Order + new() { OrderID = 10672, CustomerID = "BERGS", @@ -10180,7 +10180,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10673, CustomerID = "WILMK", @@ -10198,7 +10198,7 @@ public static Order[] CreateOrders() ShipPostalCode = "21240", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10674, CustomerID = "ISLAT", @@ -10216,7 +10216,7 @@ public static Order[] CreateOrders() ShipPostalCode = "PO31 7PJ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10675, CustomerID = "FRANK", @@ -10234,7 +10234,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10676, CustomerID = "TORTU", @@ -10252,7 +10252,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10677, CustomerID = "ANTON", @@ -10270,7 +10270,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05023", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10678, CustomerID = "SAVEA", @@ -10288,7 +10288,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10679, CustomerID = "BLONP", @@ -10306,7 +10306,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10680, CustomerID = "OLDWO", @@ -10324,7 +10324,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99508", ShipCountry = "USA" }, - new Order + new() { OrderID = 10681, CustomerID = "GREAL", @@ -10342,7 +10342,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 10682, CustomerID = "ANTON", @@ -10360,7 +10360,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05023", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10683, CustomerID = "DUMON", @@ -10378,7 +10378,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44000", ShipCountry = "France" }, - new Order + new() { OrderID = 10684, CustomerID = "OTTIK", @@ -10396,7 +10396,7 @@ public static Order[] CreateOrders() ShipPostalCode = "50739", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10685, CustomerID = "GOURL", @@ -10414,7 +10414,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04876-786", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10686, CustomerID = "PICCO", @@ -10432,7 +10432,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5020", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10687, CustomerID = "HUNGO", @@ -10450,7 +10450,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10688, CustomerID = "VAFFE", @@ -10468,7 +10468,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10689, CustomerID = "BERGS", @@ -10486,7 +10486,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10690, CustomerID = "HANAR", @@ -10504,7 +10504,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10691, CustomerID = "QUICK", @@ -10522,7 +10522,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10692, CustomerID = "ALFKI", @@ -10540,7 +10540,7 @@ public static Order[] CreateOrders() ShipPostalCode = "12209", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10693, CustomerID = "WHITC", @@ -10558,7 +10558,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10694, CustomerID = "QUICK", @@ -10576,7 +10576,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10695, CustomerID = "WILMK", @@ -10594,7 +10594,7 @@ public static Order[] CreateOrders() ShipPostalCode = "21240", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10696, CustomerID = "WHITC", @@ -10612,7 +10612,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10697, CustomerID = "LINOD", @@ -10630,7 +10630,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10698, CustomerID = "ERNSH", @@ -10648,7 +10648,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10699, CustomerID = "MORGK", @@ -10666,7 +10666,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04179", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10700, CustomerID = "SAVEA", @@ -10684,7 +10684,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10701, CustomerID = "HUNGO", @@ -10702,7 +10702,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10702, CustomerID = "ALFKI", @@ -10720,7 +10720,7 @@ public static Order[] CreateOrders() ShipPostalCode = "12209", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10703, CustomerID = "FOLKO", @@ -10738,7 +10738,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10704, CustomerID = "QUEEN", @@ -10756,7 +10756,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10705, CustomerID = "HILAA", @@ -10774,7 +10774,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10706, CustomerID = "OLDWO", @@ -10792,7 +10792,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99508", ShipCountry = "USA" }, - new Order + new() { OrderID = 10707, CustomerID = "AROUT", @@ -10810,7 +10810,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10708, CustomerID = "THEBI", @@ -10828,7 +10828,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97201", ShipCountry = "USA" }, - new Order + new() { OrderID = 10709, CustomerID = "GOURL", @@ -10846,7 +10846,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04876-786", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10710, CustomerID = "FRANS", @@ -10864,7 +10864,7 @@ public static Order[] CreateOrders() ShipPostalCode = "10100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10711, CustomerID = "SAVEA", @@ -10882,7 +10882,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10712, CustomerID = "HUNGO", @@ -10900,7 +10900,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10713, CustomerID = "SAVEA", @@ -10918,7 +10918,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10714, CustomerID = "SAVEA", @@ -10936,7 +10936,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10715, CustomerID = "BONAP", @@ -10954,7 +10954,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10716, CustomerID = "RANCH", @@ -10972,7 +10972,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10717, CustomerID = "FRANK", @@ -10990,7 +10990,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10718, CustomerID = "KOENE", @@ -11008,7 +11008,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10719, CustomerID = "LETSS", @@ -11026,7 +11026,7 @@ public static Order[] CreateOrders() ShipPostalCode = "94117", ShipCountry = "USA" }, - new Order + new() { OrderID = 10720, CustomerID = "QUEDE", @@ -11044,7 +11044,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-673", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10721, CustomerID = "QUICK", @@ -11062,7 +11062,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10722, CustomerID = "SAVEA", @@ -11080,7 +11080,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10723, CustomerID = "WHITC", @@ -11098,7 +11098,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10724, CustomerID = "MEREP", @@ -11116,7 +11116,7 @@ public static Order[] CreateOrders() ShipPostalCode = "H1J 1C3", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10725, CustomerID = "FAMIA", @@ -11134,7 +11134,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05442-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10726, CustomerID = "EASTC", @@ -11152,7 +11152,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX3 6FW", ShipCountry = "UK" }, - new Order + new() { OrderID = 10727, CustomerID = "REGGC", @@ -11170,7 +11170,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10728, CustomerID = "QUEEN", @@ -11188,7 +11188,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10729, CustomerID = "LINOD", @@ -11206,7 +11206,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10730, CustomerID = "BONAP", @@ -11224,7 +11224,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10731, CustomerID = "CHOPS", @@ -11242,7 +11242,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3012", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10732, CustomerID = "BONAP", @@ -11260,7 +11260,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10733, CustomerID = "BERGS", @@ -11278,7 +11278,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10734, CustomerID = "GOURL", @@ -11296,7 +11296,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04876-786", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10735, CustomerID = "LETSS", @@ -11314,7 +11314,7 @@ public static Order[] CreateOrders() ShipPostalCode = "94117", ShipCountry = "USA" }, - new Order + new() { OrderID = 10736, CustomerID = "HUNGO", @@ -11332,7 +11332,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10737, CustomerID = "VINET", @@ -11350,7 +11350,7 @@ public static Order[] CreateOrders() ShipPostalCode = "51100", ShipCountry = "France" }, - new Order + new() { OrderID = 10738, CustomerID = "SPECD", @@ -11368,7 +11368,7 @@ public static Order[] CreateOrders() ShipPostalCode = "75016", ShipCountry = "France" }, - new Order + new() { OrderID = 10739, CustomerID = "VINET", @@ -11386,7 +11386,7 @@ public static Order[] CreateOrders() ShipPostalCode = "51100", ShipCountry = "France" }, - new Order + new() { OrderID = 10740, CustomerID = "WHITC", @@ -11404,7 +11404,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10741, CustomerID = "AROUT", @@ -11422,7 +11422,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10742, CustomerID = "BOTTM", @@ -11440,7 +11440,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10743, CustomerID = "AROUT", @@ -11458,7 +11458,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10744, CustomerID = "VAFFE", @@ -11476,7 +11476,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10745, CustomerID = "QUICK", @@ -11494,7 +11494,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10746, CustomerID = "CHOPS", @@ -11512,7 +11512,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3012", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10747, CustomerID = "PICCO", @@ -11530,7 +11530,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5020", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10748, CustomerID = "SAVEA", @@ -11548,7 +11548,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10749, CustomerID = "ISLAT", @@ -11566,7 +11566,7 @@ public static Order[] CreateOrders() ShipPostalCode = "PO31 7PJ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10750, CustomerID = "WARTH", @@ -11584,7 +11584,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10751, CustomerID = "RICSU", @@ -11602,7 +11602,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1204", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10752, CustomerID = "NORTS", @@ -11620,7 +11620,7 @@ public static Order[] CreateOrders() ShipPostalCode = "SW7 1RZ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10753, CustomerID = "FRANS", @@ -11638,7 +11638,7 @@ public static Order[] CreateOrders() ShipPostalCode = "10100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10754, CustomerID = "MAGAA", @@ -11656,7 +11656,7 @@ public static Order[] CreateOrders() ShipPostalCode = "24100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10755, CustomerID = "BONAP", @@ -11674,7 +11674,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10756, CustomerID = "SPLIR", @@ -11692,7 +11692,7 @@ public static Order[] CreateOrders() ShipPostalCode = "82520", ShipCountry = "USA" }, - new Order + new() { OrderID = 10757, CustomerID = "SAVEA", @@ -11710,7 +11710,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10758, CustomerID = "RICSU", @@ -11728,7 +11728,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1204", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10759, CustomerID = "ANATR", @@ -11746,7 +11746,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05021", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10760, CustomerID = "MAISD", @@ -11764,7 +11764,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-1180", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10761, CustomerID = "RATTC", @@ -11782,7 +11782,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10762, CustomerID = "FOLKO", @@ -11800,7 +11800,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10763, CustomerID = "FOLIG", @@ -11818,7 +11818,7 @@ public static Order[] CreateOrders() ShipPostalCode = "59000", ShipCountry = "France" }, - new Order + new() { OrderID = 10764, CustomerID = "ERNSH", @@ -11836,7 +11836,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10765, CustomerID = "QUICK", @@ -11854,7 +11854,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10766, CustomerID = "OTTIK", @@ -11872,7 +11872,7 @@ public static Order[] CreateOrders() ShipPostalCode = "50739", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10767, CustomerID = "SUPRD", @@ -11890,7 +11890,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10768, CustomerID = "AROUT", @@ -11908,7 +11908,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10769, CustomerID = "VAFFE", @@ -11926,7 +11926,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10770, CustomerID = "HANAR", @@ -11944,7 +11944,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10771, CustomerID = "ERNSH", @@ -11962,7 +11962,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10772, CustomerID = "LEHMS", @@ -11980,7 +11980,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10773, CustomerID = "ERNSH", @@ -11998,7 +11998,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10774, CustomerID = "FOLKO", @@ -12016,7 +12016,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10775, CustomerID = "THECR", @@ -12034,7 +12034,7 @@ public static Order[] CreateOrders() ShipPostalCode = "59801", ShipCountry = "USA" }, - new Order + new() { OrderID = 10776, CustomerID = "ERNSH", @@ -12052,7 +12052,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10777, CustomerID = "GOURL", @@ -12070,7 +12070,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04876-786", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10778, CustomerID = "BERGS", @@ -12088,7 +12088,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10779, CustomerID = "MORGK", @@ -12106,7 +12106,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04179", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10780, CustomerID = "LILAS", @@ -12124,7 +12124,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10781, CustomerID = "WARTH", @@ -12142,7 +12142,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10782, CustomerID = "CACTU", @@ -12160,7 +12160,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10783, CustomerID = "HANAR", @@ -12178,7 +12178,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10784, CustomerID = "MAGAA", @@ -12196,7 +12196,7 @@ public static Order[] CreateOrders() ShipPostalCode = "24100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10785, CustomerID = "GROSR", @@ -12214,7 +12214,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1081", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10786, CustomerID = "QUEEN", @@ -12232,7 +12232,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10787, CustomerID = "LAMAI", @@ -12250,7 +12250,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10788, CustomerID = "QUICK", @@ -12268,7 +12268,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10789, CustomerID = "FOLIG", @@ -12286,7 +12286,7 @@ public static Order[] CreateOrders() ShipPostalCode = "59000", ShipCountry = "France" }, - new Order + new() { OrderID = 10790, CustomerID = "GOURL", @@ -12304,7 +12304,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04876-786", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10791, CustomerID = "FRANK", @@ -12322,7 +12322,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10792, CustomerID = "WOLZA", @@ -12340,7 +12340,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01-012", ShipCountry = "Poland" }, - new Order + new() { OrderID = 10793, CustomerID = "AROUT", @@ -12358,7 +12358,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10794, CustomerID = "QUEDE", @@ -12376,7 +12376,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-673", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10795, CustomerID = "ERNSH", @@ -12394,7 +12394,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10796, CustomerID = "HILAA", @@ -12412,7 +12412,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10797, CustomerID = "DRACD", @@ -12430,7 +12430,7 @@ public static Order[] CreateOrders() ShipPostalCode = "52066", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10798, CustomerID = "ISLAT", @@ -12448,7 +12448,7 @@ public static Order[] CreateOrders() ShipPostalCode = "PO31 7PJ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10799, CustomerID = "KOENE", @@ -12466,7 +12466,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10800, CustomerID = "SEVES", @@ -12484,7 +12484,7 @@ public static Order[] CreateOrders() ShipPostalCode = "OX15 4NB", ShipCountry = "UK" }, - new Order + new() { OrderID = 10801, CustomerID = "BOLID", @@ -12502,7 +12502,7 @@ public static Order[] CreateOrders() ShipPostalCode = "28023", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10802, CustomerID = "SIMOB", @@ -12520,7 +12520,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1734", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10803, CustomerID = "WELLI", @@ -12538,7 +12538,7 @@ public static Order[] CreateOrders() ShipPostalCode = "08737-363", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10804, CustomerID = "SEVES", @@ -12556,7 +12556,7 @@ public static Order[] CreateOrders() ShipPostalCode = "OX15 4NB", ShipCountry = "UK" }, - new Order + new() { OrderID = 10805, CustomerID = "THEBI", @@ -12574,7 +12574,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97201", ShipCountry = "USA" }, - new Order + new() { OrderID = 10806, CustomerID = "VICTE", @@ -12592,7 +12592,7 @@ public static Order[] CreateOrders() ShipPostalCode = "69004", ShipCountry = "France" }, - new Order + new() { OrderID = 10807, CustomerID = "FRANS", @@ -12610,7 +12610,7 @@ public static Order[] CreateOrders() ShipPostalCode = "10100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10808, CustomerID = "OLDWO", @@ -12628,7 +12628,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99508", ShipCountry = "USA" }, - new Order + new() { OrderID = 10809, CustomerID = "WELLI", @@ -12646,7 +12646,7 @@ public static Order[] CreateOrders() ShipPostalCode = "08737-363", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10810, CustomerID = "LAUGB", @@ -12664,7 +12664,7 @@ public static Order[] CreateOrders() ShipPostalCode = "V3F 2K1", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10811, CustomerID = "LINOD", @@ -12682,7 +12682,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10812, CustomerID = "REGGC", @@ -12700,7 +12700,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10813, CustomerID = "RICAR", @@ -12718,7 +12718,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10814, CustomerID = "VICTE", @@ -12736,7 +12736,7 @@ public static Order[] CreateOrders() ShipPostalCode = "69004", ShipCountry = "France" }, - new Order + new() { OrderID = 10815, CustomerID = "SAVEA", @@ -12754,7 +12754,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10816, CustomerID = "GREAL", @@ -12772,7 +12772,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 10817, CustomerID = "KOENE", @@ -12790,7 +12790,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10818, CustomerID = "MAGAA", @@ -12808,7 +12808,7 @@ public static Order[] CreateOrders() ShipPostalCode = "24100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10819, CustomerID = "CACTU", @@ -12826,7 +12826,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10820, CustomerID = "RATTC", @@ -12844,7 +12844,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10821, CustomerID = "SPLIR", @@ -12862,7 +12862,7 @@ public static Order[] CreateOrders() ShipPostalCode = "82520", ShipCountry = "USA" }, - new Order + new() { OrderID = 10822, CustomerID = "TRAIH", @@ -12880,7 +12880,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98034", ShipCountry = "USA" }, - new Order + new() { OrderID = 10823, CustomerID = "LILAS", @@ -12898,7 +12898,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10824, CustomerID = "FOLKO", @@ -12916,7 +12916,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10825, CustomerID = "DRACD", @@ -12934,7 +12934,7 @@ public static Order[] CreateOrders() ShipPostalCode = "52066", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10826, CustomerID = "BLONP", @@ -12952,7 +12952,7 @@ public static Order[] CreateOrders() ShipPostalCode = "67000", ShipCountry = "France" }, - new Order + new() { OrderID = 10827, CustomerID = "BONAP", @@ -12970,7 +12970,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10828, CustomerID = "RANCH", @@ -12988,7 +12988,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10829, CustomerID = "ISLAT", @@ -13006,7 +13006,7 @@ public static Order[] CreateOrders() ShipPostalCode = "PO31 7PJ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10830, CustomerID = "TRADH", @@ -13024,7 +13024,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05634-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10831, CustomerID = "SANTG", @@ -13042,7 +13042,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4110", ShipCountry = "Norway" }, - new Order + new() { OrderID = 10832, CustomerID = "LAMAI", @@ -13060,7 +13060,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10833, CustomerID = "OTTIK", @@ -13078,7 +13078,7 @@ public static Order[] CreateOrders() ShipPostalCode = "50739", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10834, CustomerID = "TRADH", @@ -13096,7 +13096,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05634-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10835, CustomerID = "ALFKI", @@ -13114,7 +13114,7 @@ public static Order[] CreateOrders() ShipPostalCode = "12209", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10836, CustomerID = "ERNSH", @@ -13132,7 +13132,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10837, CustomerID = "BERGS", @@ -13150,7 +13150,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10838, CustomerID = "LINOD", @@ -13168,7 +13168,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10839, CustomerID = "TRADH", @@ -13186,7 +13186,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05634-030", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10840, CustomerID = "LINOD", @@ -13204,7 +13204,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10841, CustomerID = "SUPRD", @@ -13222,7 +13222,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10842, CustomerID = "TORTU", @@ -13240,7 +13240,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10843, CustomerID = "VICTE", @@ -13258,7 +13258,7 @@ public static Order[] CreateOrders() ShipPostalCode = "69004", ShipCountry = "France" }, - new Order + new() { OrderID = 10844, CustomerID = "PICCO", @@ -13276,7 +13276,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5020", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10845, CustomerID = "QUICK", @@ -13294,7 +13294,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10846, CustomerID = "SUPRD", @@ -13312,7 +13312,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10847, CustomerID = "SAVEA", @@ -13330,7 +13330,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10848, CustomerID = "CONSH", @@ -13348,7 +13348,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX1 6LT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10849, CustomerID = "KOENE", @@ -13366,7 +13366,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10850, CustomerID = "VICTE", @@ -13384,7 +13384,7 @@ public static Order[] CreateOrders() ShipPostalCode = "69004", ShipCountry = "France" }, - new Order + new() { OrderID = 10851, CustomerID = "RICAR", @@ -13402,7 +13402,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10852, CustomerID = "RATTC", @@ -13420,7 +13420,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10853, CustomerID = "BLAUS", @@ -13438,7 +13438,7 @@ public static Order[] CreateOrders() ShipPostalCode = "68306", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10854, CustomerID = "ERNSH", @@ -13456,7 +13456,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10855, CustomerID = "OLDWO", @@ -13474,7 +13474,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99508", ShipCountry = "USA" }, - new Order + new() { OrderID = 10856, CustomerID = "ANTON", @@ -13492,7 +13492,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05023", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10857, CustomerID = "BERGS", @@ -13510,7 +13510,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10858, CustomerID = "LACOR", @@ -13528,7 +13528,7 @@ public static Order[] CreateOrders() ShipPostalCode = "78000", ShipCountry = "France" }, - new Order + new() { OrderID = 10859, CustomerID = "FRANK", @@ -13546,7 +13546,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10860, CustomerID = "FRANR", @@ -13564,7 +13564,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44000", ShipCountry = "France" }, - new Order + new() { OrderID = 10861, CustomerID = "WHITC", @@ -13582,7 +13582,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10862, CustomerID = "LEHMS", @@ -13600,7 +13600,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10863, CustomerID = "HILAA", @@ -13618,7 +13618,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10864, CustomerID = "AROUT", @@ -13636,7 +13636,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10865, CustomerID = "QUICK", @@ -13654,7 +13654,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10866, CustomerID = "BERGS", @@ -13672,7 +13672,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10867, CustomerID = "LONEP", @@ -13690,7 +13690,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97219", ShipCountry = "USA" }, - new Order + new() { OrderID = 10868, CustomerID = "QUEEN", @@ -13708,7 +13708,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10869, CustomerID = "SEVES", @@ -13726,7 +13726,7 @@ public static Order[] CreateOrders() ShipPostalCode = "OX15 4NB", ShipCountry = "UK" }, - new Order + new() { OrderID = 10870, CustomerID = "WOLZA", @@ -13744,7 +13744,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01-012", ShipCountry = "Poland" }, - new Order + new() { OrderID = 10871, CustomerID = "BONAP", @@ -13762,7 +13762,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10872, CustomerID = "GODOS", @@ -13780,7 +13780,7 @@ public static Order[] CreateOrders() ShipPostalCode = "41101", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10873, CustomerID = "WILMK", @@ -13798,7 +13798,7 @@ public static Order[] CreateOrders() ShipPostalCode = "21240", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10874, CustomerID = "GODOS", @@ -13816,7 +13816,7 @@ public static Order[] CreateOrders() ShipPostalCode = "41101", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10875, CustomerID = "BERGS", @@ -13834,7 +13834,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10876, CustomerID = "BONAP", @@ -13852,7 +13852,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10877, CustomerID = "RICAR", @@ -13870,7 +13870,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10878, CustomerID = "QUICK", @@ -13888,7 +13888,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10879, CustomerID = "WILMK", @@ -13906,7 +13906,7 @@ public static Order[] CreateOrders() ShipPostalCode = "21240", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10880, CustomerID = "FOLKO", @@ -13924,7 +13924,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10881, CustomerID = "CACTU", @@ -13942,7 +13942,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10882, CustomerID = "SAVEA", @@ -13960,7 +13960,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10883, CustomerID = "LONEP", @@ -13978,7 +13978,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97219", ShipCountry = "USA" }, - new Order + new() { OrderID = 10884, CustomerID = "LETSS", @@ -13996,7 +13996,7 @@ public static Order[] CreateOrders() ShipPostalCode = "94117", ShipCountry = "USA" }, - new Order + new() { OrderID = 10885, CustomerID = "SUPRD", @@ -14014,7 +14014,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10886, CustomerID = "HANAR", @@ -14032,7 +14032,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10887, CustomerID = "GALED", @@ -14050,7 +14050,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8022", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10888, CustomerID = "GODOS", @@ -14068,7 +14068,7 @@ public static Order[] CreateOrders() ShipPostalCode = "41101", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10889, CustomerID = "RATTC", @@ -14086,7 +14086,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10890, CustomerID = "DUMON", @@ -14104,7 +14104,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44000", ShipCountry = "France" }, - new Order + new() { OrderID = 10891, CustomerID = "LEHMS", @@ -14122,7 +14122,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10892, CustomerID = "MAISD", @@ -14140,7 +14140,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-1180", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10893, CustomerID = "KOENE", @@ -14158,7 +14158,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10894, CustomerID = "SAVEA", @@ -14176,7 +14176,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10895, CustomerID = "ERNSH", @@ -14194,7 +14194,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10896, CustomerID = "MAISD", @@ -14212,7 +14212,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-1180", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10897, CustomerID = "HUNGO", @@ -14230,7 +14230,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10898, CustomerID = "OCEAN", @@ -14248,7 +14248,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10899, CustomerID = "LILAS", @@ -14266,7 +14266,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10900, CustomerID = "WELLI", @@ -14284,7 +14284,7 @@ public static Order[] CreateOrders() ShipPostalCode = "08737-363", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10901, CustomerID = "HILAA", @@ -14302,7 +14302,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10902, CustomerID = "FOLKO", @@ -14320,7 +14320,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10903, CustomerID = "HANAR", @@ -14338,7 +14338,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10904, CustomerID = "WHITC", @@ -14356,7 +14356,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 10905, CustomerID = "WELLI", @@ -14374,7 +14374,7 @@ public static Order[] CreateOrders() ShipPostalCode = "08737-363", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10906, CustomerID = "WOLZA", @@ -14392,7 +14392,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01-012", ShipCountry = "Poland" }, - new Order + new() { OrderID = 10907, CustomerID = "SPECD", @@ -14410,7 +14410,7 @@ public static Order[] CreateOrders() ShipPostalCode = "75016", ShipCountry = "France" }, - new Order + new() { OrderID = 10908, CustomerID = "REGGC", @@ -14428,7 +14428,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10909, CustomerID = "SANTG", @@ -14446,7 +14446,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4110", ShipCountry = "Norway" }, - new Order + new() { OrderID = 10910, CustomerID = "WILMK", @@ -14464,7 +14464,7 @@ public static Order[] CreateOrders() ShipPostalCode = "21240", ShipCountry = "Finland" }, - new Order + new() { OrderID = 10911, CustomerID = "GODOS", @@ -14482,7 +14482,7 @@ public static Order[] CreateOrders() ShipPostalCode = "41101", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10912, CustomerID = "HUNGO", @@ -14500,7 +14500,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10913, CustomerID = "QUEEN", @@ -14518,7 +14518,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10914, CustomerID = "QUEEN", @@ -14536,7 +14536,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10915, CustomerID = "TORTU", @@ -14554,7 +14554,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10916, CustomerID = "RANCH", @@ -14572,7 +14572,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10917, CustomerID = "ROMEY", @@ -14590,7 +14590,7 @@ public static Order[] CreateOrders() ShipPostalCode = "28001", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10918, CustomerID = "BOTTM", @@ -14608,7 +14608,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10919, CustomerID = "LINOD", @@ -14626,7 +14626,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10920, CustomerID = "AROUT", @@ -14644,7 +14644,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10921, CustomerID = "VAFFE", @@ -14662,7 +14662,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10922, CustomerID = "HANAR", @@ -14680,7 +14680,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10923, CustomerID = "LAMAI", @@ -14698,7 +14698,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 10924, CustomerID = "BERGS", @@ -14716,7 +14716,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-958 22", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10925, CustomerID = "HANAR", @@ -14734,7 +14734,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10926, CustomerID = "ANATR", @@ -14752,7 +14752,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05021", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10927, CustomerID = "LACOR", @@ -14770,7 +14770,7 @@ public static Order[] CreateOrders() ShipPostalCode = "78000", ShipCountry = "France" }, - new Order + new() { OrderID = 10928, CustomerID = "GALED", @@ -14788,7 +14788,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8022", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10929, CustomerID = "FRANK", @@ -14806,7 +14806,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10930, CustomerID = "SUPRD", @@ -14824,7 +14824,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10931, CustomerID = "RICSU", @@ -14842,7 +14842,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1204", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10932, CustomerID = "BONAP", @@ -14860,7 +14860,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10933, CustomerID = "ISLAT", @@ -14878,7 +14878,7 @@ public static Order[] CreateOrders() ShipPostalCode = "PO31 7PJ", ShipCountry = "UK" }, - new Order + new() { OrderID = 10934, CustomerID = "LEHMS", @@ -14896,7 +14896,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10935, CustomerID = "WELLI", @@ -14914,7 +14914,7 @@ public static Order[] CreateOrders() ShipPostalCode = "08737-363", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10936, CustomerID = "GREAL", @@ -14932,7 +14932,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 10937, CustomerID = "CACTU", @@ -14950,7 +14950,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10938, CustomerID = "QUICK", @@ -14968,7 +14968,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10939, CustomerID = "MAGAA", @@ -14986,7 +14986,7 @@ public static Order[] CreateOrders() ShipPostalCode = "24100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10940, CustomerID = "BONAP", @@ -15004,7 +15004,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 10941, CustomerID = "SAVEA", @@ -15022,7 +15022,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10942, CustomerID = "REGGC", @@ -15040,7 +15040,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10943, CustomerID = "BSBEV", @@ -15058,7 +15058,7 @@ public static Order[] CreateOrders() ShipPostalCode = "EC2 5NT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10944, CustomerID = "BOTTM", @@ -15076,7 +15076,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10945, CustomerID = "MORGK", @@ -15094,7 +15094,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04179", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10946, CustomerID = "VAFFE", @@ -15112,7 +15112,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10947, CustomerID = "BSBEV", @@ -15130,7 +15130,7 @@ public static Order[] CreateOrders() ShipPostalCode = "EC2 5NT", ShipCountry = "UK" }, - new Order + new() { OrderID = 10948, CustomerID = "GODOS", @@ -15148,7 +15148,7 @@ public static Order[] CreateOrders() ShipPostalCode = "41101", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10949, CustomerID = "BOTTM", @@ -15166,7 +15166,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10950, CustomerID = "MAGAA", @@ -15184,7 +15184,7 @@ public static Order[] CreateOrders() ShipPostalCode = "24100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 10951, CustomerID = "RICSU", @@ -15202,7 +15202,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1204", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10952, CustomerID = "ALFKI", @@ -15220,7 +15220,7 @@ public static Order[] CreateOrders() ShipPostalCode = "12209", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10953, CustomerID = "AROUT", @@ -15238,7 +15238,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 10954, CustomerID = "LINOD", @@ -15256,7 +15256,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10955, CustomerID = "FOLKO", @@ -15274,7 +15274,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10956, CustomerID = "BLAUS", @@ -15292,7 +15292,7 @@ public static Order[] CreateOrders() ShipPostalCode = "68306", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10957, CustomerID = "HILAA", @@ -15310,7 +15310,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10958, CustomerID = "OCEAN", @@ -15328,7 +15328,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10959, CustomerID = "GOURL", @@ -15346,7 +15346,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04876-786", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10960, CustomerID = "HILAA", @@ -15364,7 +15364,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10961, CustomerID = "QUEEN", @@ -15382,7 +15382,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10962, CustomerID = "QUICK", @@ -15400,7 +15400,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10963, CustomerID = "FURIB", @@ -15418,7 +15418,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1675", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 10964, CustomerID = "SPECD", @@ -15436,7 +15436,7 @@ public static Order[] CreateOrders() ShipPostalCode = "75016", ShipCountry = "France" }, - new Order + new() { OrderID = 10965, CustomerID = "OLDWO", @@ -15454,7 +15454,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99508", ShipCountry = "USA" }, - new Order + new() { OrderID = 10966, CustomerID = "CHOPS", @@ -15472,7 +15472,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3012", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 10967, CustomerID = "TOMSP", @@ -15490,7 +15490,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44087", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10968, CustomerID = "ERNSH", @@ -15508,7 +15508,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10969, CustomerID = "COMMI", @@ -15526,7 +15526,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05432-043", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10970, CustomerID = "BOLID", @@ -15544,7 +15544,7 @@ public static Order[] CreateOrders() ShipPostalCode = "28023", ShipCountry = "Spain" }, - new Order + new() { OrderID = 10971, CustomerID = "FRANR", @@ -15562,7 +15562,7 @@ public static Order[] CreateOrders() ShipPostalCode = "44000", ShipCountry = "France" }, - new Order + new() { OrderID = 10972, CustomerID = "LACOR", @@ -15580,7 +15580,7 @@ public static Order[] CreateOrders() ShipPostalCode = "78000", ShipCountry = "France" }, - new Order + new() { OrderID = 10973, CustomerID = "LACOR", @@ -15598,7 +15598,7 @@ public static Order[] CreateOrders() ShipPostalCode = "78000", ShipCountry = "France" }, - new Order + new() { OrderID = 10974, CustomerID = "SPLIR", @@ -15616,7 +15616,7 @@ public static Order[] CreateOrders() ShipPostalCode = "82520", ShipCountry = "USA" }, - new Order + new() { OrderID = 10975, CustomerID = "BOTTM", @@ -15634,7 +15634,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10976, CustomerID = "HILAA", @@ -15652,7 +15652,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10977, CustomerID = "FOLKO", @@ -15670,7 +15670,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10978, CustomerID = "MAISD", @@ -15688,7 +15688,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-1180", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 10979, CustomerID = "ERNSH", @@ -15706,7 +15706,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10980, CustomerID = "FOLKO", @@ -15724,7 +15724,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10981, CustomerID = "HANAR", @@ -15742,7 +15742,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10982, CustomerID = "BOTTM", @@ -15760,7 +15760,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 10983, CustomerID = "SAVEA", @@ -15778,7 +15778,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10984, CustomerID = "SAVEA", @@ -15796,7 +15796,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 10985, CustomerID = "HUNGO", @@ -15814,7 +15814,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 10986, CustomerID = "OCEAN", @@ -15832,7 +15832,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 10987, CustomerID = "EASTC", @@ -15850,7 +15850,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX3 6FW", ShipCountry = "UK" }, - new Order + new() { OrderID = 10988, CustomerID = "RATTC", @@ -15868,7 +15868,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 10989, CustomerID = "QUEDE", @@ -15886,7 +15886,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-673", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 10990, CustomerID = "ERNSH", @@ -15904,7 +15904,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 10991, CustomerID = "QUICK", @@ -15922,7 +15922,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10992, CustomerID = "THEBI", @@ -15940,7 +15940,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97201", ShipCountry = "USA" }, - new Order + new() { OrderID = 10993, CustomerID = "FOLKO", @@ -15958,7 +15958,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 10994, CustomerID = "VAFFE", @@ -15976,7 +15976,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8200", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 10995, CustomerID = "PERIC", @@ -15994,7 +15994,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 10996, CustomerID = "QUICK", @@ -16012,7 +16012,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 10997, CustomerID = "LILAS", @@ -16030,7 +16030,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 10998, CustomerID = "WOLZA", @@ -16048,7 +16048,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01-012", ShipCountry = "Poland" }, - new Order + new() { OrderID = 10999, CustomerID = "OTTIK", @@ -16066,7 +16066,7 @@ public static Order[] CreateOrders() ShipPostalCode = "50739", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11000, CustomerID = "RATTC", @@ -16084,7 +16084,7 @@ public static Order[] CreateOrders() ShipPostalCode = "87110", ShipCountry = "USA" }, - new Order + new() { OrderID = 11001, CustomerID = "FOLKO", @@ -16102,7 +16102,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 11002, CustomerID = "SAVEA", @@ -16120,7 +16120,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 11003, CustomerID = "THECR", @@ -16138,7 +16138,7 @@ public static Order[] CreateOrders() ShipPostalCode = "59801", ShipCountry = "USA" }, - new Order + new() { OrderID = 11004, CustomerID = "MAISD", @@ -16156,7 +16156,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-1180", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 11005, CustomerID = "WILMK", @@ -16174,7 +16174,7 @@ public static Order[] CreateOrders() ShipPostalCode = "21240", ShipCountry = "Finland" }, - new Order + new() { OrderID = 11006, CustomerID = "GREAL", @@ -16192,7 +16192,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 11007, CustomerID = "PRINI", @@ -16210,7 +16210,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1756", ShipCountry = "Portugal" }, - new Order + new() { OrderID = 11008, CustomerID = "ERNSH", @@ -16228,7 +16228,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 11009, CustomerID = "GODOS", @@ -16246,7 +16246,7 @@ public static Order[] CreateOrders() ShipPostalCode = "41101", ShipCountry = "Spain" }, - new Order + new() { OrderID = 11010, CustomerID = "REGGC", @@ -16264,7 +16264,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 11011, CustomerID = "ALFKI", @@ -16282,7 +16282,7 @@ public static Order[] CreateOrders() ShipPostalCode = "12209", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11012, CustomerID = "FRANK", @@ -16300,7 +16300,7 @@ public static Order[] CreateOrders() ShipPostalCode = "80805", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11013, CustomerID = "ROMEY", @@ -16318,7 +16318,7 @@ public static Order[] CreateOrders() ShipPostalCode = "28001", ShipCountry = "Spain" }, - new Order + new() { OrderID = 11014, CustomerID = "LINOD", @@ -16336,7 +16336,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 11015, CustomerID = "SANTG", @@ -16354,7 +16354,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4110", ShipCountry = "Norway" }, - new Order + new() { OrderID = 11016, CustomerID = "AROUT", @@ -16372,7 +16372,7 @@ public static Order[] CreateOrders() ShipPostalCode = "CO7 6JX", ShipCountry = "UK" }, - new Order + new() { OrderID = 11017, CustomerID = "ERNSH", @@ -16390,7 +16390,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 11018, CustomerID = "LONEP", @@ -16408,7 +16408,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97219", ShipCountry = "USA" }, - new Order + new() { OrderID = 11019, CustomerID = "RANCH", @@ -16426,7 +16426,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 11020, CustomerID = "OTTIK", @@ -16444,7 +16444,7 @@ public static Order[] CreateOrders() ShipPostalCode = "50739", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11021, CustomerID = "QUICK", @@ -16462,7 +16462,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01307", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11022, CustomerID = "HANAR", @@ -16480,7 +16480,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 11023, CustomerID = "BSBEV", @@ -16498,7 +16498,7 @@ public static Order[] CreateOrders() ShipPostalCode = "EC2 5NT", ShipCountry = "UK" }, - new Order + new() { OrderID = 11024, CustomerID = "EASTC", @@ -16516,7 +16516,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX3 6FW", ShipCountry = "UK" }, - new Order + new() { OrderID = 11025, CustomerID = "WARTH", @@ -16534,7 +16534,7 @@ public static Order[] CreateOrders() ShipPostalCode = "90110", ShipCountry = "Finland" }, - new Order + new() { OrderID = 11026, CustomerID = "FRANS", @@ -16552,7 +16552,7 @@ public static Order[] CreateOrders() ShipPostalCode = "10100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 11027, CustomerID = "BOTTM", @@ -16570,7 +16570,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 11028, CustomerID = "KOENE", @@ -16588,7 +16588,7 @@ public static Order[] CreateOrders() ShipPostalCode = "14776", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11029, CustomerID = "CHOPS", @@ -16606,7 +16606,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3012", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 11030, CustomerID = "SAVEA", @@ -16624,7 +16624,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 11031, CustomerID = "SAVEA", @@ -16642,7 +16642,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 11032, CustomerID = "WHITC", @@ -16660,7 +16660,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 11033, CustomerID = "RICSU", @@ -16678,7 +16678,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1204", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 11034, CustomerID = "OLDWO", @@ -16696,7 +16696,7 @@ public static Order[] CreateOrders() ShipPostalCode = "99508", ShipCountry = "USA" }, - new Order + new() { OrderID = 11035, CustomerID = "SUPRD", @@ -16714,7 +16714,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 11036, CustomerID = "DRACD", @@ -16732,7 +16732,7 @@ public static Order[] CreateOrders() ShipPostalCode = "52066", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11037, CustomerID = "GODOS", @@ -16750,7 +16750,7 @@ public static Order[] CreateOrders() ShipPostalCode = "41101", ShipCountry = "Spain" }, - new Order + new() { OrderID = 11038, CustomerID = "SUPRD", @@ -16768,7 +16768,7 @@ public static Order[] CreateOrders() ShipPostalCode = "B-6000", ShipCountry = "Belgium" }, - new Order + new() { OrderID = 11039, CustomerID = "LINOD", @@ -16786,7 +16786,7 @@ public static Order[] CreateOrders() ShipPostalCode = "4980", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 11040, CustomerID = "GREAL", @@ -16804,7 +16804,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 11041, CustomerID = "CHOPS", @@ -16822,7 +16822,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3012", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 11042, CustomerID = "COMMI", @@ -16840,7 +16840,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05432-043", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 11043, CustomerID = "SPECD", @@ -16858,7 +16858,7 @@ public static Order[] CreateOrders() ShipPostalCode = "75016", ShipCountry = "France" }, - new Order + new() { OrderID = 11044, CustomerID = "WOLZA", @@ -16876,7 +16876,7 @@ public static Order[] CreateOrders() ShipPostalCode = "01-012", ShipCountry = "Poland" }, - new Order + new() { OrderID = 11045, CustomerID = "BOTTM", @@ -16894,7 +16894,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 11046, CustomerID = "WANDK", @@ -16912,7 +16912,7 @@ public static Order[] CreateOrders() ShipPostalCode = "70563", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11047, CustomerID = "EASTC", @@ -16930,7 +16930,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX3 6FW", ShipCountry = "UK" }, - new Order + new() { OrderID = 11048, CustomerID = "BOTTM", @@ -16948,7 +16948,7 @@ public static Order[] CreateOrders() ShipPostalCode = "T2F 8M4", ShipCountry = "Canada" }, - new Order + new() { OrderID = 11049, CustomerID = "GOURL", @@ -16966,7 +16966,7 @@ public static Order[] CreateOrders() ShipPostalCode = "04876-786", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 11050, CustomerID = "FOLKO", @@ -16984,7 +16984,7 @@ public static Order[] CreateOrders() ShipPostalCode = "S-844 67", ShipCountry = "Sweden" }, - new Order + new() { OrderID = 11051, CustomerID = "LAMAI", @@ -17002,7 +17002,7 @@ public static Order[] CreateOrders() ShipPostalCode = "31000", ShipCountry = "France" }, - new Order + new() { OrderID = 11052, CustomerID = "HANAR", @@ -17020,7 +17020,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05454-876", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 11053, CustomerID = "PICCO", @@ -17038,7 +17038,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5020", ShipCountry = "Austria" }, - new Order + new() { OrderID = 11054, CustomerID = "CACTU", @@ -17056,7 +17056,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1010", ShipCountry = "Argentina" }, - new Order + new() { OrderID = 11055, CustomerID = "HILAA", @@ -17074,7 +17074,7 @@ public static Order[] CreateOrders() ShipPostalCode = "5022", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 11056, CustomerID = "EASTC", @@ -17092,7 +17092,7 @@ public static Order[] CreateOrders() ShipPostalCode = "WX3 6FW", ShipCountry = "UK" }, - new Order + new() { OrderID = 11057, CustomerID = "NORTS", @@ -17110,7 +17110,7 @@ public static Order[] CreateOrders() ShipPostalCode = "SW7 1RZ", ShipCountry = "UK" }, - new Order + new() { OrderID = 11058, CustomerID = "BLAUS", @@ -17128,7 +17128,7 @@ public static Order[] CreateOrders() ShipPostalCode = "68306", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11059, CustomerID = "RICAR", @@ -17146,7 +17146,7 @@ public static Order[] CreateOrders() ShipPostalCode = "02389-890", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 11060, CustomerID = "FRANS", @@ -17164,7 +17164,7 @@ public static Order[] CreateOrders() ShipPostalCode = "10100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 11061, CustomerID = "GREAL", @@ -17182,7 +17182,7 @@ public static Order[] CreateOrders() ShipPostalCode = "97403", ShipCountry = "USA" }, - new Order + new() { OrderID = 11062, CustomerID = "REGGC", @@ -17200,7 +17200,7 @@ public static Order[] CreateOrders() ShipPostalCode = "42100", ShipCountry = "Italy" }, - new Order + new() { OrderID = 11063, CustomerID = "HUNGO", @@ -17218,7 +17218,7 @@ public static Order[] CreateOrders() ShipPostalCode = null, ShipCountry = "Ireland" }, - new Order + new() { OrderID = 11064, CustomerID = "SAVEA", @@ -17236,7 +17236,7 @@ public static Order[] CreateOrders() ShipPostalCode = "83720", ShipCountry = "USA" }, - new Order + new() { OrderID = 11065, CustomerID = "LILAS", @@ -17254,7 +17254,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 11066, CustomerID = "WHITC", @@ -17272,7 +17272,7 @@ public static Order[] CreateOrders() ShipPostalCode = "98124", ShipCountry = "USA" }, - new Order + new() { OrderID = 11067, CustomerID = "DRACD", @@ -17290,7 +17290,7 @@ public static Order[] CreateOrders() ShipPostalCode = "52066", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11068, CustomerID = "QUEEN", @@ -17308,7 +17308,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05487-020", ShipCountry = "Brazil" }, - new Order + new() { OrderID = 11069, CustomerID = "TORTU", @@ -17326,7 +17326,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 11070, CustomerID = "LEHMS", @@ -17344,7 +17344,7 @@ public static Order[] CreateOrders() ShipPostalCode = "60528", ShipCountry = "Germany" }, - new Order + new() { OrderID = 11071, CustomerID = "LILAS", @@ -17362,7 +17362,7 @@ public static Order[] CreateOrders() ShipPostalCode = "3508", ShipCountry = "Venezuela" }, - new Order + new() { OrderID = 11072, CustomerID = "ERNSH", @@ -17380,7 +17380,7 @@ public static Order[] CreateOrders() ShipPostalCode = "8010", ShipCountry = "Austria" }, - new Order + new() { OrderID = 11073, CustomerID = "PERIC", @@ -17398,7 +17398,7 @@ public static Order[] CreateOrders() ShipPostalCode = "05033", ShipCountry = "Mexico" }, - new Order + new() { OrderID = 11074, CustomerID = "SIMOB", @@ -17416,7 +17416,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1734", ShipCountry = "Denmark" }, - new Order + new() { OrderID = 11075, CustomerID = "RICSU", @@ -17434,7 +17434,7 @@ public static Order[] CreateOrders() ShipPostalCode = "1204", ShipCountry = "Switzerland" }, - new Order + new() { OrderID = 11076, CustomerID = "BONAP", @@ -17452,7 +17452,7 @@ public static Order[] CreateOrders() ShipPostalCode = "13008", ShipCountry = "France" }, - new Order + new() { OrderID = 11077, CustomerID = "RATTC", @@ -17479,7 +17479,7 @@ public static Order[] CreateOrders() public static OrderDetail[] CreateOrderDetails() => [ - new OrderDetail + new() { OrderID = 10248, ProductID = 11, @@ -17487,7 +17487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10248, ProductID = 42, @@ -17495,7 +17495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10248, ProductID = 72, @@ -17503,7 +17503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10249, ProductID = 14, @@ -17511,7 +17511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10249, ProductID = 51, @@ -17519,7 +17519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10250, ProductID = 41, @@ -17527,7 +17527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10250, ProductID = 51, @@ -17535,7 +17535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10250, ProductID = 65, @@ -17543,7 +17543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10251, ProductID = 22, @@ -17551,7 +17551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10251, ProductID = 57, @@ -17559,7 +17559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10251, ProductID = 65, @@ -17567,7 +17567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10252, ProductID = 20, @@ -17575,7 +17575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10252, ProductID = 33, @@ -17583,7 +17583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10252, ProductID = 60, @@ -17591,7 +17591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10253, ProductID = 31, @@ -17599,7 +17599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10253, ProductID = 39, @@ -17607,7 +17607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0f }, - new OrderDetail + new() { OrderID = 10253, ProductID = 49, @@ -17615,7 +17615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10254, ProductID = 24, @@ -17623,7 +17623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10254, ProductID = 55, @@ -17631,7 +17631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10254, ProductID = 74, @@ -17639,7 +17639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10255, ProductID = 2, @@ -17647,7 +17647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10255, ProductID = 16, @@ -17655,7 +17655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10255, ProductID = 36, @@ -17663,7 +17663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10255, ProductID = 59, @@ -17671,7 +17671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10256, ProductID = 53, @@ -17679,7 +17679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10256, ProductID = 77, @@ -17687,7 +17687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10257, ProductID = 27, @@ -17695,7 +17695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10257, ProductID = 39, @@ -17703,7 +17703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10257, ProductID = 77, @@ -17711,7 +17711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10258, ProductID = 2, @@ -17719,7 +17719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10258, ProductID = 5, @@ -17727,7 +17727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 65, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10258, ProductID = 32, @@ -17735,7 +17735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10259, ProductID = 21, @@ -17743,7 +17743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10259, ProductID = 37, @@ -17751,7 +17751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 10260, ProductID = 41, @@ -17759,7 +17759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10260, ProductID = 57, @@ -17767,7 +17767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10260, ProductID = 62, @@ -17775,7 +17775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10260, ProductID = 70, @@ -17783,7 +17783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10261, ProductID = 21, @@ -17791,7 +17791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10261, ProductID = 35, @@ -17799,7 +17799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10262, ProductID = 5, @@ -17807,7 +17807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10262, ProductID = 7, @@ -17815,7 +17815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10262, ProductID = 56, @@ -17823,7 +17823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10263, ProductID = 16, @@ -17831,7 +17831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10263, ProductID = 24, @@ -17839,7 +17839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10263, ProductID = 30, @@ -17847,7 +17847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10263, ProductID = 74, @@ -17855,7 +17855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10264, ProductID = 2, @@ -17863,7 +17863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10264, ProductID = 41, @@ -17871,7 +17871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10265, ProductID = 17, @@ -17879,7 +17879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10265, ProductID = 70, @@ -17887,7 +17887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10266, ProductID = 12, @@ -17895,7 +17895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10267, ProductID = 40, @@ -17903,7 +17903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10267, ProductID = 59, @@ -17911,7 +17911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10267, ProductID = 76, @@ -17919,7 +17919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10268, ProductID = 29, @@ -17927,7 +17927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10268, ProductID = 72, @@ -17935,7 +17935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10269, ProductID = 33, @@ -17943,7 +17943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10269, ProductID = 72, @@ -17951,7 +17951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10270, ProductID = 36, @@ -17959,7 +17959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10270, ProductID = 43, @@ -17967,7 +17967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10271, ProductID = 33, @@ -17975,7 +17975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10272, ProductID = 20, @@ -17983,7 +17983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10272, ProductID = 31, @@ -17991,7 +17991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10272, ProductID = 72, @@ -17999,7 +17999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10273, ProductID = 10, @@ -18007,7 +18007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10273, ProductID = 31, @@ -18015,7 +18015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10273, ProductID = 33, @@ -18023,7 +18023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10273, ProductID = 40, @@ -18031,7 +18031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10273, ProductID = 76, @@ -18039,7 +18039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 33, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10274, ProductID = 71, @@ -18047,7 +18047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10274, ProductID = 72, @@ -18055,7 +18055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10275, ProductID = 24, @@ -18063,7 +18063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10275, ProductID = 59, @@ -18071,7 +18071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10276, ProductID = 10, @@ -18079,7 +18079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10276, ProductID = 13, @@ -18087,7 +18087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10277, ProductID = 28, @@ -18095,7 +18095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10277, ProductID = 62, @@ -18103,7 +18103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10278, ProductID = 44, @@ -18111,7 +18111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10278, ProductID = 59, @@ -18119,7 +18119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10278, ProductID = 63, @@ -18127,7 +18127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10278, ProductID = 73, @@ -18135,7 +18135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10279, ProductID = 17, @@ -18143,7 +18143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10280, ProductID = 24, @@ -18151,7 +18151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10280, ProductID = 55, @@ -18159,7 +18159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10280, ProductID = 75, @@ -18167,7 +18167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10281, ProductID = 19, @@ -18175,7 +18175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 10281, ProductID = 24, @@ -18183,7 +18183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10281, ProductID = 35, @@ -18191,7 +18191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10282, ProductID = 30, @@ -18199,7 +18199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10282, ProductID = 57, @@ -18207,7 +18207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10283, ProductID = 15, @@ -18215,7 +18215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10283, ProductID = 19, @@ -18223,7 +18223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10283, ProductID = 60, @@ -18231,7 +18231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10283, ProductID = 72, @@ -18239,7 +18239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10284, ProductID = 27, @@ -18247,7 +18247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10284, ProductID = 44, @@ -18255,7 +18255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10284, ProductID = 60, @@ -18263,7 +18263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10284, ProductID = 67, @@ -18271,7 +18271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10285, ProductID = 1, @@ -18279,7 +18279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10285, ProductID = 40, @@ -18287,7 +18287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10285, ProductID = 53, @@ -18295,7 +18295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10286, ProductID = 35, @@ -18303,7 +18303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 100, Discount = 0f }, - new OrderDetail + new() { OrderID = 10286, ProductID = 62, @@ -18311,7 +18311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10287, ProductID = 16, @@ -18319,7 +18319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10287, ProductID = 34, @@ -18327,7 +18327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10287, ProductID = 46, @@ -18335,7 +18335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10288, ProductID = 54, @@ -18343,7 +18343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10288, ProductID = 68, @@ -18351,7 +18351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10289, ProductID = 3, @@ -18359,7 +18359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10289, ProductID = 64, @@ -18367,7 +18367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10290, ProductID = 5, @@ -18375,7 +18375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10290, ProductID = 29, @@ -18383,7 +18383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10290, ProductID = 49, @@ -18391,7 +18391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10290, ProductID = 77, @@ -18399,7 +18399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10291, ProductID = 13, @@ -18407,7 +18407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10291, ProductID = 44, @@ -18415,7 +18415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10291, ProductID = 51, @@ -18423,7 +18423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10292, ProductID = 20, @@ -18431,7 +18431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10293, ProductID = 18, @@ -18439,7 +18439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10293, ProductID = 24, @@ -18447,7 +18447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10293, ProductID = 63, @@ -18455,7 +18455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10293, ProductID = 75, @@ -18463,7 +18463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10294, ProductID = 1, @@ -18471,7 +18471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10294, ProductID = 17, @@ -18479,7 +18479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10294, ProductID = 43, @@ -18487,7 +18487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10294, ProductID = 60, @@ -18495,7 +18495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10294, ProductID = 75, @@ -18503,7 +18503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10295, ProductID = 56, @@ -18511,7 +18511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10296, ProductID = 11, @@ -18519,7 +18519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10296, ProductID = 16, @@ -18527,7 +18527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10296, ProductID = 69, @@ -18535,7 +18535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10297, ProductID = 39, @@ -18543,7 +18543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10297, ProductID = 72, @@ -18551,7 +18551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10298, ProductID = 2, @@ -18559,7 +18559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10298, ProductID = 36, @@ -18567,7 +18567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10298, ProductID = 59, @@ -18575,7 +18575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10298, ProductID = 62, @@ -18583,7 +18583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10299, ProductID = 19, @@ -18591,7 +18591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10299, ProductID = 70, @@ -18599,7 +18599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10300, ProductID = 66, @@ -18607,7 +18607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10300, ProductID = 68, @@ -18615,7 +18615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10301, ProductID = 40, @@ -18623,7 +18623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10301, ProductID = 56, @@ -18631,7 +18631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10302, ProductID = 17, @@ -18639,7 +18639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10302, ProductID = 28, @@ -18647,7 +18647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10302, ProductID = 43, @@ -18655,7 +18655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10303, ProductID = 40, @@ -18663,7 +18663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10303, ProductID = 65, @@ -18671,7 +18671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10303, ProductID = 68, @@ -18679,7 +18679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10304, ProductID = 49, @@ -18687,7 +18687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10304, ProductID = 59, @@ -18695,7 +18695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10304, ProductID = 71, @@ -18703,7 +18703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10305, ProductID = 18, @@ -18711,7 +18711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10305, ProductID = 29, @@ -18719,7 +18719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10305, ProductID = 39, @@ -18727,7 +18727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10306, ProductID = 30, @@ -18735,7 +18735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10306, ProductID = 53, @@ -18743,7 +18743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10306, ProductID = 54, @@ -18751,7 +18751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10307, ProductID = 62, @@ -18759,7 +18759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10307, ProductID = 68, @@ -18767,7 +18767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10308, ProductID = 69, @@ -18775,7 +18775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 10308, ProductID = 70, @@ -18783,7 +18783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10309, ProductID = 4, @@ -18791,7 +18791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10309, ProductID = 6, @@ -18799,7 +18799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10309, ProductID = 42, @@ -18807,7 +18807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10309, ProductID = 43, @@ -18815,7 +18815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10309, ProductID = 71, @@ -18823,7 +18823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10310, ProductID = 16, @@ -18831,7 +18831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10310, ProductID = 62, @@ -18839,7 +18839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10311, ProductID = 42, @@ -18847,7 +18847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10311, ProductID = 69, @@ -18855,7 +18855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10312, ProductID = 28, @@ -18863,7 +18863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10312, ProductID = 43, @@ -18871,7 +18871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10312, ProductID = 53, @@ -18879,7 +18879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10312, ProductID = 75, @@ -18887,7 +18887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10313, ProductID = 36, @@ -18895,7 +18895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10314, ProductID = 32, @@ -18903,7 +18903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10314, ProductID = 58, @@ -18911,7 +18911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10314, ProductID = 62, @@ -18919,7 +18919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10315, ProductID = 34, @@ -18927,7 +18927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10315, ProductID = 70, @@ -18935,7 +18935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10316, ProductID = 41, @@ -18943,7 +18943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10316, ProductID = 62, @@ -18951,7 +18951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0f }, - new OrderDetail + new() { OrderID = 10317, ProductID = 1, @@ -18959,7 +18959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10318, ProductID = 41, @@ -18967,7 +18967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10318, ProductID = 76, @@ -18975,7 +18975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10319, ProductID = 17, @@ -18983,7 +18983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10319, ProductID = 28, @@ -18991,7 +18991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10319, ProductID = 76, @@ -18999,7 +18999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10320, ProductID = 71, @@ -19007,7 +19007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10321, ProductID = 35, @@ -19015,7 +19015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10322, ProductID = 52, @@ -19023,7 +19023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10323, ProductID = 15, @@ -19031,7 +19031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10323, ProductID = 25, @@ -19039,7 +19039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10323, ProductID = 39, @@ -19047,7 +19047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10324, ProductID = 16, @@ -19055,7 +19055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10324, ProductID = 35, @@ -19063,7 +19063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10324, ProductID = 46, @@ -19071,7 +19071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10324, ProductID = 59, @@ -19079,7 +19079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10324, ProductID = 63, @@ -19087,7 +19087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10325, ProductID = 6, @@ -19095,7 +19095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10325, ProductID = 13, @@ -19103,7 +19103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10325, ProductID = 14, @@ -19111,7 +19111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10325, ProductID = 31, @@ -19119,7 +19119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10325, ProductID = 72, @@ -19127,7 +19127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10326, ProductID = 4, @@ -19135,7 +19135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10326, ProductID = 57, @@ -19143,7 +19143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10326, ProductID = 75, @@ -19151,7 +19151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10327, ProductID = 2, @@ -19159,7 +19159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10327, ProductID = 11, @@ -19167,7 +19167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10327, ProductID = 30, @@ -19175,7 +19175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10327, ProductID = 58, @@ -19183,7 +19183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10328, ProductID = 59, @@ -19191,7 +19191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10328, ProductID = 65, @@ -19199,7 +19199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10328, ProductID = 68, @@ -19207,7 +19207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10329, ProductID = 19, @@ -19215,7 +19215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10329, ProductID = 30, @@ -19223,7 +19223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10329, ProductID = 38, @@ -19231,7 +19231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10329, ProductID = 56, @@ -19239,7 +19239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10330, ProductID = 26, @@ -19247,7 +19247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10330, ProductID = 72, @@ -19255,7 +19255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10331, ProductID = 54, @@ -19263,7 +19263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10332, ProductID = 18, @@ -19271,7 +19271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10332, ProductID = 42, @@ -19279,7 +19279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10332, ProductID = 47, @@ -19287,7 +19287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10333, ProductID = 14, @@ -19295,7 +19295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10333, ProductID = 21, @@ -19303,7 +19303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10333, ProductID = 71, @@ -19311,7 +19311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10334, ProductID = 52, @@ -19319,7 +19319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10334, ProductID = 68, @@ -19327,7 +19327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10335, ProductID = 2, @@ -19335,7 +19335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10335, ProductID = 31, @@ -19343,7 +19343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10335, ProductID = 32, @@ -19351,7 +19351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10335, ProductID = 51, @@ -19359,7 +19359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 48, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10336, ProductID = 4, @@ -19367,7 +19367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10337, ProductID = 23, @@ -19375,7 +19375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10337, ProductID = 26, @@ -19383,7 +19383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10337, ProductID = 36, @@ -19391,7 +19391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10337, ProductID = 37, @@ -19399,7 +19399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10337, ProductID = 72, @@ -19407,7 +19407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10338, ProductID = 17, @@ -19415,7 +19415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10338, ProductID = 30, @@ -19423,7 +19423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10339, ProductID = 4, @@ -19431,7 +19431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10339, ProductID = 17, @@ -19439,7 +19439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10339, ProductID = 62, @@ -19447,7 +19447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10340, ProductID = 18, @@ -19455,7 +19455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10340, ProductID = 41, @@ -19463,7 +19463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10340, ProductID = 43, @@ -19471,7 +19471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10341, ProductID = 33, @@ -19479,7 +19479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10341, ProductID = 59, @@ -19487,7 +19487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10342, ProductID = 2, @@ -19495,7 +19495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10342, ProductID = 31, @@ -19503,7 +19503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 56, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10342, ProductID = 36, @@ -19511,7 +19511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10342, ProductID = 55, @@ -19519,7 +19519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10343, ProductID = 64, @@ -19527,7 +19527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10343, ProductID = 68, @@ -19535,7 +19535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10343, ProductID = 76, @@ -19543,7 +19543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10344, ProductID = 4, @@ -19551,7 +19551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10344, ProductID = 8, @@ -19559,7 +19559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10345, ProductID = 8, @@ -19567,7 +19567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0f }, - new OrderDetail + new() { OrderID = 10345, ProductID = 19, @@ -19575,7 +19575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0f }, - new OrderDetail + new() { OrderID = 10345, ProductID = 42, @@ -19583,7 +19583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10346, ProductID = 17, @@ -19591,7 +19591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10346, ProductID = 56, @@ -19599,7 +19599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10347, ProductID = 25, @@ -19607,7 +19607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10347, ProductID = 39, @@ -19615,7 +19615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10347, ProductID = 40, @@ -19623,7 +19623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10347, ProductID = 75, @@ -19631,7 +19631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10348, ProductID = 1, @@ -19639,7 +19639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10348, ProductID = 23, @@ -19647,7 +19647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10349, ProductID = 54, @@ -19655,7 +19655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10350, ProductID = 50, @@ -19663,7 +19663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10350, ProductID = 69, @@ -19671,7 +19671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10351, ProductID = 38, @@ -19679,7 +19679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10351, ProductID = 41, @@ -19687,7 +19687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 13, Discount = 0f }, - new OrderDetail + new() { OrderID = 10351, ProductID = 44, @@ -19695,7 +19695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 77, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10351, ProductID = 65, @@ -19703,7 +19703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10352, ProductID = 24, @@ -19711,7 +19711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10352, ProductID = 54, @@ -19719,7 +19719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10353, ProductID = 11, @@ -19727,7 +19727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10353, ProductID = 38, @@ -19735,7 +19735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10354, ProductID = 1, @@ -19743,7 +19743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10354, ProductID = 29, @@ -19751,7 +19751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10355, ProductID = 24, @@ -19759,7 +19759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10355, ProductID = 57, @@ -19767,7 +19767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10356, ProductID = 31, @@ -19775,7 +19775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10356, ProductID = 55, @@ -19783,7 +19783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10356, ProductID = 69, @@ -19791,7 +19791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10357, ProductID = 10, @@ -19799,7 +19799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10357, ProductID = 26, @@ -19807,7 +19807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10357, ProductID = 60, @@ -19815,7 +19815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10358, ProductID = 24, @@ -19823,7 +19823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10358, ProductID = 34, @@ -19831,7 +19831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10358, ProductID = 36, @@ -19839,7 +19839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10359, ProductID = 16, @@ -19847,7 +19847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 56, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10359, ProductID = 31, @@ -19855,7 +19855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10359, ProductID = 60, @@ -19863,7 +19863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10360, ProductID = 28, @@ -19871,7 +19871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10360, ProductID = 29, @@ -19879,7 +19879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10360, ProductID = 38, @@ -19887,7 +19887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10360, ProductID = 49, @@ -19895,7 +19895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10360, ProductID = 54, @@ -19903,7 +19903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10361, ProductID = 39, @@ -19911,7 +19911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 54, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10361, ProductID = 60, @@ -19919,7 +19919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 55, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10362, ProductID = 25, @@ -19927,7 +19927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10362, ProductID = 51, @@ -19935,7 +19935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10362, ProductID = 54, @@ -19943,7 +19943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10363, ProductID = 31, @@ -19951,7 +19951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10363, ProductID = 75, @@ -19959,7 +19959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10363, ProductID = 76, @@ -19967,7 +19967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10364, ProductID = 69, @@ -19975,7 +19975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10364, ProductID = 71, @@ -19983,7 +19983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10365, ProductID = 11, @@ -19991,7 +19991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10366, ProductID = 65, @@ -19999,7 +19999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10366, ProductID = 77, @@ -20007,7 +20007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10367, ProductID = 34, @@ -20015,7 +20015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0f }, - new OrderDetail + new() { OrderID = 10367, ProductID = 54, @@ -20023,7 +20023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10367, ProductID = 65, @@ -20031,7 +20031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10367, ProductID = 77, @@ -20039,7 +20039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10368, ProductID = 21, @@ -20047,7 +20047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10368, ProductID = 28, @@ -20055,7 +20055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 13, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10368, ProductID = 57, @@ -20063,7 +20063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10368, ProductID = 64, @@ -20071,7 +20071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10369, ProductID = 29, @@ -20079,7 +20079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10369, ProductID = 56, @@ -20087,7 +20087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10370, ProductID = 1, @@ -20095,7 +20095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10370, ProductID = 64, @@ -20103,7 +20103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10370, ProductID = 74, @@ -20111,7 +20111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10371, ProductID = 36, @@ -20119,7 +20119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10372, ProductID = 20, @@ -20127,7 +20127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10372, ProductID = 38, @@ -20135,7 +20135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10372, ProductID = 60, @@ -20143,7 +20143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10372, ProductID = 72, @@ -20151,7 +20151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10373, ProductID = 58, @@ -20159,7 +20159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10373, ProductID = 71, @@ -20167,7 +20167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10374, ProductID = 31, @@ -20175,7 +20175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10374, ProductID = 58, @@ -20183,7 +20183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10375, ProductID = 14, @@ -20191,7 +20191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10375, ProductID = 54, @@ -20199,7 +20199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10376, ProductID = 31, @@ -20207,7 +20207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10377, ProductID = 28, @@ -20215,7 +20215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10377, ProductID = 39, @@ -20223,7 +20223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10378, ProductID = 71, @@ -20231,7 +20231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10379, ProductID = 41, @@ -20239,7 +20239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10379, ProductID = 63, @@ -20247,7 +20247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10379, ProductID = 65, @@ -20255,7 +20255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10380, ProductID = 30, @@ -20263,7 +20263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10380, ProductID = 53, @@ -20271,7 +20271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10380, ProductID = 60, @@ -20279,7 +20279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10380, ProductID = 70, @@ -20287,7 +20287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10381, ProductID = 74, @@ -20295,7 +20295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10382, ProductID = 5, @@ -20303,7 +20303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 32, Discount = 0f }, - new OrderDetail + new() { OrderID = 10382, ProductID = 18, @@ -20311,7 +20311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10382, ProductID = 29, @@ -20319,7 +20319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10382, ProductID = 33, @@ -20327,7 +20327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10382, ProductID = 74, @@ -20335,7 +20335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10383, ProductID = 13, @@ -20343,7 +20343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10383, ProductID = 50, @@ -20351,7 +20351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10383, ProductID = 56, @@ -20359,7 +20359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10384, ProductID = 20, @@ -20367,7 +20367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10384, ProductID = 60, @@ -20375,7 +20375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10385, ProductID = 7, @@ -20383,7 +20383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10385, ProductID = 60, @@ -20391,7 +20391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10385, ProductID = 68, @@ -20399,7 +20399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10386, ProductID = 24, @@ -20407,7 +20407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10386, ProductID = 34, @@ -20415,7 +20415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10387, ProductID = 24, @@ -20423,7 +20423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10387, ProductID = 28, @@ -20431,7 +20431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10387, ProductID = 59, @@ -20439,7 +20439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10387, ProductID = 71, @@ -20447,7 +20447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10388, ProductID = 45, @@ -20455,7 +20455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10388, ProductID = 52, @@ -20463,7 +20463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10388, ProductID = 53, @@ -20471,7 +20471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10389, ProductID = 10, @@ -20479,7 +20479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10389, ProductID = 55, @@ -20487,7 +20487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10389, ProductID = 62, @@ -20495,7 +20495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10389, ProductID = 70, @@ -20503,7 +20503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10390, ProductID = 31, @@ -20511,7 +20511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10390, ProductID = 35, @@ -20519,7 +20519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10390, ProductID = 46, @@ -20527,7 +20527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0f }, - new OrderDetail + new() { OrderID = 10390, ProductID = 72, @@ -20535,7 +20535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10391, ProductID = 13, @@ -20543,7 +20543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10392, ProductID = 69, @@ -20551,7 +20551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10393, ProductID = 2, @@ -20559,7 +20559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10393, ProductID = 14, @@ -20567,7 +20567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10393, ProductID = 25, @@ -20575,7 +20575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10393, ProductID = 26, @@ -20583,7 +20583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10393, ProductID = 31, @@ -20591,7 +20591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 32, Discount = 0f }, - new OrderDetail + new() { OrderID = 10394, ProductID = 13, @@ -20599,7 +20599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10394, ProductID = 62, @@ -20607,7 +20607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10395, ProductID = 46, @@ -20615,7 +20615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10395, ProductID = 53, @@ -20623,7 +20623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10395, ProductID = 69, @@ -20631,7 +20631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10396, ProductID = 23, @@ -20639,7 +20639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10396, ProductID = 71, @@ -20647,7 +20647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10396, ProductID = 72, @@ -20655,7 +20655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10397, ProductID = 21, @@ -20663,7 +20663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10397, ProductID = 51, @@ -20671,7 +20671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10398, ProductID = 35, @@ -20679,7 +20679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10398, ProductID = 55, @@ -20687,7 +20687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 120, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10399, ProductID = 68, @@ -20695,7 +20695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10399, ProductID = 71, @@ -20703,7 +20703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10399, ProductID = 76, @@ -20711,7 +20711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10399, ProductID = 77, @@ -20719,7 +20719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10400, ProductID = 29, @@ -20727,7 +20727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10400, ProductID = 35, @@ -20735,7 +20735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10400, ProductID = 49, @@ -20743,7 +20743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10401, ProductID = 30, @@ -20751,7 +20751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10401, ProductID = 56, @@ -20759,7 +20759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0f }, - new OrderDetail + new() { OrderID = 10401, ProductID = 65, @@ -20767,7 +20767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10401, ProductID = 71, @@ -20775,7 +20775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10402, ProductID = 23, @@ -20783,7 +20783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10402, ProductID = 63, @@ -20791,7 +20791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 65, Discount = 0f }, - new OrderDetail + new() { OrderID = 10403, ProductID = 16, @@ -20799,7 +20799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10403, ProductID = 48, @@ -20807,7 +20807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10404, ProductID = 26, @@ -20815,7 +20815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10404, ProductID = 42, @@ -20823,7 +20823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10404, ProductID = 49, @@ -20831,7 +20831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10405, ProductID = 3, @@ -20839,7 +20839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10406, ProductID = 1, @@ -20847,7 +20847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10406, ProductID = 21, @@ -20855,7 +20855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10406, ProductID = 28, @@ -20863,7 +20863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10406, ProductID = 36, @@ -20871,7 +20871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10406, ProductID = 40, @@ -20879,7 +20879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10407, ProductID = 11, @@ -20887,7 +20887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10407, ProductID = 69, @@ -20895,7 +20895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10407, ProductID = 71, @@ -20903,7 +20903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10408, ProductID = 37, @@ -20911,7 +20911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10408, ProductID = 54, @@ -20919,7 +20919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10408, ProductID = 62, @@ -20927,7 +20927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10409, ProductID = 14, @@ -20935,7 +20935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10409, ProductID = 21, @@ -20943,7 +20943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10410, ProductID = 33, @@ -20951,7 +20951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 49, Discount = 0f }, - new OrderDetail + new() { OrderID = 10410, ProductID = 59, @@ -20959,7 +20959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10411, ProductID = 41, @@ -20967,7 +20967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10411, ProductID = 44, @@ -20975,7 +20975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10411, ProductID = 59, @@ -20983,7 +20983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10412, ProductID = 14, @@ -20991,7 +20991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10413, ProductID = 1, @@ -20999,7 +20999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10413, ProductID = 62, @@ -21007,7 +21007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10413, ProductID = 76, @@ -21015,7 +21015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10414, ProductID = 19, @@ -21023,7 +21023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10414, ProductID = 33, @@ -21031,7 +21031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10415, ProductID = 17, @@ -21039,7 +21039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10415, ProductID = 33, @@ -21047,7 +21047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10416, ProductID = 19, @@ -21055,7 +21055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10416, ProductID = 53, @@ -21063,7 +21063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10416, ProductID = 57, @@ -21071,7 +21071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10417, ProductID = 38, @@ -21079,7 +21079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10417, ProductID = 46, @@ -21087,7 +21087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10417, ProductID = 68, @@ -21095,7 +21095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10417, ProductID = 77, @@ -21103,7 +21103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10418, ProductID = 2, @@ -21111,7 +21111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10418, ProductID = 47, @@ -21119,7 +21119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 55, Discount = 0f }, - new OrderDetail + new() { OrderID = 10418, ProductID = 61, @@ -21127,7 +21127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10418, ProductID = 74, @@ -21135,7 +21135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10419, ProductID = 60, @@ -21143,7 +21143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10419, ProductID = 69, @@ -21151,7 +21151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10420, ProductID = 9, @@ -21159,7 +21159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10420, ProductID = 13, @@ -21167,7 +21167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10420, ProductID = 70, @@ -21175,7 +21175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10420, ProductID = 73, @@ -21183,7 +21183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10421, ProductID = 19, @@ -21191,7 +21191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10421, ProductID = 26, @@ -21199,7 +21199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10421, ProductID = 53, @@ -21207,7 +21207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10421, ProductID = 77, @@ -21215,7 +21215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10422, ProductID = 26, @@ -21223,7 +21223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10423, ProductID = 31, @@ -21231,7 +21231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10423, ProductID = 59, @@ -21239,7 +21239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10424, ProductID = 35, @@ -21247,7 +21247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10424, ProductID = 38, @@ -21255,7 +21255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 49, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10424, ProductID = 68, @@ -21263,7 +21263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10425, ProductID = 55, @@ -21271,7 +21271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10425, ProductID = 76, @@ -21279,7 +21279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10426, ProductID = 56, @@ -21287,7 +21287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10426, ProductID = 64, @@ -21295,7 +21295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10427, ProductID = 14, @@ -21303,7 +21303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10428, ProductID = 46, @@ -21311,7 +21311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10429, ProductID = 50, @@ -21319,7 +21319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10429, ProductID = 63, @@ -21327,7 +21327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10430, ProductID = 17, @@ -21335,7 +21335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10430, ProductID = 21, @@ -21343,7 +21343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10430, ProductID = 56, @@ -21351,7 +21351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10430, ProductID = 59, @@ -21359,7 +21359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10431, ProductID = 17, @@ -21367,7 +21367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10431, ProductID = 40, @@ -21375,7 +21375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10431, ProductID = 47, @@ -21383,7 +21383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10432, ProductID = 26, @@ -21391,7 +21391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10432, ProductID = 54, @@ -21399,7 +21399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10433, ProductID = 56, @@ -21407,7 +21407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10434, ProductID = 11, @@ -21415,7 +21415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10434, ProductID = 76, @@ -21423,7 +21423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10435, ProductID = 2, @@ -21431,7 +21431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10435, ProductID = 22, @@ -21439,7 +21439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10435, ProductID = 72, @@ -21447,7 +21447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10436, ProductID = 46, @@ -21455,7 +21455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10436, ProductID = 56, @@ -21463,7 +21463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10436, ProductID = 64, @@ -21471,7 +21471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10436, ProductID = 75, @@ -21479,7 +21479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10437, ProductID = 53, @@ -21487,7 +21487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10438, ProductID = 19, @@ -21495,7 +21495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10438, ProductID = 34, @@ -21503,7 +21503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10438, ProductID = 57, @@ -21511,7 +21511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10439, ProductID = 12, @@ -21519,7 +21519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10439, ProductID = 16, @@ -21527,7 +21527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10439, ProductID = 64, @@ -21535,7 +21535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10439, ProductID = 74, @@ -21543,7 +21543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10440, ProductID = 2, @@ -21551,7 +21551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10440, ProductID = 16, @@ -21559,7 +21559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 49, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10440, ProductID = 29, @@ -21567,7 +21567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10440, ProductID = 61, @@ -21575,7 +21575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 90, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10441, ProductID = 27, @@ -21583,7 +21583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10442, ProductID = 11, @@ -21591,7 +21591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10442, ProductID = 54, @@ -21599,7 +21599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0f }, - new OrderDetail + new() { OrderID = 10442, ProductID = 66, @@ -21607,7 +21607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10443, ProductID = 11, @@ -21615,7 +21615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10443, ProductID = 28, @@ -21623,7 +21623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10444, ProductID = 17, @@ -21631,7 +21631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10444, ProductID = 26, @@ -21639,7 +21639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10444, ProductID = 35, @@ -21647,7 +21647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10444, ProductID = 41, @@ -21655,7 +21655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10445, ProductID = 39, @@ -21663,7 +21663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10445, ProductID = 54, @@ -21671,7 +21671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10446, ProductID = 19, @@ -21679,7 +21679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10446, ProductID = 24, @@ -21687,7 +21687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10446, ProductID = 31, @@ -21695,7 +21695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10446, ProductID = 52, @@ -21703,7 +21703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10447, ProductID = 19, @@ -21711,7 +21711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10447, ProductID = 65, @@ -21719,7 +21719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10447, ProductID = 71, @@ -21727,7 +21727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10448, ProductID = 26, @@ -21735,7 +21735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10448, ProductID = 40, @@ -21743,7 +21743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10449, ProductID = 10, @@ -21751,7 +21751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10449, ProductID = 52, @@ -21759,7 +21759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10449, ProductID = 62, @@ -21767,7 +21767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10450, ProductID = 10, @@ -21775,7 +21775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10450, ProductID = 54, @@ -21783,7 +21783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10451, ProductID = 55, @@ -21791,7 +21791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 120, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10451, ProductID = 64, @@ -21799,7 +21799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10451, ProductID = 65, @@ -21807,7 +21807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10451, ProductID = 77, @@ -21815,7 +21815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 55, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10452, ProductID = 28, @@ -21823,7 +21823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10452, ProductID = 44, @@ -21831,7 +21831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 100, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10453, ProductID = 48, @@ -21839,7 +21839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10453, ProductID = 70, @@ -21847,7 +21847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10454, ProductID = 16, @@ -21855,7 +21855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10454, ProductID = 33, @@ -21863,7 +21863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10454, ProductID = 46, @@ -21871,7 +21871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10455, ProductID = 39, @@ -21879,7 +21879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10455, ProductID = 53, @@ -21887,7 +21887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10455, ProductID = 61, @@ -21895,7 +21895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10455, ProductID = 71, @@ -21903,7 +21903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10456, ProductID = 21, @@ -21911,7 +21911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10456, ProductID = 49, @@ -21919,7 +21919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10457, ProductID = 59, @@ -21927,7 +21927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0f }, - new OrderDetail + new() { OrderID = 10458, ProductID = 26, @@ -21935,7 +21935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10458, ProductID = 28, @@ -21943,7 +21943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10458, ProductID = 43, @@ -21951,7 +21951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10458, ProductID = 56, @@ -21959,7 +21959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10458, ProductID = 71, @@ -21967,7 +21967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10459, ProductID = 7, @@ -21975,7 +21975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10459, ProductID = 46, @@ -21983,7 +21983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10459, ProductID = 72, @@ -21991,7 +21991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10460, ProductID = 68, @@ -21999,7 +21999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10460, ProductID = 75, @@ -22007,7 +22007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10461, ProductID = 21, @@ -22015,7 +22015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10461, ProductID = 30, @@ -22023,7 +22023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10461, ProductID = 55, @@ -22031,7 +22031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10462, ProductID = 13, @@ -22039,7 +22039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 10462, ProductID = 23, @@ -22047,7 +22047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10463, ProductID = 19, @@ -22055,7 +22055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10463, ProductID = 42, @@ -22063,7 +22063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10464, ProductID = 4, @@ -22071,7 +22071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10464, ProductID = 43, @@ -22079,7 +22079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10464, ProductID = 56, @@ -22087,7 +22087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10464, ProductID = 60, @@ -22095,7 +22095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10465, ProductID = 24, @@ -22103,7 +22103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10465, ProductID = 29, @@ -22111,7 +22111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10465, ProductID = 40, @@ -22119,7 +22119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10465, ProductID = 45, @@ -22127,7 +22127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10465, ProductID = 50, @@ -22135,7 +22135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10466, ProductID = 11, @@ -22143,7 +22143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10466, ProductID = 46, @@ -22151,7 +22151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10467, ProductID = 24, @@ -22159,7 +22159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10467, ProductID = 25, @@ -22167,7 +22167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10468, ProductID = 30, @@ -22175,7 +22175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10468, ProductID = 43, @@ -22183,7 +22183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10469, ProductID = 2, @@ -22191,7 +22191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10469, ProductID = 16, @@ -22199,7 +22199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10469, ProductID = 44, @@ -22207,7 +22207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10470, ProductID = 18, @@ -22215,7 +22215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10470, ProductID = 23, @@ -22223,7 +22223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10470, ProductID = 64, @@ -22231,7 +22231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10471, ProductID = 7, @@ -22239,7 +22239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10471, ProductID = 56, @@ -22247,7 +22247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10472, ProductID = 24, @@ -22255,7 +22255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10472, ProductID = 51, @@ -22263,7 +22263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10473, ProductID = 33, @@ -22271,7 +22271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10473, ProductID = 71, @@ -22279,7 +22279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10474, ProductID = 14, @@ -22287,7 +22287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10474, ProductID = 28, @@ -22295,7 +22295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10474, ProductID = 40, @@ -22303,7 +22303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10474, ProductID = 75, @@ -22311,7 +22311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10475, ProductID = 31, @@ -22319,7 +22319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10475, ProductID = 66, @@ -22327,7 +22327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10475, ProductID = 76, @@ -22335,7 +22335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10476, ProductID = 55, @@ -22343,7 +22343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10476, ProductID = 70, @@ -22351,7 +22351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10477, ProductID = 1, @@ -22359,7 +22359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10477, ProductID = 21, @@ -22367,7 +22367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10477, ProductID = 39, @@ -22375,7 +22375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10478, ProductID = 10, @@ -22383,7 +22383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10479, ProductID = 38, @@ -22391,7 +22391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10479, ProductID = 53, @@ -22399,7 +22399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10479, ProductID = 59, @@ -22407,7 +22407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10479, ProductID = 64, @@ -22415,7 +22415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10480, ProductID = 47, @@ -22423,7 +22423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10480, ProductID = 59, @@ -22431,7 +22431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10481, ProductID = 49, @@ -22439,7 +22439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10481, ProductID = 60, @@ -22447,7 +22447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10482, ProductID = 40, @@ -22455,7 +22455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10483, ProductID = 34, @@ -22463,7 +22463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10483, ProductID = 77, @@ -22471,7 +22471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10484, ProductID = 21, @@ -22479,7 +22479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10484, ProductID = 40, @@ -22487,7 +22487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10484, ProductID = 51, @@ -22495,7 +22495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10485, ProductID = 2, @@ -22503,7 +22503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10485, ProductID = 3, @@ -22511,7 +22511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10485, ProductID = 55, @@ -22519,7 +22519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10485, ProductID = 70, @@ -22527,7 +22527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10486, ProductID = 11, @@ -22535,7 +22535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10486, ProductID = 51, @@ -22543,7 +22543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10486, ProductID = 74, @@ -22551,7 +22551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10487, ProductID = 19, @@ -22559,7 +22559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10487, ProductID = 26, @@ -22567,7 +22567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10487, ProductID = 54, @@ -22575,7 +22575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10488, ProductID = 59, @@ -22583,7 +22583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10488, ProductID = 73, @@ -22591,7 +22591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10489, ProductID = 11, @@ -22599,7 +22599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10489, ProductID = 16, @@ -22607,7 +22607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10490, ProductID = 59, @@ -22615,7 +22615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10490, ProductID = 68, @@ -22623,7 +22623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10490, ProductID = 75, @@ -22631,7 +22631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0f }, - new OrderDetail + new() { OrderID = 10491, ProductID = 44, @@ -22639,7 +22639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10491, ProductID = 77, @@ -22647,7 +22647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10492, ProductID = 25, @@ -22655,7 +22655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10492, ProductID = 42, @@ -22663,7 +22663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10493, ProductID = 65, @@ -22671,7 +22671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10493, ProductID = 66, @@ -22679,7 +22679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10493, ProductID = 69, @@ -22687,7 +22687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10494, ProductID = 56, @@ -22695,7 +22695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10495, ProductID = 23, @@ -22703,7 +22703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10495, ProductID = 41, @@ -22711,7 +22711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10495, ProductID = 77, @@ -22719,7 +22719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10496, ProductID = 31, @@ -22727,7 +22727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10497, ProductID = 56, @@ -22735,7 +22735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10497, ProductID = 72, @@ -22743,7 +22743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10497, ProductID = 77, @@ -22751,7 +22751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10498, ProductID = 24, @@ -22759,7 +22759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10498, ProductID = 40, @@ -22767,7 +22767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10498, ProductID = 42, @@ -22775,7 +22775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10499, ProductID = 28, @@ -22783,7 +22783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10499, ProductID = 49, @@ -22791,7 +22791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10500, ProductID = 15, @@ -22799,7 +22799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10500, ProductID = 28, @@ -22807,7 +22807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10501, ProductID = 54, @@ -22815,7 +22815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10502, ProductID = 45, @@ -22823,7 +22823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10502, ProductID = 53, @@ -22831,7 +22831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10502, ProductID = 67, @@ -22839,7 +22839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10503, ProductID = 14, @@ -22847,7 +22847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0f }, - new OrderDetail + new() { OrderID = 10503, ProductID = 65, @@ -22855,7 +22855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10504, ProductID = 2, @@ -22863,7 +22863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10504, ProductID = 21, @@ -22871,7 +22871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10504, ProductID = 53, @@ -22879,7 +22879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10504, ProductID = 61, @@ -22887,7 +22887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10505, ProductID = 62, @@ -22895,7 +22895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10506, ProductID = 25, @@ -22903,7 +22903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10506, ProductID = 70, @@ -22911,7 +22911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10507, ProductID = 43, @@ -22919,7 +22919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10507, ProductID = 48, @@ -22927,7 +22927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10508, ProductID = 13, @@ -22935,7 +22935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10508, ProductID = 39, @@ -22943,7 +22943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10509, ProductID = 28, @@ -22951,7 +22951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10510, ProductID = 29, @@ -22959,7 +22959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0f }, - new OrderDetail + new() { OrderID = 10510, ProductID = 75, @@ -22967,7 +22967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10511, ProductID = 4, @@ -22975,7 +22975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10511, ProductID = 7, @@ -22983,7 +22983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10511, ProductID = 8, @@ -22991,7 +22991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10512, ProductID = 24, @@ -22999,7 +22999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10512, ProductID = 46, @@ -23007,7 +23007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10512, ProductID = 47, @@ -23015,7 +23015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10512, ProductID = 60, @@ -23023,7 +23023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10513, ProductID = 21, @@ -23031,7 +23031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10513, ProductID = 32, @@ -23039,7 +23039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10513, ProductID = 61, @@ -23047,7 +23047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10514, ProductID = 20, @@ -23055,7 +23055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 39, Discount = 0f }, - new OrderDetail + new() { OrderID = 10514, ProductID = 28, @@ -23063,7 +23063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10514, ProductID = 56, @@ -23071,7 +23071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0f }, - new OrderDetail + new() { OrderID = 10514, ProductID = 65, @@ -23079,7 +23079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 39, Discount = 0f }, - new OrderDetail + new() { OrderID = 10514, ProductID = 75, @@ -23087,7 +23087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10515, ProductID = 9, @@ -23095,7 +23095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10515, ProductID = 16, @@ -23103,7 +23103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10515, ProductID = 27, @@ -23111,7 +23111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 120, Discount = 0f }, - new OrderDetail + new() { OrderID = 10515, ProductID = 33, @@ -23119,7 +23119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10515, ProductID = 60, @@ -23127,7 +23127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 84, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10516, ProductID = 18, @@ -23135,7 +23135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10516, ProductID = 41, @@ -23143,7 +23143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10516, ProductID = 42, @@ -23151,7 +23151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10517, ProductID = 52, @@ -23159,7 +23159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10517, ProductID = 59, @@ -23167,7 +23167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10517, ProductID = 70, @@ -23175,7 +23175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10518, ProductID = 24, @@ -23183,7 +23183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10518, ProductID = 38, @@ -23191,7 +23191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10518, ProductID = 44, @@ -23199,7 +23199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10519, ProductID = 10, @@ -23207,7 +23207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10519, ProductID = 56, @@ -23215,7 +23215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10519, ProductID = 60, @@ -23223,7 +23223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10520, ProductID = 24, @@ -23231,7 +23231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10520, ProductID = 53, @@ -23239,7 +23239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10521, ProductID = 35, @@ -23247,7 +23247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10521, ProductID = 41, @@ -23255,7 +23255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10521, ProductID = 68, @@ -23263,7 +23263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10522, ProductID = 1, @@ -23271,7 +23271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10522, ProductID = 8, @@ -23279,7 +23279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10522, ProductID = 30, @@ -23287,7 +23287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10522, ProductID = 40, @@ -23295,7 +23295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10523, ProductID = 17, @@ -23303,7 +23303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10523, ProductID = 20, @@ -23311,7 +23311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10523, ProductID = 37, @@ -23319,7 +23319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10523, ProductID = 41, @@ -23327,7 +23327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10524, ProductID = 10, @@ -23335,7 +23335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10524, ProductID = 30, @@ -23343,7 +23343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10524, ProductID = 43, @@ -23351,7 +23351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10524, ProductID = 54, @@ -23359,7 +23359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10525, ProductID = 36, @@ -23367,7 +23367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10525, ProductID = 40, @@ -23375,7 +23375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10526, ProductID = 1, @@ -23383,7 +23383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10526, ProductID = 13, @@ -23391,7 +23391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10526, ProductID = 56, @@ -23399,7 +23399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10527, ProductID = 4, @@ -23407,7 +23407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10527, ProductID = 36, @@ -23415,7 +23415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10528, ProductID = 11, @@ -23423,7 +23423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10528, ProductID = 33, @@ -23431,7 +23431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10528, ProductID = 72, @@ -23439,7 +23439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10529, ProductID = 55, @@ -23447,7 +23447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10529, ProductID = 68, @@ -23455,7 +23455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10529, ProductID = 69, @@ -23463,7 +23463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10530, ProductID = 17, @@ -23471,7 +23471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10530, ProductID = 43, @@ -23479,7 +23479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10530, ProductID = 61, @@ -23487,7 +23487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10530, ProductID = 76, @@ -23495,7 +23495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10531, ProductID = 59, @@ -23503,7 +23503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10532, ProductID = 30, @@ -23511,7 +23511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10532, ProductID = 66, @@ -23519,7 +23519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10533, ProductID = 4, @@ -23527,7 +23527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10533, ProductID = 72, @@ -23535,7 +23535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10533, ProductID = 73, @@ -23543,7 +23543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10534, ProductID = 30, @@ -23551,7 +23551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10534, ProductID = 40, @@ -23559,7 +23559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10534, ProductID = 54, @@ -23567,7 +23567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10535, ProductID = 11, @@ -23575,7 +23575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10535, ProductID = 40, @@ -23583,7 +23583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10535, ProductID = 57, @@ -23591,7 +23591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10535, ProductID = 59, @@ -23599,7 +23599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10536, ProductID = 12, @@ -23607,7 +23607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10536, ProductID = 31, @@ -23615,7 +23615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10536, ProductID = 33, @@ -23623,7 +23623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10536, ProductID = 60, @@ -23631,7 +23631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10537, ProductID = 31, @@ -23639,7 +23639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10537, ProductID = 51, @@ -23647,7 +23647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10537, ProductID = 58, @@ -23655,7 +23655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10537, ProductID = 72, @@ -23663,7 +23663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10537, ProductID = 73, @@ -23671,7 +23671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10538, ProductID = 70, @@ -23679,7 +23679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10538, ProductID = 72, @@ -23687,7 +23687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 10539, ProductID = 13, @@ -23695,7 +23695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10539, ProductID = 21, @@ -23703,7 +23703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10539, ProductID = 33, @@ -23711,7 +23711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10539, ProductID = 49, @@ -23719,7 +23719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10540, ProductID = 3, @@ -23727,7 +23727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10540, ProductID = 26, @@ -23735,7 +23735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10540, ProductID = 38, @@ -23743,7 +23743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10540, ProductID = 68, @@ -23751,7 +23751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10541, ProductID = 24, @@ -23759,7 +23759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10541, ProductID = 38, @@ -23767,7 +23767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10541, ProductID = 65, @@ -23775,7 +23775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10541, ProductID = 71, @@ -23783,7 +23783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10542, ProductID = 11, @@ -23791,7 +23791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10542, ProductID = 54, @@ -23799,7 +23799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10543, ProductID = 12, @@ -23807,7 +23807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10543, ProductID = 23, @@ -23815,7 +23815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10544, ProductID = 28, @@ -23823,7 +23823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10544, ProductID = 67, @@ -23831,7 +23831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10545, ProductID = 11, @@ -23839,7 +23839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10546, ProductID = 7, @@ -23847,7 +23847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10546, ProductID = 35, @@ -23855,7 +23855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10546, ProductID = 62, @@ -23863,7 +23863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10547, ProductID = 32, @@ -23871,7 +23871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10547, ProductID = 36, @@ -23879,7 +23879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10548, ProductID = 34, @@ -23887,7 +23887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10548, ProductID = 41, @@ -23895,7 +23895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10549, ProductID = 31, @@ -23903,7 +23903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 55, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10549, ProductID = 45, @@ -23911,7 +23911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 100, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10549, ProductID = 51, @@ -23919,7 +23919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 48, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10550, ProductID = 17, @@ -23927,7 +23927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10550, ProductID = 19, @@ -23935,7 +23935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10550, ProductID = 21, @@ -23943,7 +23943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10550, ProductID = 61, @@ -23951,7 +23951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10551, ProductID = 16, @@ -23959,7 +23959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10551, ProductID = 35, @@ -23967,7 +23967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10551, ProductID = 44, @@ -23975,7 +23975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10552, ProductID = 69, @@ -23983,7 +23983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10552, ProductID = 75, @@ -23991,7 +23991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10553, ProductID = 11, @@ -23999,7 +23999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10553, ProductID = 16, @@ -24007,7 +24007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10553, ProductID = 22, @@ -24015,7 +24015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10553, ProductID = 31, @@ -24023,7 +24023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10553, ProductID = 35, @@ -24031,7 +24031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10554, ProductID = 16, @@ -24039,7 +24039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10554, ProductID = 23, @@ -24047,7 +24047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10554, ProductID = 62, @@ -24055,7 +24055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10554, ProductID = 77, @@ -24063,7 +24063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10555, ProductID = 14, @@ -24071,7 +24071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10555, ProductID = 19, @@ -24079,7 +24079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10555, ProductID = 24, @@ -24087,7 +24087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10555, ProductID = 51, @@ -24095,7 +24095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10555, ProductID = 56, @@ -24103,7 +24103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10556, ProductID = 72, @@ -24111,7 +24111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10557, ProductID = 64, @@ -24119,7 +24119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10557, ProductID = 75, @@ -24127,7 +24127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10558, ProductID = 47, @@ -24135,7 +24135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10558, ProductID = 51, @@ -24143,7 +24143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10558, ProductID = 52, @@ -24151,7 +24151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10558, ProductID = 53, @@ -24159,7 +24159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10558, ProductID = 73, @@ -24167,7 +24167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10559, ProductID = 41, @@ -24175,7 +24175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10559, ProductID = 55, @@ -24183,7 +24183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10560, ProductID = 30, @@ -24191,7 +24191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10560, ProductID = 62, @@ -24199,7 +24199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10561, ProductID = 44, @@ -24207,7 +24207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10561, ProductID = 51, @@ -24215,7 +24215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10562, ProductID = 33, @@ -24223,7 +24223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10562, ProductID = 62, @@ -24231,7 +24231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10563, ProductID = 36, @@ -24239,7 +24239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10563, ProductID = 52, @@ -24247,7 +24247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0f }, - new OrderDetail + new() { OrderID = 10564, ProductID = 17, @@ -24255,7 +24255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10564, ProductID = 31, @@ -24263,7 +24263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10564, ProductID = 55, @@ -24271,7 +24271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10565, ProductID = 24, @@ -24279,7 +24279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10565, ProductID = 64, @@ -24287,7 +24287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10566, ProductID = 11, @@ -24295,7 +24295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10566, ProductID = 18, @@ -24303,7 +24303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10566, ProductID = 76, @@ -24311,7 +24311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10567, ProductID = 31, @@ -24319,7 +24319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10567, ProductID = 51, @@ -24327,7 +24327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10567, ProductID = 59, @@ -24335,7 +24335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10568, ProductID = 10, @@ -24343,7 +24343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10569, ProductID = 31, @@ -24351,7 +24351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10569, ProductID = 76, @@ -24359,7 +24359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10570, ProductID = 11, @@ -24367,7 +24367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10570, ProductID = 56, @@ -24375,7 +24375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10571, ProductID = 14, @@ -24383,7 +24383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 11, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10571, ProductID = 42, @@ -24391,7 +24391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10572, ProductID = 16, @@ -24399,7 +24399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10572, ProductID = 32, @@ -24407,7 +24407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10572, ProductID = 40, @@ -24415,7 +24415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10572, ProductID = 75, @@ -24423,7 +24423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10573, ProductID = 17, @@ -24431,7 +24431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10573, ProductID = 34, @@ -24439,7 +24439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10573, ProductID = 53, @@ -24447,7 +24447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10574, ProductID = 33, @@ -24455,7 +24455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10574, ProductID = 40, @@ -24463,7 +24463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10574, ProductID = 62, @@ -24471,7 +24471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10574, ProductID = 64, @@ -24479,7 +24479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10575, ProductID = 59, @@ -24487,7 +24487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10575, ProductID = 63, @@ -24495,7 +24495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10575, ProductID = 72, @@ -24503,7 +24503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10575, ProductID = 76, @@ -24511,7 +24511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10576, ProductID = 1, @@ -24519,7 +24519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10576, ProductID = 31, @@ -24527,7 +24527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10576, ProductID = 44, @@ -24535,7 +24535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10577, ProductID = 39, @@ -24543,7 +24543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10577, ProductID = 75, @@ -24551,7 +24551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10577, ProductID = 77, @@ -24559,7 +24559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10578, ProductID = 35, @@ -24567,7 +24567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10578, ProductID = 57, @@ -24575,7 +24575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10579, ProductID = 15, @@ -24583,7 +24583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10579, ProductID = 75, @@ -24591,7 +24591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10580, ProductID = 14, @@ -24599,7 +24599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10580, ProductID = 41, @@ -24607,7 +24607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10580, ProductID = 65, @@ -24615,7 +24615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10581, ProductID = 75, @@ -24623,7 +24623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10582, ProductID = 57, @@ -24631,7 +24631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10582, ProductID = 76, @@ -24639,7 +24639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10583, ProductID = 29, @@ -24647,7 +24647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10583, ProductID = 60, @@ -24655,7 +24655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10583, ProductID = 69, @@ -24663,7 +24663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10584, ProductID = 31, @@ -24671,7 +24671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10585, ProductID = 47, @@ -24679,7 +24679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10586, ProductID = 52, @@ -24687,7 +24687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10587, ProductID = 26, @@ -24695,7 +24695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10587, ProductID = 35, @@ -24703,7 +24703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10587, ProductID = 77, @@ -24711,7 +24711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10588, ProductID = 18, @@ -24719,7 +24719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10588, ProductID = 42, @@ -24727,7 +24727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 100, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10589, ProductID = 35, @@ -24735,7 +24735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10590, ProductID = 1, @@ -24743,7 +24743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10590, ProductID = 77, @@ -24751,7 +24751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10591, ProductID = 3, @@ -24759,7 +24759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10591, ProductID = 7, @@ -24767,7 +24767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10591, ProductID = 54, @@ -24775,7 +24775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10592, ProductID = 15, @@ -24783,7 +24783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10592, ProductID = 26, @@ -24791,7 +24791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10593, ProductID = 20, @@ -24799,7 +24799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10593, ProductID = 69, @@ -24807,7 +24807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10593, ProductID = 76, @@ -24815,7 +24815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10594, ProductID = 52, @@ -24823,7 +24823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10594, ProductID = 58, @@ -24831,7 +24831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10595, ProductID = 35, @@ -24839,7 +24839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10595, ProductID = 61, @@ -24847,7 +24847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 120, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10595, ProductID = 69, @@ -24855,7 +24855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 65, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10596, ProductID = 56, @@ -24863,7 +24863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10596, ProductID = 63, @@ -24871,7 +24871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10596, ProductID = 75, @@ -24879,7 +24879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10597, ProductID = 24, @@ -24887,7 +24887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10597, ProductID = 57, @@ -24895,7 +24895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10597, ProductID = 65, @@ -24903,7 +24903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10598, ProductID = 27, @@ -24911,7 +24911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10598, ProductID = 71, @@ -24919,7 +24919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10599, ProductID = 62, @@ -24927,7 +24927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10600, ProductID = 54, @@ -24935,7 +24935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10600, ProductID = 73, @@ -24943,7 +24943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10601, ProductID = 13, @@ -24951,7 +24951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10601, ProductID = 59, @@ -24959,7 +24959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10602, ProductID = 77, @@ -24967,7 +24967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10603, ProductID = 22, @@ -24975,7 +24975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 48, Discount = 0f }, - new OrderDetail + new() { OrderID = 10603, ProductID = 49, @@ -24983,7 +24983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10604, ProductID = 48, @@ -24991,7 +24991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10604, ProductID = 76, @@ -24999,7 +24999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10605, ProductID = 16, @@ -25007,7 +25007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10605, ProductID = 59, @@ -25015,7 +25015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10605, ProductID = 60, @@ -25023,7 +25023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10605, ProductID = 71, @@ -25031,7 +25031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10606, ProductID = 4, @@ -25039,7 +25039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10606, ProductID = 55, @@ -25047,7 +25047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10606, ProductID = 62, @@ -25055,7 +25055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10607, ProductID = 7, @@ -25063,7 +25063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0f }, - new OrderDetail + new() { OrderID = 10607, ProductID = 17, @@ -25071,7 +25071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 100, Discount = 0f }, - new OrderDetail + new() { OrderID = 10607, ProductID = 33, @@ -25079,7 +25079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10607, ProductID = 40, @@ -25087,7 +25087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0f }, - new OrderDetail + new() { OrderID = 10607, ProductID = 72, @@ -25095,7 +25095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10608, ProductID = 56, @@ -25103,7 +25103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10609, ProductID = 1, @@ -25111,7 +25111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10609, ProductID = 10, @@ -25119,7 +25119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10609, ProductID = 21, @@ -25127,7 +25127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10610, ProductID = 36, @@ -25135,7 +25135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10611, ProductID = 1, @@ -25143,7 +25143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10611, ProductID = 2, @@ -25151,7 +25151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10611, ProductID = 60, @@ -25159,7 +25159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10612, ProductID = 10, @@ -25167,7 +25167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0f }, - new OrderDetail + new() { OrderID = 10612, ProductID = 36, @@ -25175,7 +25175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 55, Discount = 0f }, - new OrderDetail + new() { OrderID = 10612, ProductID = 49, @@ -25183,7 +25183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10612, ProductID = 60, @@ -25191,7 +25191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10612, ProductID = 76, @@ -25199,7 +25199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0f }, - new OrderDetail + new() { OrderID = 10613, ProductID = 13, @@ -25207,7 +25207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10613, ProductID = 75, @@ -25215,7 +25215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10614, ProductID = 11, @@ -25223,7 +25223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10614, ProductID = 21, @@ -25231,7 +25231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10614, ProductID = 39, @@ -25239,7 +25239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10615, ProductID = 55, @@ -25247,7 +25247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10616, ProductID = 38, @@ -25255,7 +25255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10616, ProductID = 56, @@ -25263,7 +25263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10616, ProductID = 70, @@ -25271,7 +25271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10616, ProductID = 71, @@ -25279,7 +25279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10617, ProductID = 59, @@ -25287,7 +25287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10618, ProductID = 6, @@ -25295,7 +25295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0f }, - new OrderDetail + new() { OrderID = 10618, ProductID = 56, @@ -25303,7 +25303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10618, ProductID = 68, @@ -25311,7 +25311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10619, ProductID = 21, @@ -25319,7 +25319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0f }, - new OrderDetail + new() { OrderID = 10619, ProductID = 22, @@ -25327,7 +25327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10620, ProductID = 24, @@ -25335,7 +25335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10620, ProductID = 52, @@ -25343,7 +25343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10621, ProductID = 19, @@ -25351,7 +25351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10621, ProductID = 23, @@ -25359,7 +25359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10621, ProductID = 70, @@ -25367,7 +25367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10621, ProductID = 71, @@ -25375,7 +25375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10622, ProductID = 2, @@ -25383,7 +25383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10622, ProductID = 68, @@ -25391,7 +25391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10623, ProductID = 14, @@ -25399,7 +25399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10623, ProductID = 19, @@ -25407,7 +25407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10623, ProductID = 21, @@ -25415,7 +25415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10623, ProductID = 24, @@ -25423,7 +25423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10623, ProductID = 35, @@ -25431,7 +25431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10624, ProductID = 28, @@ -25439,7 +25439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10624, ProductID = 29, @@ -25447,7 +25447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10624, ProductID = 44, @@ -25455,7 +25455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10625, ProductID = 14, @@ -25463,7 +25463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10625, ProductID = 42, @@ -25471,7 +25471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10625, ProductID = 60, @@ -25479,7 +25479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10626, ProductID = 53, @@ -25487,7 +25487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10626, ProductID = 60, @@ -25495,7 +25495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10626, ProductID = 71, @@ -25503,7 +25503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10627, ProductID = 62, @@ -25511,7 +25511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10627, ProductID = 73, @@ -25519,7 +25519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10628, ProductID = 1, @@ -25527,7 +25527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10629, ProductID = 29, @@ -25535,7 +25535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10629, ProductID = 64, @@ -25543,7 +25543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10630, ProductID = 55, @@ -25551,7 +25551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10630, ProductID = 76, @@ -25559,7 +25559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10631, ProductID = 75, @@ -25567,7 +25567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10632, ProductID = 2, @@ -25575,7 +25575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10632, ProductID = 33, @@ -25583,7 +25583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10633, ProductID = 12, @@ -25591,7 +25591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10633, ProductID = 13, @@ -25599,7 +25599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 13, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10633, ProductID = 26, @@ -25607,7 +25607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10633, ProductID = 62, @@ -25615,7 +25615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10634, ProductID = 7, @@ -25623,7 +25623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10634, ProductID = 18, @@ -25631,7 +25631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10634, ProductID = 51, @@ -25639,7 +25639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10634, ProductID = 75, @@ -25647,7 +25647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10635, ProductID = 4, @@ -25655,7 +25655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10635, ProductID = 5, @@ -25663,7 +25663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10635, ProductID = 22, @@ -25671,7 +25671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10636, ProductID = 4, @@ -25679,7 +25679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10636, ProductID = 58, @@ -25687,7 +25687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10637, ProductID = 11, @@ -25695,7 +25695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10637, ProductID = 50, @@ -25703,7 +25703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10637, ProductID = 56, @@ -25711,7 +25711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10638, ProductID = 45, @@ -25719,7 +25719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10638, ProductID = 65, @@ -25727,7 +25727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10638, ProductID = 72, @@ -25735,7 +25735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10639, ProductID = 18, @@ -25743,7 +25743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10640, ProductID = 69, @@ -25751,7 +25751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10640, ProductID = 70, @@ -25759,7 +25759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10641, ProductID = 2, @@ -25767,7 +25767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10641, ProductID = 40, @@ -25775,7 +25775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10642, ProductID = 21, @@ -25783,7 +25783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10642, ProductID = 61, @@ -25791,7 +25791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10643, ProductID = 28, @@ -25799,7 +25799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10643, ProductID = 39, @@ -25807,7 +25807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10643, ProductID = 46, @@ -25815,7 +25815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10644, ProductID = 18, @@ -25823,7 +25823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10644, ProductID = 43, @@ -25831,7 +25831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10644, ProductID = 46, @@ -25839,7 +25839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10645, ProductID = 18, @@ -25847,7 +25847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10645, ProductID = 36, @@ -25855,7 +25855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10646, ProductID = 1, @@ -25863,7 +25863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10646, ProductID = 10, @@ -25871,7 +25871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10646, ProductID = 71, @@ -25879,7 +25879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10646, ProductID = 77, @@ -25887,7 +25887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10647, ProductID = 19, @@ -25895,7 +25895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10647, ProductID = 39, @@ -25903,7 +25903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10648, ProductID = 22, @@ -25911,7 +25911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10648, ProductID = 24, @@ -25919,7 +25919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10649, ProductID = 28, @@ -25927,7 +25927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10649, ProductID = 72, @@ -25935,7 +25935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10650, ProductID = 30, @@ -25943,7 +25943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10650, ProductID = 53, @@ -25951,7 +25951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10650, ProductID = 54, @@ -25959,7 +25959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10651, ProductID = 19, @@ -25967,7 +25967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10651, ProductID = 22, @@ -25975,7 +25975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10652, ProductID = 30, @@ -25983,7 +25983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10652, ProductID = 42, @@ -25991,7 +25991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10653, ProductID = 16, @@ -25999,7 +25999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10653, ProductID = 60, @@ -26007,7 +26007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10654, ProductID = 4, @@ -26015,7 +26015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10654, ProductID = 39, @@ -26023,7 +26023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10654, ProductID = 54, @@ -26031,7 +26031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10655, ProductID = 41, @@ -26039,7 +26039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10656, ProductID = 14, @@ -26047,7 +26047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10656, ProductID = 44, @@ -26055,7 +26055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10656, ProductID = 47, @@ -26063,7 +26063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10657, ProductID = 15, @@ -26071,7 +26071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10657, ProductID = 41, @@ -26079,7 +26079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10657, ProductID = 46, @@ -26087,7 +26087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0f }, - new OrderDetail + new() { OrderID = 10657, ProductID = 47, @@ -26095,7 +26095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10657, ProductID = 56, @@ -26103,7 +26103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0f }, - new OrderDetail + new() { OrderID = 10657, ProductID = 60, @@ -26111,7 +26111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10658, ProductID = 21, @@ -26119,7 +26119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10658, ProductID = 40, @@ -26127,7 +26127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10658, ProductID = 60, @@ -26135,7 +26135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 55, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10658, ProductID = 77, @@ -26143,7 +26143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10659, ProductID = 31, @@ -26151,7 +26151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10659, ProductID = 40, @@ -26159,7 +26159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10659, ProductID = 70, @@ -26167,7 +26167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10660, ProductID = 20, @@ -26175,7 +26175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10661, ProductID = 39, @@ -26183,7 +26183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10661, ProductID = 58, @@ -26191,7 +26191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 49, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10662, ProductID = 68, @@ -26199,7 +26199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10663, ProductID = 40, @@ -26207,7 +26207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10663, ProductID = 42, @@ -26215,7 +26215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10663, ProductID = 51, @@ -26223,7 +26223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10664, ProductID = 10, @@ -26231,7 +26231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10664, ProductID = 56, @@ -26239,7 +26239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10664, ProductID = 65, @@ -26247,7 +26247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10665, ProductID = 51, @@ -26255,7 +26255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10665, ProductID = 59, @@ -26263,7 +26263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 10665, ProductID = 76, @@ -26271,7 +26271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10666, ProductID = 29, @@ -26279,7 +26279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0f }, - new OrderDetail + new() { OrderID = 10666, ProductID = 65, @@ -26287,7 +26287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10667, ProductID = 69, @@ -26295,7 +26295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10667, ProductID = 71, @@ -26303,7 +26303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10668, ProductID = 31, @@ -26311,7 +26311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10668, ProductID = 55, @@ -26319,7 +26319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10668, ProductID = 64, @@ -26327,7 +26327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10669, ProductID = 36, @@ -26335,7 +26335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10670, ProductID = 23, @@ -26343,7 +26343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 32, Discount = 0f }, - new OrderDetail + new() { OrderID = 10670, ProductID = 46, @@ -26351,7 +26351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10670, ProductID = 67, @@ -26359,7 +26359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10670, ProductID = 73, @@ -26367,7 +26367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10670, ProductID = 75, @@ -26375,7 +26375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10671, ProductID = 16, @@ -26383,7 +26383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10671, ProductID = 62, @@ -26391,7 +26391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10671, ProductID = 65, @@ -26399,7 +26399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10672, ProductID = 38, @@ -26407,7 +26407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10672, ProductID = 71, @@ -26415,7 +26415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10673, ProductID = 16, @@ -26423,7 +26423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10673, ProductID = 42, @@ -26431,7 +26431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10673, ProductID = 43, @@ -26439,7 +26439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10674, ProductID = 23, @@ -26447,7 +26447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10675, ProductID = 14, @@ -26455,7 +26455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10675, ProductID = 53, @@ -26463,7 +26463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10675, ProductID = 58, @@ -26471,7 +26471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10676, ProductID = 10, @@ -26479,7 +26479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10676, ProductID = 19, @@ -26487,7 +26487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10676, ProductID = 44, @@ -26495,7 +26495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10677, ProductID = 26, @@ -26503,7 +26503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10677, ProductID = 33, @@ -26511,7 +26511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10678, ProductID = 12, @@ -26519,7 +26519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 100, Discount = 0f }, - new OrderDetail + new() { OrderID = 10678, ProductID = 33, @@ -26527,7 +26527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10678, ProductID = 41, @@ -26535,7 +26535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 120, Discount = 0f }, - new OrderDetail + new() { OrderID = 10678, ProductID = 54, @@ -26543,7 +26543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10679, ProductID = 59, @@ -26551,7 +26551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10680, ProductID = 16, @@ -26559,7 +26559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10680, ProductID = 31, @@ -26567,7 +26567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10680, ProductID = 42, @@ -26575,7 +26575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10681, ProductID = 19, @@ -26583,7 +26583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10681, ProductID = 21, @@ -26591,7 +26591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10681, ProductID = 64, @@ -26599,7 +26599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10682, ProductID = 33, @@ -26607,7 +26607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10682, ProductID = 66, @@ -26615,7 +26615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10682, ProductID = 75, @@ -26623,7 +26623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10683, ProductID = 52, @@ -26631,7 +26631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10684, ProductID = 40, @@ -26639,7 +26639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10684, ProductID = 47, @@ -26647,7 +26647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10684, ProductID = 60, @@ -26655,7 +26655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10685, ProductID = 10, @@ -26663,7 +26663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10685, ProductID = 41, @@ -26671,7 +26671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10685, ProductID = 47, @@ -26679,7 +26679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10686, ProductID = 17, @@ -26687,7 +26687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10686, ProductID = 26, @@ -26695,7 +26695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10687, ProductID = 9, @@ -26703,7 +26703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10687, ProductID = 29, @@ -26711,7 +26711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10687, ProductID = 36, @@ -26719,7 +26719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10688, ProductID = 10, @@ -26727,7 +26727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10688, ProductID = 28, @@ -26735,7 +26735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10688, ProductID = 34, @@ -26743,7 +26743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10689, ProductID = 1, @@ -26751,7 +26751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10690, ProductID = 56, @@ -26759,7 +26759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10690, ProductID = 77, @@ -26767,7 +26767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10691, ProductID = 1, @@ -26775,7 +26775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10691, ProductID = 29, @@ -26783,7 +26783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10691, ProductID = 43, @@ -26791,7 +26791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10691, ProductID = 44, @@ -26799,7 +26799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10691, ProductID = 62, @@ -26807,7 +26807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 48, Discount = 0f }, - new OrderDetail + new() { OrderID = 10692, ProductID = 63, @@ -26815,7 +26815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10693, ProductID = 9, @@ -26823,7 +26823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10693, ProductID = 54, @@ -26831,7 +26831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10693, ProductID = 69, @@ -26839,7 +26839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10693, ProductID = 73, @@ -26847,7 +26847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10694, ProductID = 7, @@ -26855,7 +26855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 90, Discount = 0f }, - new OrderDetail + new() { OrderID = 10694, ProductID = 59, @@ -26863,7 +26863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10694, ProductID = 70, @@ -26871,7 +26871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10695, ProductID = 8, @@ -26879,7 +26879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10695, ProductID = 12, @@ -26887,7 +26887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10695, ProductID = 24, @@ -26895,7 +26895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10696, ProductID = 17, @@ -26903,7 +26903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10696, ProductID = 46, @@ -26911,7 +26911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10697, ProductID = 19, @@ -26919,7 +26919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10697, ProductID = 35, @@ -26927,7 +26927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10697, ProductID = 58, @@ -26935,7 +26935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10697, ProductID = 70, @@ -26943,7 +26943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10698, ProductID = 11, @@ -26951,7 +26951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10698, ProductID = 17, @@ -26959,7 +26959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10698, ProductID = 29, @@ -26967,7 +26967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10698, ProductID = 65, @@ -26975,7 +26975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 65, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10698, ProductID = 70, @@ -26983,7 +26983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10699, ProductID = 47, @@ -26991,7 +26991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10700, ProductID = 1, @@ -26999,7 +26999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10700, ProductID = 34, @@ -27007,7 +27007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10700, ProductID = 68, @@ -27015,7 +27015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10700, ProductID = 71, @@ -27023,7 +27023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10701, ProductID = 59, @@ -27031,7 +27031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10701, ProductID = 71, @@ -27039,7 +27039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10701, ProductID = 76, @@ -27047,7 +27047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10702, ProductID = 3, @@ -27055,7 +27055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10702, ProductID = 76, @@ -27063,7 +27063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10703, ProductID = 2, @@ -27071,7 +27071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10703, ProductID = 59, @@ -27079,7 +27079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10703, ProductID = 73, @@ -27087,7 +27087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10704, ProductID = 4, @@ -27095,7 +27095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10704, ProductID = 24, @@ -27103,7 +27103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10704, ProductID = 48, @@ -27111,7 +27111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10705, ProductID = 31, @@ -27119,7 +27119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10705, ProductID = 32, @@ -27127,7 +27127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10706, ProductID = 16, @@ -27135,7 +27135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10706, ProductID = 43, @@ -27143,7 +27143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10706, ProductID = 59, @@ -27151,7 +27151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10707, ProductID = 55, @@ -27159,7 +27159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10707, ProductID = 57, @@ -27167,7 +27167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10707, ProductID = 70, @@ -27175,7 +27175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10708, ProductID = 5, @@ -27183,7 +27183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10708, ProductID = 36, @@ -27191,7 +27191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10709, ProductID = 8, @@ -27199,7 +27199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10709, ProductID = 51, @@ -27207,7 +27207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10709, ProductID = 60, @@ -27215,7 +27215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10710, ProductID = 19, @@ -27223,7 +27223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10710, ProductID = 47, @@ -27231,7 +27231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10711, ProductID = 19, @@ -27239,7 +27239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10711, ProductID = 41, @@ -27247,7 +27247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0f }, - new OrderDetail + new() { OrderID = 10711, ProductID = 53, @@ -27255,7 +27255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 120, Discount = 0f }, - new OrderDetail + new() { OrderID = 10712, ProductID = 53, @@ -27263,7 +27263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10712, ProductID = 56, @@ -27271,7 +27271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10713, ProductID = 10, @@ -27279,7 +27279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10713, ProductID = 26, @@ -27287,7 +27287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10713, ProductID = 45, @@ -27295,7 +27295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 110, Discount = 0f }, - new OrderDetail + new() { OrderID = 10713, ProductID = 46, @@ -27303,7 +27303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10714, ProductID = 2, @@ -27311,7 +27311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10714, ProductID = 17, @@ -27319,7 +27319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 27, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10714, ProductID = 47, @@ -27327,7 +27327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10714, ProductID = 56, @@ -27335,7 +27335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10714, ProductID = 58, @@ -27343,7 +27343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10715, ProductID = 10, @@ -27351,7 +27351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10715, ProductID = 71, @@ -27359,7 +27359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10716, ProductID = 21, @@ -27367,7 +27367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10716, ProductID = 51, @@ -27375,7 +27375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10716, ProductID = 61, @@ -27383,7 +27383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10717, ProductID = 21, @@ -27391,7 +27391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 32, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10717, ProductID = 54, @@ -27399,7 +27399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10717, ProductID = 69, @@ -27407,7 +27407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10718, ProductID = 12, @@ -27415,7 +27415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0f }, - new OrderDetail + new() { OrderID = 10718, ProductID = 16, @@ -27423,7 +27423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10718, ProductID = 36, @@ -27431,7 +27431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10718, ProductID = 62, @@ -27439,7 +27439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10719, ProductID = 18, @@ -27447,7 +27447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10719, ProductID = 30, @@ -27455,7 +27455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10719, ProductID = 54, @@ -27463,7 +27463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10720, ProductID = 35, @@ -27471,7 +27471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10720, ProductID = 71, @@ -27479,7 +27479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10721, ProductID = 44, @@ -27487,7 +27487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10722, ProductID = 2, @@ -27495,7 +27495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10722, ProductID = 31, @@ -27503,7 +27503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10722, ProductID = 68, @@ -27511,7 +27511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0f }, - new OrderDetail + new() { OrderID = 10722, ProductID = 75, @@ -27519,7 +27519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0f }, - new OrderDetail + new() { OrderID = 10723, ProductID = 26, @@ -27527,7 +27527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10724, ProductID = 10, @@ -27535,7 +27535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10724, ProductID = 61, @@ -27543,7 +27543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10725, ProductID = 41, @@ -27551,7 +27551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10725, ProductID = 52, @@ -27559,7 +27559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10725, ProductID = 55, @@ -27567,7 +27567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10726, ProductID = 4, @@ -27575,7 +27575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10726, ProductID = 11, @@ -27583,7 +27583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10727, ProductID = 17, @@ -27591,7 +27591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10727, ProductID = 56, @@ -27599,7 +27599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10727, ProductID = 59, @@ -27607,7 +27607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10728, ProductID = 30, @@ -27615,7 +27615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10728, ProductID = 40, @@ -27623,7 +27623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10728, ProductID = 55, @@ -27631,7 +27631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10728, ProductID = 60, @@ -27639,7 +27639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10729, ProductID = 1, @@ -27647,7 +27647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10729, ProductID = 21, @@ -27655,7 +27655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10729, ProductID = 50, @@ -27663,7 +27663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10730, ProductID = 16, @@ -27671,7 +27671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10730, ProductID = 31, @@ -27679,7 +27679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10730, ProductID = 65, @@ -27687,7 +27687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10731, ProductID = 21, @@ -27695,7 +27695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10731, ProductID = 51, @@ -27703,7 +27703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10732, ProductID = 76, @@ -27711,7 +27711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10733, ProductID = 14, @@ -27719,7 +27719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10733, ProductID = 28, @@ -27727,7 +27727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10733, ProductID = 52, @@ -27735,7 +27735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10734, ProductID = 6, @@ -27743,7 +27743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10734, ProductID = 30, @@ -27751,7 +27751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10734, ProductID = 76, @@ -27759,7 +27759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10735, ProductID = 61, @@ -27767,7 +27767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10735, ProductID = 77, @@ -27775,7 +27775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10736, ProductID = 65, @@ -27783,7 +27783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10736, ProductID = 75, @@ -27791,7 +27791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10737, ProductID = 13, @@ -27799,7 +27799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10737, ProductID = 41, @@ -27807,7 +27807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10738, ProductID = 16, @@ -27815,7 +27815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10739, ProductID = 36, @@ -27823,7 +27823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10739, ProductID = 52, @@ -27831,7 +27831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10740, ProductID = 28, @@ -27839,7 +27839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10740, ProductID = 35, @@ -27847,7 +27847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10740, ProductID = 45, @@ -27855,7 +27855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10740, ProductID = 56, @@ -27863,7 +27863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10741, ProductID = 2, @@ -27871,7 +27871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10742, ProductID = 3, @@ -27879,7 +27879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10742, ProductID = 60, @@ -27887,7 +27887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10742, ProductID = 72, @@ -27895,7 +27895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10743, ProductID = 46, @@ -27903,7 +27903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10744, ProductID = 40, @@ -27911,7 +27911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10745, ProductID = 18, @@ -27919,7 +27919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10745, ProductID = 44, @@ -27927,7 +27927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10745, ProductID = 59, @@ -27935,7 +27935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0f }, - new OrderDetail + new() { OrderID = 10745, ProductID = 72, @@ -27943,7 +27943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10746, ProductID = 13, @@ -27951,7 +27951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10746, ProductID = 42, @@ -27959,7 +27959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10746, ProductID = 62, @@ -27967,7 +27967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10746, ProductID = 69, @@ -27975,7 +27975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10747, ProductID = 31, @@ -27983,7 +27983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10747, ProductID = 41, @@ -27991,7 +27991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10747, ProductID = 63, @@ -27999,7 +27999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10747, ProductID = 69, @@ -28007,7 +28007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10748, ProductID = 23, @@ -28015,7 +28015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 44, Discount = 0f }, - new OrderDetail + new() { OrderID = 10748, ProductID = 40, @@ -28023,7 +28023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10748, ProductID = 56, @@ -28031,7 +28031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10749, ProductID = 56, @@ -28039,7 +28039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10749, ProductID = 59, @@ -28047,7 +28047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10749, ProductID = 76, @@ -28055,7 +28055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10750, ProductID = 14, @@ -28063,7 +28063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10750, ProductID = 45, @@ -28071,7 +28071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10750, ProductID = 59, @@ -28079,7 +28079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10751, ProductID = 26, @@ -28087,7 +28087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10751, ProductID = 30, @@ -28095,7 +28095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10751, ProductID = 50, @@ -28103,7 +28103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10751, ProductID = 73, @@ -28111,7 +28111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10752, ProductID = 1, @@ -28119,7 +28119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10752, ProductID = 69, @@ -28127,7 +28127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10753, ProductID = 45, @@ -28135,7 +28135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10753, ProductID = 74, @@ -28143,7 +28143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10754, ProductID = 40, @@ -28151,7 +28151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10755, ProductID = 47, @@ -28159,7 +28159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10755, ProductID = 56, @@ -28167,7 +28167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10755, ProductID = 57, @@ -28175,7 +28175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10755, ProductID = 69, @@ -28183,7 +28183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10756, ProductID = 18, @@ -28191,7 +28191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10756, ProductID = 36, @@ -28199,7 +28199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10756, ProductID = 68, @@ -28207,7 +28207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10756, ProductID = 69, @@ -28215,7 +28215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10757, ProductID = 34, @@ -28223,7 +28223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10757, ProductID = 59, @@ -28231,7 +28231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10757, ProductID = 62, @@ -28239,7 +28239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10757, ProductID = 64, @@ -28247,7 +28247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10758, ProductID = 26, @@ -28255,7 +28255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10758, ProductID = 52, @@ -28263,7 +28263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10758, ProductID = 70, @@ -28271,7 +28271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10759, ProductID = 32, @@ -28279,7 +28279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10760, ProductID = 25, @@ -28287,7 +28287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10760, ProductID = 27, @@ -28295,7 +28295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10760, ProductID = 43, @@ -28303,7 +28303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10761, ProductID = 25, @@ -28311,7 +28311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10761, ProductID = 75, @@ -28319,7 +28319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10762, ProductID = 39, @@ -28327,7 +28327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10762, ProductID = 47, @@ -28335,7 +28335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10762, ProductID = 51, @@ -28343,7 +28343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10762, ProductID = 56, @@ -28351,7 +28351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10763, ProductID = 21, @@ -28359,7 +28359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10763, ProductID = 22, @@ -28367,7 +28367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10763, ProductID = 24, @@ -28375,7 +28375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10764, ProductID = 3, @@ -28383,7 +28383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10764, ProductID = 39, @@ -28391,7 +28391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 130, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10765, ProductID = 65, @@ -28399,7 +28399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10766, ProductID = 2, @@ -28407,7 +28407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10766, ProductID = 7, @@ -28415,7 +28415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10766, ProductID = 68, @@ -28423,7 +28423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10767, ProductID = 42, @@ -28431,7 +28431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10768, ProductID = 22, @@ -28439,7 +28439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10768, ProductID = 31, @@ -28447,7 +28447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10768, ProductID = 60, @@ -28455,7 +28455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10768, ProductID = 71, @@ -28463,7 +28463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10769, ProductID = 41, @@ -28471,7 +28471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10769, ProductID = 52, @@ -28479,7 +28479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10769, ProductID = 61, @@ -28487,7 +28487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10769, ProductID = 62, @@ -28495,7 +28495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10770, ProductID = 11, @@ -28503,7 +28503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10771, ProductID = 71, @@ -28511,7 +28511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10772, ProductID = 29, @@ -28519,7 +28519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10772, ProductID = 59, @@ -28527,7 +28527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10773, ProductID = 17, @@ -28535,7 +28535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 33, Discount = 0f }, - new OrderDetail + new() { OrderID = 10773, ProductID = 31, @@ -28543,7 +28543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10773, ProductID = 75, @@ -28551,7 +28551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10774, ProductID = 31, @@ -28559,7 +28559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10774, ProductID = 66, @@ -28567,7 +28567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10775, ProductID = 10, @@ -28575,7 +28575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10775, ProductID = 67, @@ -28583,7 +28583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10776, ProductID = 31, @@ -28591,7 +28591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10776, ProductID = 42, @@ -28599,7 +28599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10776, ProductID = 45, @@ -28607,7 +28607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 27, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10776, ProductID = 51, @@ -28615,7 +28615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 120, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10777, ProductID = 42, @@ -28623,7 +28623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10778, ProductID = 41, @@ -28631,7 +28631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10779, ProductID = 16, @@ -28639,7 +28639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10779, ProductID = 62, @@ -28647,7 +28647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10780, ProductID = 70, @@ -28655,7 +28655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10780, ProductID = 77, @@ -28663,7 +28663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10781, ProductID = 54, @@ -28671,7 +28671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10781, ProductID = 56, @@ -28679,7 +28679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10781, ProductID = 74, @@ -28687,7 +28687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10782, ProductID = 31, @@ -28695,7 +28695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 10783, ProductID = 31, @@ -28703,7 +28703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10783, ProductID = 38, @@ -28711,7 +28711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10784, ProductID = 36, @@ -28719,7 +28719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10784, ProductID = 39, @@ -28727,7 +28727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10784, ProductID = 72, @@ -28735,7 +28735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10785, ProductID = 10, @@ -28743,7 +28743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10785, ProductID = 75, @@ -28751,7 +28751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10786, ProductID = 8, @@ -28759,7 +28759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10786, ProductID = 30, @@ -28767,7 +28767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10786, ProductID = 75, @@ -28775,7 +28775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10787, ProductID = 2, @@ -28783,7 +28783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10787, ProductID = 29, @@ -28791,7 +28791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10788, ProductID = 19, @@ -28799,7 +28799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10788, ProductID = 75, @@ -28807,7 +28807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10789, ProductID = 18, @@ -28815,7 +28815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10789, ProductID = 35, @@ -28823,7 +28823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10789, ProductID = 63, @@ -28831,7 +28831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10789, ProductID = 68, @@ -28839,7 +28839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10790, ProductID = 7, @@ -28847,7 +28847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10790, ProductID = 56, @@ -28855,7 +28855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10791, ProductID = 29, @@ -28863,7 +28863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10791, ProductID = 41, @@ -28871,7 +28871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10792, ProductID = 2, @@ -28879,7 +28879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10792, ProductID = 54, @@ -28887,7 +28887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10792, ProductID = 68, @@ -28895,7 +28895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10793, ProductID = 41, @@ -28903,7 +28903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10793, ProductID = 52, @@ -28911,7 +28911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10794, ProductID = 14, @@ -28919,7 +28919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10794, ProductID = 54, @@ -28927,7 +28927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10795, ProductID = 16, @@ -28935,7 +28935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 65, Discount = 0f }, - new OrderDetail + new() { OrderID = 10795, ProductID = 17, @@ -28943,7 +28943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10796, ProductID = 26, @@ -28951,7 +28951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10796, ProductID = 44, @@ -28959,7 +28959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10796, ProductID = 64, @@ -28967,7 +28967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10796, ProductID = 69, @@ -28975,7 +28975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10797, ProductID = 11, @@ -28983,7 +28983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10798, ProductID = 62, @@ -28991,7 +28991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10798, ProductID = 72, @@ -28999,7 +28999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10799, ProductID = 13, @@ -29007,7 +29007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10799, ProductID = 24, @@ -29015,7 +29015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10799, ProductID = 59, @@ -29023,7 +29023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10800, ProductID = 11, @@ -29031,7 +29031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10800, ProductID = 51, @@ -29039,7 +29039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10800, ProductID = 54, @@ -29047,7 +29047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10801, ProductID = 17, @@ -29055,7 +29055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10801, ProductID = 29, @@ -29063,7 +29063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10802, ProductID = 30, @@ -29071,7 +29071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10802, ProductID = 51, @@ -29079,7 +29079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10802, ProductID = 55, @@ -29087,7 +29087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10802, ProductID = 62, @@ -29095,7 +29095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10803, ProductID = 19, @@ -29103,7 +29103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10803, ProductID = 25, @@ -29111,7 +29111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10803, ProductID = 59, @@ -29119,7 +29119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10804, ProductID = 10, @@ -29127,7 +29127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0f }, - new OrderDetail + new() { OrderID = 10804, ProductID = 28, @@ -29135,7 +29135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10804, ProductID = 49, @@ -29143,7 +29143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10805, ProductID = 34, @@ -29151,7 +29151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10805, ProductID = 38, @@ -29159,7 +29159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10806, ProductID = 2, @@ -29167,7 +29167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10806, ProductID = 65, @@ -29175,7 +29175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10806, ProductID = 74, @@ -29183,7 +29183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10807, ProductID = 40, @@ -29191,7 +29191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 10808, ProductID = 56, @@ -29199,7 +29199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10808, ProductID = 76, @@ -29207,7 +29207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10809, ProductID = 52, @@ -29215,7 +29215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10810, ProductID = 13, @@ -29223,7 +29223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10810, ProductID = 25, @@ -29231,7 +29231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10810, ProductID = 70, @@ -29239,7 +29239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10811, ProductID = 19, @@ -29247,7 +29247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10811, ProductID = 23, @@ -29255,7 +29255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10811, ProductID = 40, @@ -29263,7 +29263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10812, ProductID = 31, @@ -29271,7 +29271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10812, ProductID = 72, @@ -29279,7 +29279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10812, ProductID = 77, @@ -29287,7 +29287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10813, ProductID = 2, @@ -29295,7 +29295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10813, ProductID = 46, @@ -29303,7 +29303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10814, ProductID = 41, @@ -29311,7 +29311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10814, ProductID = 43, @@ -29319,7 +29319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10814, ProductID = 48, @@ -29327,7 +29327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10814, ProductID = 61, @@ -29335,7 +29335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10815, ProductID = 33, @@ -29343,7 +29343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10816, ProductID = 38, @@ -29351,7 +29351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10816, ProductID = 62, @@ -29359,7 +29359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10817, ProductID = 26, @@ -29367,7 +29367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10817, ProductID = 38, @@ -29375,7 +29375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10817, ProductID = 40, @@ -29383,7 +29383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10817, ProductID = 62, @@ -29391,7 +29391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10818, ProductID = 32, @@ -29399,7 +29399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10818, ProductID = 41, @@ -29407,7 +29407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10819, ProductID = 43, @@ -29415,7 +29415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10819, ProductID = 75, @@ -29423,7 +29423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10820, ProductID = 56, @@ -29431,7 +29431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10821, ProductID = 35, @@ -29439,7 +29439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10821, ProductID = 51, @@ -29447,7 +29447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10822, ProductID = 62, @@ -29455,7 +29455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10822, ProductID = 70, @@ -29463,7 +29463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10823, ProductID = 11, @@ -29471,7 +29471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10823, ProductID = 57, @@ -29479,7 +29479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10823, ProductID = 59, @@ -29487,7 +29487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10823, ProductID = 77, @@ -29495,7 +29495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10824, ProductID = 41, @@ -29503,7 +29503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10824, ProductID = 70, @@ -29511,7 +29511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10825, ProductID = 26, @@ -29519,7 +29519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10825, ProductID = 53, @@ -29527,7 +29527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10826, ProductID = 31, @@ -29535,7 +29535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10826, ProductID = 57, @@ -29543,7 +29543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10827, ProductID = 10, @@ -29551,7 +29551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10827, ProductID = 39, @@ -29559,7 +29559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10828, ProductID = 20, @@ -29567,7 +29567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10828, ProductID = 38, @@ -29575,7 +29575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10829, ProductID = 2, @@ -29583,7 +29583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10829, ProductID = 8, @@ -29591,7 +29591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10829, ProductID = 13, @@ -29599,7 +29599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10829, ProductID = 60, @@ -29607,7 +29607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10830, ProductID = 6, @@ -29615,7 +29615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10830, ProductID = 39, @@ -29623,7 +29623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10830, ProductID = 60, @@ -29631,7 +29631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10830, ProductID = 68, @@ -29639,7 +29639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10831, ProductID = 19, @@ -29647,7 +29647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10831, ProductID = 35, @@ -29655,7 +29655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10831, ProductID = 38, @@ -29663,7 +29663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10831, ProductID = 43, @@ -29671,7 +29671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10832, ProductID = 13, @@ -29679,7 +29679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10832, ProductID = 25, @@ -29687,7 +29687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10832, ProductID = 44, @@ -29695,7 +29695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10832, ProductID = 64, @@ -29703,7 +29703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10833, ProductID = 7, @@ -29711,7 +29711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10833, ProductID = 31, @@ -29719,7 +29719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10833, ProductID = 53, @@ -29727,7 +29727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10834, ProductID = 29, @@ -29735,7 +29735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10834, ProductID = 30, @@ -29743,7 +29743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10835, ProductID = 59, @@ -29751,7 +29751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10835, ProductID = 77, @@ -29759,7 +29759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10836, ProductID = 22, @@ -29767,7 +29767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 52, Discount = 0f }, - new OrderDetail + new() { OrderID = 10836, ProductID = 35, @@ -29775,7 +29775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10836, ProductID = 57, @@ -29783,7 +29783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10836, ProductID = 60, @@ -29791,7 +29791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10836, ProductID = 64, @@ -29799,7 +29799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10837, ProductID = 13, @@ -29807,7 +29807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10837, ProductID = 40, @@ -29815,7 +29815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10837, ProductID = 47, @@ -29823,7 +29823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10837, ProductID = 76, @@ -29831,7 +29831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10838, ProductID = 1, @@ -29839,7 +29839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10838, ProductID = 18, @@ -29847,7 +29847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10838, ProductID = 36, @@ -29855,7 +29855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10839, ProductID = 58, @@ -29863,7 +29863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10839, ProductID = 72, @@ -29871,7 +29871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10840, ProductID = 25, @@ -29879,7 +29879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10840, ProductID = 39, @@ -29887,7 +29887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10841, ProductID = 10, @@ -29895,7 +29895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10841, ProductID = 56, @@ -29903,7 +29903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10841, ProductID = 59, @@ -29911,7 +29911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10841, ProductID = 77, @@ -29919,7 +29919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10842, ProductID = 11, @@ -29927,7 +29927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10842, ProductID = 43, @@ -29935,7 +29935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10842, ProductID = 68, @@ -29943,7 +29943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10842, ProductID = 70, @@ -29951,7 +29951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10843, ProductID = 51, @@ -29959,7 +29959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10844, ProductID = 22, @@ -29967,7 +29967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10845, ProductID = 23, @@ -29975,7 +29975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10845, ProductID = 35, @@ -29983,7 +29983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10845, ProductID = 42, @@ -29991,7 +29991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10845, ProductID = 58, @@ -29999,7 +29999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10845, ProductID = 64, @@ -30007,7 +30007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 48, Discount = 0f }, - new OrderDetail + new() { OrderID = 10846, ProductID = 4, @@ -30015,7 +30015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10846, ProductID = 70, @@ -30023,7 +30023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10846, ProductID = 74, @@ -30031,7 +30031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10847, ProductID = 1, @@ -30039,7 +30039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10847, ProductID = 19, @@ -30047,7 +30047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10847, ProductID = 37, @@ -30055,7 +30055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10847, ProductID = 45, @@ -30063,7 +30063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10847, ProductID = 60, @@ -30071,7 +30071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10847, ProductID = 71, @@ -30079,7 +30079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 55, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10848, ProductID = 5, @@ -30087,7 +30087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10848, ProductID = 9, @@ -30095,7 +30095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10849, ProductID = 3, @@ -30103,7 +30103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 49, Discount = 0f }, - new OrderDetail + new() { OrderID = 10849, ProductID = 26, @@ -30111,7 +30111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10850, ProductID = 25, @@ -30119,7 +30119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10850, ProductID = 33, @@ -30127,7 +30127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10850, ProductID = 70, @@ -30135,7 +30135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10851, ProductID = 2, @@ -30143,7 +30143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10851, ProductID = 25, @@ -30151,7 +30151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10851, ProductID = 57, @@ -30159,7 +30159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10851, ProductID = 59, @@ -30167,7 +30167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10852, ProductID = 2, @@ -30175,7 +30175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10852, ProductID = 17, @@ -30183,7 +30183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10852, ProductID = 62, @@ -30191,7 +30191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10853, ProductID = 18, @@ -30199,7 +30199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10854, ProductID = 10, @@ -30207,7 +30207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 100, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10854, ProductID = 13, @@ -30215,7 +30215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 65, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10855, ProductID = 16, @@ -30223,7 +30223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10855, ProductID = 31, @@ -30231,7 +30231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10855, ProductID = 56, @@ -30239,7 +30239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10855, ProductID = 65, @@ -30247,7 +30247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10856, ProductID = 2, @@ -30255,7 +30255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10856, ProductID = 42, @@ -30263,7 +30263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10857, ProductID = 3, @@ -30271,7 +30271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10857, ProductID = 26, @@ -30279,7 +30279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10857, ProductID = 29, @@ -30287,7 +30287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10858, ProductID = 7, @@ -30295,7 +30295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10858, ProductID = 27, @@ -30303,7 +30303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10858, ProductID = 70, @@ -30311,7 +30311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10859, ProductID = 24, @@ -30319,7 +30319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10859, ProductID = 54, @@ -30327,7 +30327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10859, ProductID = 64, @@ -30335,7 +30335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10860, ProductID = 51, @@ -30343,7 +30343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10860, ProductID = 76, @@ -30351,7 +30351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10861, ProductID = 17, @@ -30359,7 +30359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0f }, - new OrderDetail + new() { OrderID = 10861, ProductID = 18, @@ -30367,7 +30367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10861, ProductID = 21, @@ -30375,7 +30375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10861, ProductID = 33, @@ -30383,7 +30383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10861, ProductID = 62, @@ -30391,7 +30391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10862, ProductID = 11, @@ -30399,7 +30399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10862, ProductID = 52, @@ -30407,7 +30407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10863, ProductID = 1, @@ -30415,7 +30415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10863, ProductID = 58, @@ -30423,7 +30423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10864, ProductID = 35, @@ -30431,7 +30431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10864, ProductID = 67, @@ -30439,7 +30439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10865, ProductID = 38, @@ -30447,7 +30447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10865, ProductID = 39, @@ -30455,7 +30455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10866, ProductID = 2, @@ -30463,7 +30463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10866, ProductID = 24, @@ -30471,7 +30471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10866, ProductID = 30, @@ -30479,7 +30479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10867, ProductID = 53, @@ -30487,7 +30487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10868, ProductID = 26, @@ -30495,7 +30495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10868, ProductID = 35, @@ -30503,7 +30503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10868, ProductID = 49, @@ -30511,7 +30511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10869, ProductID = 1, @@ -30519,7 +30519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10869, ProductID = 11, @@ -30527,7 +30527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10869, ProductID = 23, @@ -30535,7 +30535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10869, ProductID = 68, @@ -30543,7 +30543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10870, ProductID = 35, @@ -30551,7 +30551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10870, ProductID = 51, @@ -30559,7 +30559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10871, ProductID = 6, @@ -30567,7 +30567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10871, ProductID = 16, @@ -30575,7 +30575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10871, ProductID = 17, @@ -30583,7 +30583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10872, ProductID = 55, @@ -30591,7 +30591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10872, ProductID = 62, @@ -30599,7 +30599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10872, ProductID = 64, @@ -30607,7 +30607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10872, ProductID = 65, @@ -30615,7 +30615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10873, ProductID = 21, @@ -30623,7 +30623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10873, ProductID = 28, @@ -30631,7 +30631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 10874, ProductID = 10, @@ -30639,7 +30639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10875, ProductID = 19, @@ -30647,7 +30647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10875, ProductID = 47, @@ -30655,7 +30655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10875, ProductID = 49, @@ -30663,7 +30663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10876, ProductID = 46, @@ -30671,7 +30671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10876, ProductID = 64, @@ -30679,7 +30679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10877, ProductID = 16, @@ -30687,7 +30687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10877, ProductID = 18, @@ -30695,7 +30695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10878, ProductID = 20, @@ -30703,7 +30703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10879, ProductID = 40, @@ -30711,7 +30711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10879, ProductID = 65, @@ -30719,7 +30719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10879, ProductID = 76, @@ -30727,7 +30727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10880, ProductID = 23, @@ -30735,7 +30735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10880, ProductID = 61, @@ -30743,7 +30743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10880, ProductID = 70, @@ -30751,7 +30751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10881, ProductID = 73, @@ -30759,7 +30759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10882, ProductID = 42, @@ -30767,7 +30767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10882, ProductID = 49, @@ -30775,7 +30775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10882, ProductID = 54, @@ -30783,7 +30783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 32, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10883, ProductID = 24, @@ -30791,7 +30791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10884, ProductID = 21, @@ -30799,7 +30799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10884, ProductID = 56, @@ -30807,7 +30807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10884, ProductID = 65, @@ -30815,7 +30815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10885, ProductID = 2, @@ -30823,7 +30823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10885, ProductID = 24, @@ -30831,7 +30831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10885, ProductID = 70, @@ -30839,7 +30839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10885, ProductID = 77, @@ -30847,7 +30847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10886, ProductID = 10, @@ -30855,7 +30855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0f }, - new OrderDetail + new() { OrderID = 10886, ProductID = 31, @@ -30863,7 +30863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10886, ProductID = 77, @@ -30871,7 +30871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10887, ProductID = 25, @@ -30879,7 +30879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10888, ProductID = 2, @@ -30887,7 +30887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10888, ProductID = 68, @@ -30895,7 +30895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10889, ProductID = 11, @@ -30903,7 +30903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10889, ProductID = 38, @@ -30911,7 +30911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10890, ProductID = 17, @@ -30919,7 +30919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10890, ProductID = 34, @@ -30927,7 +30927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10890, ProductID = 41, @@ -30935,7 +30935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10891, ProductID = 30, @@ -30943,7 +30943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10892, ProductID = 59, @@ -30951,7 +30951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10893, ProductID = 8, @@ -30959,7 +30959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10893, ProductID = 24, @@ -30967,7 +30967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10893, ProductID = 29, @@ -30975,7 +30975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10893, ProductID = 30, @@ -30983,7 +30983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10893, ProductID = 36, @@ -30991,7 +30991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10894, ProductID = 13, @@ -30999,7 +30999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10894, ProductID = 69, @@ -31007,7 +31007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10894, ProductID = 75, @@ -31015,7 +31015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 120, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10895, ProductID = 24, @@ -31023,7 +31023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 110, Discount = 0f }, - new OrderDetail + new() { OrderID = 10895, ProductID = 39, @@ -31031,7 +31031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0f }, - new OrderDetail + new() { OrderID = 10895, ProductID = 40, @@ -31039,7 +31039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 91, Discount = 0f }, - new OrderDetail + new() { OrderID = 10895, ProductID = 60, @@ -31047,7 +31047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 100, Discount = 0f }, - new OrderDetail + new() { OrderID = 10896, ProductID = 45, @@ -31055,7 +31055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10896, ProductID = 56, @@ -31063,7 +31063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10897, ProductID = 29, @@ -31071,7 +31071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0f }, - new OrderDetail + new() { OrderID = 10897, ProductID = 30, @@ -31079,7 +31079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0f }, - new OrderDetail + new() { OrderID = 10898, ProductID = 13, @@ -31087,7 +31087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10899, ProductID = 39, @@ -31095,7 +31095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10900, ProductID = 70, @@ -31103,7 +31103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10901, ProductID = 41, @@ -31111,7 +31111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10901, ProductID = 71, @@ -31119,7 +31119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10902, ProductID = 55, @@ -31127,7 +31127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10902, ProductID = 62, @@ -31135,7 +31135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10903, ProductID = 13, @@ -31143,7 +31143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10903, ProductID = 65, @@ -31151,7 +31151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10903, ProductID = 68, @@ -31159,7 +31159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10904, ProductID = 58, @@ -31167,7 +31167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10904, ProductID = 62, @@ -31175,7 +31175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10905, ProductID = 1, @@ -31183,7 +31183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10906, ProductID = 61, @@ -31191,7 +31191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10907, ProductID = 75, @@ -31199,7 +31199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10908, ProductID = 7, @@ -31207,7 +31207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10908, ProductID = 52, @@ -31215,7 +31215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10909, ProductID = 7, @@ -31223,7 +31223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10909, ProductID = 16, @@ -31231,7 +31231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10909, ProductID = 41, @@ -31239,7 +31239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10910, ProductID = 19, @@ -31247,7 +31247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10910, ProductID = 49, @@ -31255,7 +31255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10910, ProductID = 61, @@ -31263,7 +31263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10911, ProductID = 1, @@ -31271,7 +31271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10911, ProductID = 17, @@ -31279,7 +31279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10911, ProductID = 67, @@ -31287,7 +31287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10912, ProductID = 11, @@ -31295,7 +31295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10912, ProductID = 29, @@ -31303,7 +31303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10913, ProductID = 4, @@ -31311,7 +31311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10913, ProductID = 33, @@ -31319,7 +31319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10913, ProductID = 58, @@ -31327,7 +31327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10914, ProductID = 71, @@ -31335,7 +31335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10915, ProductID = 17, @@ -31343,7 +31343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10915, ProductID = 33, @@ -31351,7 +31351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10915, ProductID = 54, @@ -31359,7 +31359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10916, ProductID = 16, @@ -31367,7 +31367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10916, ProductID = 32, @@ -31375,7 +31375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10916, ProductID = 57, @@ -31383,7 +31383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10917, ProductID = 30, @@ -31391,7 +31391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 10917, ProductID = 60, @@ -31399,7 +31399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10918, ProductID = 1, @@ -31407,7 +31407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10918, ProductID = 60, @@ -31415,7 +31415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10919, ProductID = 16, @@ -31423,7 +31423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10919, ProductID = 25, @@ -31431,7 +31431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10919, ProductID = 40, @@ -31439,7 +31439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10920, ProductID = 50, @@ -31447,7 +31447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10921, ProductID = 35, @@ -31455,7 +31455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10921, ProductID = 63, @@ -31463,7 +31463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10922, ProductID = 17, @@ -31471,7 +31471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10922, ProductID = 24, @@ -31479,7 +31479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10923, ProductID = 42, @@ -31487,7 +31487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10923, ProductID = 43, @@ -31495,7 +31495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10923, ProductID = 67, @@ -31503,7 +31503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10924, ProductID = 10, @@ -31511,7 +31511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10924, ProductID = 28, @@ -31519,7 +31519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10924, ProductID = 75, @@ -31527,7 +31527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10925, ProductID = 36, @@ -31535,7 +31535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10925, ProductID = 52, @@ -31543,7 +31543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10926, ProductID = 11, @@ -31551,7 +31551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10926, ProductID = 13, @@ -31559,7 +31559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10926, ProductID = 19, @@ -31567,7 +31567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10926, ProductID = 72, @@ -31575,7 +31575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10927, ProductID = 20, @@ -31583,7 +31583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10927, ProductID = 52, @@ -31591,7 +31591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10927, ProductID = 76, @@ -31599,7 +31599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10928, ProductID = 47, @@ -31607,7 +31607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10928, ProductID = 76, @@ -31615,7 +31615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10929, ProductID = 21, @@ -31623,7 +31623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10929, ProductID = 75, @@ -31631,7 +31631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 49, Discount = 0f }, - new OrderDetail + new() { OrderID = 10929, ProductID = 77, @@ -31639,7 +31639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10930, ProductID = 21, @@ -31647,7 +31647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0f }, - new OrderDetail + new() { OrderID = 10930, ProductID = 27, @@ -31655,7 +31655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10930, ProductID = 55, @@ -31663,7 +31663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10930, ProductID = 58, @@ -31671,7 +31671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10931, ProductID = 13, @@ -31679,7 +31679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10931, ProductID = 57, @@ -31687,7 +31687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10932, ProductID = 16, @@ -31695,7 +31695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10932, ProductID = 62, @@ -31703,7 +31703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10932, ProductID = 72, @@ -31711,7 +31711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10932, ProductID = 75, @@ -31719,7 +31719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10933, ProductID = 53, @@ -31727,7 +31727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10933, ProductID = 61, @@ -31735,7 +31735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10934, ProductID = 6, @@ -31743,7 +31743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10935, ProductID = 1, @@ -31751,7 +31751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10935, ProductID = 18, @@ -31759,7 +31759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10935, ProductID = 23, @@ -31767,7 +31767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10936, ProductID = 36, @@ -31775,7 +31775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10937, ProductID = 28, @@ -31783,7 +31783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10937, ProductID = 34, @@ -31791,7 +31791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10938, ProductID = 13, @@ -31799,7 +31799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10938, ProductID = 43, @@ -31807,7 +31807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10938, ProductID = 60, @@ -31815,7 +31815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 49, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10938, ProductID = 71, @@ -31823,7 +31823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10939, ProductID = 2, @@ -31831,7 +31831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10939, ProductID = 67, @@ -31839,7 +31839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10940, ProductID = 7, @@ -31847,7 +31847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10940, ProductID = 13, @@ -31855,7 +31855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10941, ProductID = 31, @@ -31863,7 +31863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 44, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10941, ProductID = 62, @@ -31871,7 +31871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10941, ProductID = 68, @@ -31879,7 +31879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10941, ProductID = 72, @@ -31887,7 +31887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10942, ProductID = 49, @@ -31895,7 +31895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 10943, ProductID = 13, @@ -31903,7 +31903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10943, ProductID = 22, @@ -31911,7 +31911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 10943, ProductID = 46, @@ -31919,7 +31919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10944, ProductID = 11, @@ -31927,7 +31927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10944, ProductID = 44, @@ -31935,7 +31935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10944, ProductID = 56, @@ -31943,7 +31943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10945, ProductID = 13, @@ -31951,7 +31951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10945, ProductID = 31, @@ -31959,7 +31959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10946, ProductID = 10, @@ -31967,7 +31967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10946, ProductID = 24, @@ -31975,7 +31975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 10946, ProductID = 77, @@ -31983,7 +31983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10947, ProductID = 59, @@ -31991,7 +31991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10948, ProductID = 50, @@ -31999,7 +31999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10948, ProductID = 51, @@ -32007,7 +32007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10948, ProductID = 55, @@ -32015,7 +32015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10949, ProductID = 6, @@ -32023,7 +32023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10949, ProductID = 10, @@ -32031,7 +32031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10949, ProductID = 17, @@ -32039,7 +32039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10949, ProductID = 62, @@ -32047,7 +32047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10950, ProductID = 4, @@ -32055,7 +32055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10951, ProductID = 33, @@ -32063,7 +32063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10951, ProductID = 41, @@ -32071,7 +32071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10951, ProductID = 75, @@ -32079,7 +32079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10952, ProductID = 6, @@ -32087,7 +32087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10952, ProductID = 28, @@ -32095,7 +32095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10953, ProductID = 20, @@ -32103,7 +32103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10953, ProductID = 31, @@ -32111,7 +32111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10954, ProductID = 16, @@ -32119,7 +32119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10954, ProductID = 31, @@ -32127,7 +32127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10954, ProductID = 45, @@ -32135,7 +32135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10954, ProductID = 60, @@ -32143,7 +32143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10955, ProductID = 75, @@ -32151,7 +32151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10956, ProductID = 21, @@ -32159,7 +32159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10956, ProductID = 47, @@ -32167,7 +32167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10956, ProductID = 51, @@ -32175,7 +32175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10957, ProductID = 30, @@ -32183,7 +32183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10957, ProductID = 35, @@ -32191,7 +32191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10957, ProductID = 64, @@ -32199,7 +32199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10958, ProductID = 5, @@ -32207,7 +32207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10958, ProductID = 7, @@ -32215,7 +32215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10958, ProductID = 72, @@ -32223,7 +32223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10959, ProductID = 75, @@ -32231,7 +32231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10960, ProductID = 24, @@ -32239,7 +32239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10960, ProductID = 41, @@ -32247,7 +32247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10961, ProductID = 52, @@ -32255,7 +32255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10961, ProductID = 76, @@ -32263,7 +32263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10962, ProductID = 7, @@ -32271,7 +32271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0f }, - new OrderDetail + new() { OrderID = 10962, ProductID = 13, @@ -32279,7 +32279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 77, Discount = 0f }, - new OrderDetail + new() { OrderID = 10962, ProductID = 53, @@ -32287,7 +32287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10962, ProductID = 69, @@ -32295,7 +32295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10962, ProductID = 76, @@ -32303,7 +32303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 44, Discount = 0f }, - new OrderDetail + new() { OrderID = 10963, ProductID = 60, @@ -32311,7 +32311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10964, ProductID = 18, @@ -32319,7 +32319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10964, ProductID = 38, @@ -32327,7 +32327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10964, ProductID = 69, @@ -32335,7 +32335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10965, ProductID = 51, @@ -32343,7 +32343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10966, ProductID = 37, @@ -32351,7 +32351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 10966, ProductID = 56, @@ -32359,7 +32359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10966, ProductID = 62, @@ -32367,7 +32367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10967, ProductID = 19, @@ -32375,7 +32375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10967, ProductID = 49, @@ -32383,7 +32383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10968, ProductID = 12, @@ -32391,7 +32391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10968, ProductID = 24, @@ -32399,7 +32399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10968, ProductID = 64, @@ -32407,7 +32407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10969, ProductID = 46, @@ -32415,7 +32415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10970, ProductID = 52, @@ -32423,7 +32423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10971, ProductID = 29, @@ -32431,7 +32431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 10972, ProductID = 17, @@ -32439,7 +32439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10972, ProductID = 33, @@ -32447,7 +32447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10973, ProductID = 26, @@ -32455,7 +32455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 10973, ProductID = 41, @@ -32463,7 +32463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10973, ProductID = 75, @@ -32471,7 +32471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10974, ProductID = 63, @@ -32479,7 +32479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10975, ProductID = 8, @@ -32487,7 +32487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 10975, ProductID = 75, @@ -32495,7 +32495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10976, ProductID = 28, @@ -32503,7 +32503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10977, ProductID = 39, @@ -32511,7 +32511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10977, ProductID = 47, @@ -32519,7 +32519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10977, ProductID = 51, @@ -32527,7 +32527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10977, ProductID = 63, @@ -32535,7 +32535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10978, ProductID = 8, @@ -32543,7 +32543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10978, ProductID = 21, @@ -32551,7 +32551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10978, ProductID = 40, @@ -32559,7 +32559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10978, ProductID = 44, @@ -32567,7 +32567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10979, ProductID = 7, @@ -32575,7 +32575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 10979, ProductID = 12, @@ -32583,7 +32583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10979, ProductID = 24, @@ -32591,7 +32591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0f }, - new OrderDetail + new() { OrderID = 10979, ProductID = 27, @@ -32599,7 +32599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10979, ProductID = 31, @@ -32607,7 +32607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 10979, ProductID = 63, @@ -32615,7 +32615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 10980, ProductID = 75, @@ -32623,7 +32623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10981, ProductID = 38, @@ -32631,7 +32631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10982, ProductID = 7, @@ -32639,7 +32639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10982, ProductID = 43, @@ -32647,7 +32647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 10983, ProductID = 13, @@ -32655,7 +32655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 84, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10983, ProductID = 57, @@ -32663,7 +32663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10984, ProductID = 16, @@ -32671,7 +32671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 55, Discount = 0f }, - new OrderDetail + new() { OrderID = 10984, ProductID = 24, @@ -32679,7 +32679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10984, ProductID = 36, @@ -32687,7 +32687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10985, ProductID = 16, @@ -32695,7 +32695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10985, ProductID = 18, @@ -32703,7 +32703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10985, ProductID = 32, @@ -32711,7 +32711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10986, ProductID = 11, @@ -32719,7 +32719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10986, ProductID = 20, @@ -32727,7 +32727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10986, ProductID = 76, @@ -32735,7 +32735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 10986, ProductID = 77, @@ -32743,7 +32743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10987, ProductID = 7, @@ -32751,7 +32751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10987, ProductID = 43, @@ -32759,7 +32759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 10987, ProductID = 72, @@ -32767,7 +32767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10988, ProductID = 7, @@ -32775,7 +32775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 10988, ProductID = 62, @@ -32783,7 +32783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 10989, ProductID = 6, @@ -32791,7 +32791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10989, ProductID = 11, @@ -32799,7 +32799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 10989, ProductID = 41, @@ -32807,7 +32807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10990, ProductID = 21, @@ -32815,7 +32815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 65, Discount = 0f }, - new OrderDetail + new() { OrderID = 10990, ProductID = 34, @@ -32823,7 +32823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10990, ProductID = 55, @@ -32831,7 +32831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 65, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10990, ProductID = 61, @@ -32839,7 +32839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 66, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 10991, ProductID = 2, @@ -32847,7 +32847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10991, ProductID = 70, @@ -32855,7 +32855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10991, ProductID = 76, @@ -32863,7 +32863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 90, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 10992, ProductID = 72, @@ -32871,7 +32871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 10993, ProductID = 29, @@ -32879,7 +32879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10993, ProductID = 41, @@ -32887,7 +32887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10994, ProductID = 59, @@ -32895,7 +32895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10995, ProductID = 51, @@ -32903,7 +32903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10995, ProductID = 60, @@ -32911,7 +32911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 10996, ProductID = 42, @@ -32919,7 +32919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 10997, ProductID = 32, @@ -32927,7 +32927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 10997, ProductID = 46, @@ -32935,7 +32935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10997, ProductID = 52, @@ -32943,7 +32943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 10998, ProductID = 24, @@ -32951,7 +32951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 10998, ProductID = 61, @@ -32959,7 +32959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 10998, ProductID = 74, @@ -32967,7 +32967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 10998, ProductID = 75, @@ -32975,7 +32975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 10999, ProductID = 41, @@ -32983,7 +32983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10999, ProductID = 51, @@ -32991,7 +32991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 10999, ProductID = 77, @@ -32999,7 +32999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11000, ProductID = 4, @@ -33007,7 +33007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11000, ProductID = 24, @@ -33015,7 +33015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11000, ProductID = 77, @@ -33023,7 +33023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11001, ProductID = 7, @@ -33031,7 +33031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 11001, ProductID = 22, @@ -33039,7 +33039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 11001, ProductID = 46, @@ -33047,7 +33047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 11001, ProductID = 55, @@ -33055,7 +33055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 11002, ProductID = 13, @@ -33063,7 +33063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 56, Discount = 0f }, - new OrderDetail + new() { OrderID = 11002, ProductID = 35, @@ -33071,7 +33071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11002, ProductID = 42, @@ -33079,7 +33079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11002, ProductID = 55, @@ -33087,7 +33087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 11003, ProductID = 1, @@ -33095,7 +33095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 11003, ProductID = 40, @@ -33103,7 +33103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11003, ProductID = 52, @@ -33111,7 +33111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11004, ProductID = 26, @@ -33119,7 +33119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 11004, ProductID = 76, @@ -33127,7 +33127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 11005, ProductID = 1, @@ -33135,7 +33135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 11005, ProductID = 59, @@ -33143,7 +33143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11006, ProductID = 1, @@ -33151,7 +33151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 11006, ProductID = 29, @@ -33159,7 +33159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11007, ProductID = 8, @@ -33167,7 +33167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11007, ProductID = 29, @@ -33175,7 +33175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11007, ProductID = 42, @@ -33183,7 +33183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0f }, - new OrderDetail + new() { OrderID = 11008, ProductID = 28, @@ -33191,7 +33191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11008, ProductID = 34, @@ -33199,7 +33199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 90, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11008, ProductID = 71, @@ -33207,7 +33207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 11009, ProductID = 24, @@ -33215,7 +33215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 11009, ProductID = 36, @@ -33223,7 +33223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11009, ProductID = 60, @@ -33231,7 +33231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 11010, ProductID = 7, @@ -33239,7 +33239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11010, ProductID = 24, @@ -33247,7 +33247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11011, ProductID = 58, @@ -33255,7 +33255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11011, ProductID = 71, @@ -33263,7 +33263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11012, ProductID = 19, @@ -33271,7 +33271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11012, ProductID = 60, @@ -33279,7 +33279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11012, ProductID = 71, @@ -33287,7 +33287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11013, ProductID = 23, @@ -33295,7 +33295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11013, ProductID = 42, @@ -33303,7 +33303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 11013, ProductID = 45, @@ -33311,7 +33311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11013, ProductID = 68, @@ -33319,7 +33319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 11014, ProductID = 41, @@ -33327,7 +33327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11015, ProductID = 30, @@ -33335,7 +33335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 11015, ProductID = 77, @@ -33343,7 +33343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0f }, - new OrderDetail + new() { OrderID = 11016, ProductID = 31, @@ -33351,7 +33351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 11016, ProductID = 36, @@ -33359,7 +33359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 11017, ProductID = 3, @@ -33367,7 +33367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 11017, ProductID = 59, @@ -33375,7 +33375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 110, Discount = 0f }, - new OrderDetail + new() { OrderID = 11017, ProductID = 70, @@ -33383,7 +33383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11018, ProductID = 12, @@ -33391,7 +33391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11018, ProductID = 18, @@ -33399,7 +33399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11018, ProductID = 56, @@ -33407,7 +33407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0f }, - new OrderDetail + new() { OrderID = 11019, ProductID = 46, @@ -33415,7 +33415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 11019, ProductID = 49, @@ -33423,7 +33423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 11020, ProductID = 10, @@ -33431,7 +33431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11021, ProductID = 2, @@ -33439,7 +33439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 11, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11021, ProductID = 20, @@ -33447,7 +33447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 11021, ProductID = 26, @@ -33455,7 +33455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 63, Discount = 0f }, - new OrderDetail + new() { OrderID = 11021, ProductID = 51, @@ -33463,7 +33463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 44, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11021, ProductID = 72, @@ -33471,7 +33471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 11022, ProductID = 19, @@ -33479,7 +33479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 11022, ProductID = 69, @@ -33487,7 +33487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11023, ProductID = 7, @@ -33495,7 +33495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 11023, ProductID = 43, @@ -33503,7 +33503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11024, ProductID = 26, @@ -33511,7 +33511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 11024, ProductID = 33, @@ -33519,7 +33519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11024, ProductID = 65, @@ -33527,7 +33527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 11024, ProductID = 71, @@ -33535,7 +33535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 11025, ProductID = 1, @@ -33543,7 +33543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11025, ProductID = 13, @@ -33551,7 +33551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11026, ProductID = 18, @@ -33559,7 +33559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 11026, ProductID = 51, @@ -33567,7 +33567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11027, ProductID = 24, @@ -33575,7 +33575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11027, ProductID = 62, @@ -33583,7 +33583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11028, ProductID = 55, @@ -33591,7 +33591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 11028, ProductID = 59, @@ -33599,7 +33599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 11029, ProductID = 56, @@ -33607,7 +33607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11029, ProductID = 63, @@ -33615,7 +33615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 11030, ProductID = 2, @@ -33623,7 +33623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 100, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11030, ProductID = 5, @@ -33631,7 +33631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0f }, - new OrderDetail + new() { OrderID = 11030, ProductID = 29, @@ -33639,7 +33639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11030, ProductID = 59, @@ -33647,7 +33647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 100, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11031, ProductID = 1, @@ -33655,7 +33655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 45, Discount = 0f }, - new OrderDetail + new() { OrderID = 11031, ProductID = 13, @@ -33663,7 +33663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 80, Discount = 0f }, - new OrderDetail + new() { OrderID = 11031, ProductID = 24, @@ -33671,7 +33671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 11031, ProductID = 64, @@ -33679,7 +33679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11031, ProductID = 71, @@ -33687,7 +33687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 16, Discount = 0f }, - new OrderDetail + new() { OrderID = 11032, ProductID = 36, @@ -33695,7 +33695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 11032, ProductID = 38, @@ -33703,7 +33703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0f }, - new OrderDetail + new() { OrderID = 11032, ProductID = 59, @@ -33711,7 +33711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11033, ProductID = 53, @@ -33719,7 +33719,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 70, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11033, ProductID = 69, @@ -33727,7 +33727,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11034, ProductID = 21, @@ -33735,7 +33735,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11034, ProductID = 44, @@ -33743,7 +33743,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 11034, ProductID = 61, @@ -33751,7 +33751,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 6, Discount = 0f }, - new OrderDetail + new() { OrderID = 11035, ProductID = 1, @@ -33759,7 +33759,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11035, ProductID = 35, @@ -33767,7 +33767,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 11035, ProductID = 42, @@ -33775,7 +33775,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11035, ProductID = 54, @@ -33783,7 +33783,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11036, ProductID = 13, @@ -33791,7 +33791,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 7, Discount = 0f }, - new OrderDetail + new() { OrderID = 11036, ProductID = 59, @@ -33799,7 +33799,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11037, ProductID = 70, @@ -33807,7 +33807,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 11038, ProductID = 40, @@ -33815,7 +33815,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 5, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11038, ProductID = 52, @@ -33823,7 +33823,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 11038, ProductID = 71, @@ -33831,7 +33831,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11039, ProductID = 28, @@ -33839,7 +33839,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11039, ProductID = 35, @@ -33847,7 +33847,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 11039, ProductID = 49, @@ -33855,7 +33855,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 60, Discount = 0f }, - new OrderDetail + new() { OrderID = 11039, ProductID = 57, @@ -33863,7 +33863,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0f }, - new OrderDetail + new() { OrderID = 11040, ProductID = 21, @@ -33871,7 +33871,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11041, ProductID = 2, @@ -33879,7 +33879,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11041, ProductID = 63, @@ -33887,7 +33887,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11042, ProductID = 44, @@ -33895,7 +33895,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 11042, ProductID = 61, @@ -33903,7 +33903,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 11043, ProductID = 11, @@ -33911,7 +33911,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11044, ProductID = 62, @@ -33919,7 +33919,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 11045, ProductID = 33, @@ -33927,7 +33927,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 11045, ProductID = 51, @@ -33935,7 +33935,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0f }, - new OrderDetail + new() { OrderID = 11046, ProductID = 12, @@ -33943,7 +33943,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11046, ProductID = 32, @@ -33951,7 +33951,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11046, ProductID = 35, @@ -33959,7 +33959,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 18, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11047, ProductID = 1, @@ -33967,7 +33967,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11047, ProductID = 5, @@ -33975,7 +33975,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11048, ProductID = 68, @@ -33983,7 +33983,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0f }, - new OrderDetail + new() { OrderID = 11049, ProductID = 2, @@ -33991,7 +33991,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11049, ProductID = 12, @@ -33999,7 +33999,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11050, ProductID = 76, @@ -34007,7 +34007,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11051, ProductID = 24, @@ -34015,7 +34015,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11052, ProductID = 43, @@ -34023,7 +34023,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11052, ProductID = 61, @@ -34031,7 +34031,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11053, ProductID = 18, @@ -34039,7 +34039,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11053, ProductID = 32, @@ -34047,7 +34047,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11053, ProductID = 64, @@ -34055,7 +34055,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11054, ProductID = 33, @@ -34063,7 +34063,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11054, ProductID = 67, @@ -34071,7 +34071,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11055, ProductID = 24, @@ -34079,7 +34079,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 11055, ProductID = 25, @@ -34087,7 +34087,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 11055, ProductID = 51, @@ -34095,7 +34095,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11055, ProductID = 57, @@ -34103,7 +34103,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11056, ProductID = 7, @@ -34111,7 +34111,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 11056, ProductID = 55, @@ -34119,7 +34119,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 11056, ProductID = 60, @@ -34127,7 +34127,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 50, Discount = 0f }, - new OrderDetail + new() { OrderID = 11057, ProductID = 70, @@ -34135,7 +34135,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 11058, ProductID = 21, @@ -34143,7 +34143,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 11058, ProductID = 60, @@ -34151,7 +34151,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 21, Discount = 0f }, - new OrderDetail + new() { OrderID = 11058, ProductID = 61, @@ -34159,7 +34159,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 11059, ProductID = 13, @@ -34167,7 +34167,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11059, ProductID = 17, @@ -34175,7 +34175,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 11059, ProductID = 60, @@ -34183,7 +34183,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 11060, ProductID = 60, @@ -34191,7 +34191,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 11060, ProductID = 77, @@ -34199,7 +34199,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11061, ProductID = 60, @@ -34207,7 +34207,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0f }, - new OrderDetail + new() { OrderID = 11062, ProductID = 53, @@ -34215,7 +34215,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11062, ProductID = 70, @@ -34223,7 +34223,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11063, ProductID = 34, @@ -34231,7 +34231,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0f }, - new OrderDetail + new() { OrderID = 11063, ProductID = 40, @@ -34239,7 +34239,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11063, ProductID = 41, @@ -34247,7 +34247,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11064, ProductID = 17, @@ -34255,7 +34255,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 77, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11064, ProductID = 41, @@ -34263,7 +34263,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 12, Discount = 0f }, - new OrderDetail + new() { OrderID = 11064, ProductID = 53, @@ -34271,7 +34271,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 25, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11064, ProductID = 55, @@ -34279,7 +34279,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11064, ProductID = 68, @@ -34287,7 +34287,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 55, Discount = 0f }, - new OrderDetail + new() { OrderID = 11065, ProductID = 30, @@ -34295,7 +34295,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11065, ProductID = 54, @@ -34303,7 +34303,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11066, ProductID = 16, @@ -34311,7 +34311,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 11066, ProductID = 19, @@ -34319,7 +34319,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 42, Discount = 0f }, - new OrderDetail + new() { OrderID = 11066, ProductID = 34, @@ -34327,7 +34327,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 35, Discount = 0f }, - new OrderDetail + new() { OrderID = 11067, ProductID = 41, @@ -34335,7 +34335,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 9, Discount = 0f }, - new OrderDetail + new() { OrderID = 11068, ProductID = 28, @@ -34343,7 +34343,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11068, ProductID = 43, @@ -34351,7 +34351,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 36, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11068, ProductID = 77, @@ -34359,7 +34359,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 28, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11069, ProductID = 39, @@ -34367,7 +34367,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11070, ProductID = 1, @@ -34375,7 +34375,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11070, ProductID = 2, @@ -34383,7 +34383,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11070, ProductID = 16, @@ -34391,7 +34391,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11070, ProductID = 31, @@ -34399,7 +34399,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11071, ProductID = 7, @@ -34407,7 +34407,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 15, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11071, ProductID = 13, @@ -34415,7 +34415,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11072, ProductID = 2, @@ -34423,7 +34423,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 8, Discount = 0f }, - new OrderDetail + new() { OrderID = 11072, ProductID = 41, @@ -34431,7 +34431,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 40, Discount = 0f }, - new OrderDetail + new() { OrderID = 11072, ProductID = 50, @@ -34439,7 +34439,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 22, Discount = 0f }, - new OrderDetail + new() { OrderID = 11072, ProductID = 64, @@ -34447,7 +34447,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 130, Discount = 0f }, - new OrderDetail + new() { OrderID = 11073, ProductID = 11, @@ -34455,7 +34455,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0f }, - new OrderDetail + new() { OrderID = 11073, ProductID = 24, @@ -34463,7 +34463,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0f }, - new OrderDetail + new() { OrderID = 11074, ProductID = 16, @@ -34471,7 +34471,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 14, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11075, ProductID = 2, @@ -34479,7 +34479,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11075, ProductID = 46, @@ -34487,7 +34487,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 30, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11075, ProductID = 76, @@ -34495,7 +34495,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.15f }, - new OrderDetail + new() { OrderID = 11076, ProductID = 6, @@ -34503,7 +34503,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11076, ProductID = 14, @@ -34511,7 +34511,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 20, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11076, ProductID = 19, @@ -34519,7 +34519,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 10, Discount = 0.25f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 2, @@ -34527,7 +34527,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 24, Discount = 0.2f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 3, @@ -34535,7 +34535,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 4, @@ -34543,7 +34543,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 6, @@ -34551,7 +34551,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0.02f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 7, @@ -34559,7 +34559,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 8, @@ -34567,7 +34567,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.1f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 10, @@ -34575,7 +34575,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 12, @@ -34583,7 +34583,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 13, @@ -34591,7 +34591,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 14, @@ -34599,7 +34599,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0.03f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 16, @@ -34607,7 +34607,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.03f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 20, @@ -34615,7 +34615,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0.04f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 23, @@ -34623,7 +34623,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 32, @@ -34631,7 +34631,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 39, @@ -34639,7 +34639,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.05f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 41, @@ -34647,7 +34647,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 46, @@ -34655,7 +34655,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 3, Discount = 0.02f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 52, @@ -34663,7 +34663,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 55, @@ -34671,7 +34671,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 60, @@ -34679,7 +34679,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.06f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 64, @@ -34687,7 +34687,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.03f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 66, @@ -34695,7 +34695,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 1, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 73, @@ -34703,7 +34703,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 2, Discount = 0.01f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 75, @@ -34711,7 +34711,7 @@ public static OrderDetail[] CreateOrderDetails() Quantity = 4, Discount = 0f }, - new OrderDetail + new() { OrderID = 11077, ProductID = 77, diff --git a/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindData.cs b/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindData.cs index f47989b2141..e1ff25ae0d2 100644 --- a/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindData.cs +++ b/test/EFCore.Specification.Tests/TestModels/Northwind/NorthwindData.cs @@ -79,7 +79,7 @@ public NorthwindData() productViews.Add( new ProductView { - CategoryName = _categoryNameMap[product.CategoryID.Value], + CategoryName = _categoryNameMap[product.CategoryID!.Value], ProductID = product.ProductID, ProductName = product.ProductName }); @@ -224,7 +224,7 @@ private static void AddEntities(NorthwindContext context) { context.Set().AddRange(CreateCustomers()); - var titleProperty = context.Model.FindEntityType(typeof(Employee)).FindProperty("Title"); + var titleProperty = context.Model.FindEntityType(typeof(Employee))!.FindProperty("Title")!; foreach (var employee in CreateEmployees()) { context.Set().Add(employee); diff --git a/test/EFCore.Specification.Tests/TestModels/Northwind/Product.cs b/test/EFCore.Specification.Tests/TestModels/Northwind/Product.cs index ddde126b672..ca0a6fe1576 100644 --- a/test/EFCore.Specification.Tests/TestModels/Northwind/Product.cs +++ b/test/EFCore.Specification.Tests/TestModels/Northwind/Product.cs @@ -20,8 +20,7 @@ public int ProductID set => _productId = value; } - [MaxLength(40)] - [Required] + [MaxLength(40), Required] public string ProductName { get; set; } public int? SupplierID { get; set; } diff --git a/test/EFCore.Specification.Tests/TestModels/Northwind/UnmappedCustomer.cs b/test/EFCore.Specification.Tests/TestModels/Northwind/UnmappedCustomer.cs index d60fcb33690..85a72eadb96 100644 --- a/test/EFCore.Specification.Tests/TestModels/Northwind/UnmappedCustomer.cs +++ b/test/EFCore.Specification.Tests/TestModels/Northwind/UnmappedCustomer.cs @@ -12,12 +12,10 @@ public class UnmappedCustomer(string customerID) [MaxLength(5)] public string CustomerID { get; init; } = customerID; - [MaxLength(40)] - [Required] + [MaxLength(40), Required] public string? CompanyName { get; set; } - [MaxLength(30)] - [Required] + [MaxLength(30), Required] public string? ContactName { get; set; } [MaxLength(30)] @@ -32,8 +30,7 @@ public class UnmappedCustomer(string customerID) [MaxLength(15)] public string? Region { get; set; } - [MaxLength(10)] - [Column("PostalCode")] + [MaxLength(10), Column("PostalCode")] public string? Zip { get; set; } [MaxLength(15)] diff --git a/test/EFCore.Specification.Tests/TestModels/Northwind/UnmappedEmployee.cs b/test/EFCore.Specification.Tests/TestModels/Northwind/UnmappedEmployee.cs index 97d935ea98a..39abfa32692 100644 --- a/test/EFCore.Specification.Tests/TestModels/Northwind/UnmappedEmployee.cs +++ b/test/EFCore.Specification.Tests/TestModels/Northwind/UnmappedEmployee.cs @@ -11,12 +11,10 @@ public class UnmappedEmployee { public int EmployeeID { get; set; } - [MaxLength(20)] - [Required] + [MaxLength(20), Required] public string LastName { get; set; } - [MaxLength(10)] - [Required] + [MaxLength(10), Required] public string FirstName { get; set; } [MaxLength(30)] diff --git a/test/EFCore.Specification.Tests/TestModels/SpatialModel/SpatialData.cs b/test/EFCore.Specification.Tests/TestModels/SpatialModel/SpatialData.cs index 0492bb4077e..750213c64ef 100644 --- a/test/EFCore.Specification.Tests/TestModels/SpatialModel/SpatialData.cs +++ b/test/EFCore.Specification.Tests/TestModels/SpatialModel/SpatialData.cs @@ -85,8 +85,8 @@ public static IReadOnlyList CreatePointEntities(GeometryFactory fac } public static IReadOnlyList CreateGeoPointEntities() - => new[] - { + => + [ new GeoPointEntity { Id = Guid.Parse("67A54C9B-4C3B-4B27-8B4E-C0335E50E552"), Location = new GeoPoint(47.6233355, -122.34877) @@ -95,18 +95,18 @@ public static IReadOnlyList CreateGeoPointEntities() { Id = Guid.Parse("67A54C9B-4C3B-4B27-8B4E-C0335E50E553"), Location = new GeoPoint(47.5978429, -122.3308366) } - }; + ]; public static IReadOnlyList CreateLineStringEntities(GeometryFactory factory) - => new[] - { + => + [ new LineStringEntity { Id = 1, LineString = factory.CreateLineString([new Coordinate(0, 0), new Coordinate(1, 0)]) }, new LineStringEntity { Id = 2, LineString = null } - }; + ]; public static IReadOnlyList CreatePolygonEntities(GeometryFactory factory) - => new[] - { + => + [ new PolygonEntity { Id = Guid.Parse("2F39AADE-4D8D-42D2-88CE-775C84AB83B1"), @@ -114,11 +114,11 @@ public static IReadOnlyList CreatePolygonEntities(GeometryFactory [new Coordinate(0, 0), new Coordinate(1, 0), new Coordinate(0, 1), new Coordinate(0, 0)]) }, new PolygonEntity { Id = Guid.Parse("F1B00CB9-862B-417B-955A-F1F7688B2AB5"), Polygon = null } - }; + ]; public static IReadOnlyList CreateMultiLineStringEntities(GeometryFactory factory) - => new[] - { + => + [ new MultiLineStringEntity { Id = 1, @@ -129,5 +129,5 @@ public static IReadOnlyList CreateMultiLineStringEntities ]) }, new MultiLineStringEntity { Id = 2, MultiLineString = null } - }; + ]; } diff --git a/test/EFCore.Specification.Tests/TestModels/TransportationModel/TransportationContext.cs b/test/EFCore.Specification.Tests/TestModels/TransportationModel/TransportationContext.cs index 5977e42d5b4..1fc3ea0ef26 100644 --- a/test/EFCore.Specification.Tests/TestModels/TransportationModel/TransportationContext.cs +++ b/test/EFCore.Specification.Tests/TestModels/TransportationModel/TransportationContext.cs @@ -14,63 +14,57 @@ public class TransportationContext(DbContextOptions options) : PoolableDbContext protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(eb => eb.HasKey(e => e.Name)); - modelBuilder.Entity( - eb => - { - eb.HasKey(e => e.VehicleName); - eb.HasOne(e => e.Vehicle) - .WithOne(e => e.Engine) - .HasForeignKey(e => e.VehicleName); - }); + modelBuilder.Entity(eb => + { + eb.HasKey(e => e.VehicleName); + eb.HasOne(e => e.Vehicle) + .WithOne(e => e.Engine) + .HasForeignKey(e => e.VehicleName); + }); modelBuilder.Entity(); modelBuilder.Entity(); modelBuilder.Entity(); - modelBuilder.Entity( - eb => - { - eb.HasKey(e => e.VehicleName); - eb.HasOne(e => e.Vehicle) - .WithOne(e => e.Operator) - .HasForeignKey(e => e.VehicleName); - eb.HasOne(e => e.Details) - .WithOne() - .HasForeignKey(e => e.VehicleName); - }); + modelBuilder.Entity(eb => + { + eb.HasKey(e => e.VehicleName); + eb.HasOne(e => e.Vehicle) + .WithOne(e => e.Operator) + .HasForeignKey(e => e.VehicleName); + eb.HasOne(e => e.Details) + .WithOne() + .HasForeignKey(e => e.VehicleName); + }); modelBuilder.Entity(); - modelBuilder.Entity( - vb => - { - vb.Navigation(v => v.Operator).IsRequired(); - }); + modelBuilder.Entity(vb => + { + vb.Navigation(v => v.Operator).IsRequired(); + }); - modelBuilder.Entity( - eb => - { - eb.HasKey(e => e.VehicleName); - eb.HasOne(e => e.Engine) - .WithOne(e => e.FuelTank) - .HasForeignKey(e => e.VehicleName); - eb.HasOne(e => e.Vehicle) - .WithOne() - .HasForeignKey(e => e.VehicleName); - }); + modelBuilder.Entity(eb => + { + eb.HasKey(e => e.VehicleName); + eb.HasOne(e => e.Engine) + .WithOne(e => e.FuelTank) + .HasForeignKey(e => e.VehicleName); + eb.HasOne(e => e.Vehicle) + .WithOne() + .HasForeignKey(e => e.VehicleName); + }); - modelBuilder.Entity( - eb => - { - eb.HasOne(e => e.Rocket) - .WithOne(e => e.SolidFuelTank) - .HasForeignKey(e => e.VehicleName); - }); + modelBuilder.Entity(eb => + { + eb.HasOne(e => e.Rocket) + .WithOne(e => e.SolidFuelTank) + .HasForeignKey(e => e.VehicleName); + }); - modelBuilder.Entity( - eb => - { - eb.HasKey(e => e.VehicleName); - }); + modelBuilder.Entity(eb => + { + eb.HasKey(e => e.VehicleName); + }); } public Task SeedAsync() diff --git a/test/EFCore.Specification.Tests/TestUtilities/BuildReference.cs b/test/EFCore.Specification.Tests/TestUtilities/BuildReference.cs index a01fe57f15a..1d84706c0e6 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/BuildReference.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/BuildReference.cs @@ -41,5 +41,5 @@ where IOPath.GetFileNameWithoutExtension(r) == name } public static BuildReference ByPath(string path) - => new(new[] { MetadataReference.CreateFromFile(path) }, path: path); + => new([MetadataReference.CreateFromFile(path)], path: path); } diff --git a/test/EFCore.Specification.Tests/TestUtilities/BuildSource.cs b/test/EFCore.Specification.Tests/TestUtilities/BuildSource.cs index 12def47930d..6f301d04b5e 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/BuildSource.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/BuildSource.cs @@ -50,13 +50,12 @@ public BuildFileResult Build() var compilation = CSharpCompilation.Create( projectName, - Sources.Select( - s => SyntaxFactory.ParseSyntaxTree( - text: s.Value, - path: s.Key, - options: new CSharpParseOptions( - LanguageVersion.Latest, - EmitDocumentationDiagnostics ? DocumentationMode.Diagnose : DocumentationMode.Parse))), + Sources.Select(s => SyntaxFactory.ParseSyntaxTree( + text: s.Value, + path: s.Key, + options: new CSharpParseOptions( + LanguageVersion.Latest, + EmitDocumentationDiagnostics ? DocumentationMode.Diagnose : DocumentationMode.Parse))), references, CreateOptions()); @@ -88,13 +87,12 @@ public Assembly BuildInMemory() var compilation = CSharpCompilation.Create( projectName, - Sources.Select( - s => SyntaxFactory.ParseSyntaxTree( - text: s.Value, - path: s.Key, - options: new CSharpParseOptions( - LanguageVersion.Latest, - EmitDocumentationDiagnostics ? DocumentationMode.Diagnose : DocumentationMode.Parse))), + Sources.Select(s => SyntaxFactory.ParseSyntaxTree( + text: s.Value, + path: s.Key, + options: new CSharpParseOptions( + LanguageVersion.Latest, + EmitDocumentationDiagnostics ? DocumentationMode.Diagnose : DocumentationMode.Parse))), references, CreateOptions()); @@ -136,13 +134,12 @@ public async Task BuildInMemoryWithWithAnalyzersAsync() var compilation = CSharpCompilation .Create( assemblyName: Path.GetRandomFileName(), - Sources.Select( - s => SyntaxFactory.ParseSyntaxTree( - text: s.Value, - path: s.Key, - options: new CSharpParseOptions( - LanguageVersion.Latest, - EmitDocumentationDiagnostics ? DocumentationMode.Diagnose : DocumentationMode.Parse))), + Sources.Select(s => SyntaxFactory.ParseSyntaxTree( + text: s.Value, + path: s.Key, + options: new CSharpParseOptions( + LanguageVersion.Latest, + EmitDocumentationDiagnostics ? DocumentationMode.Diagnose : DocumentationMode.Parse))), References.SelectMany(r => r.References), CreateOptions()) .WithAnalyzers([new UninitializedDbSetDiagnosticSuppressor()]); diff --git a/test/EFCore.Specification.Tests/TestUtilities/MetadataExtensions.cs b/test/EFCore.Specification.Tests/TestUtilities/MetadataExtensions.cs index 2c0b76ad569..2ad6243e917 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/MetadataExtensions.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/MetadataExtensions.cs @@ -12,7 +12,7 @@ public static IQueryable AsTracking( => tracking ? source.AsTracking() : source.AsNoTracking(); public static IEnumerable NullChecked(this IEnumerable enumerable) - => enumerable ?? Enumerable.Empty(); + => enumerable ?? []; public static void ForEach(this IEnumerable @this, Action action) { diff --git a/test/EFCore.Specification.Tests/TestUtilities/ModelAsserter.cs b/test/EFCore.Specification.Tests/TestUtilities/ModelAsserter.cs index 48cdd6dbfb0..ed26f265b19 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/ModelAsserter.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/ModelAsserter.cs @@ -22,8 +22,8 @@ public virtual void AssertEqual( => AssertEqual( expected, actual, - compareAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareAnnotations ? expected.GetAnnotations() : [], + compareAnnotations ? actual.GetAnnotations() : [], compareMemberAnnotations: compareAnnotations); public virtual void AssertEqual( @@ -83,8 +83,8 @@ public virtual void AssertEqual( AssertEqual( expected, actual, - compareAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareAnnotations ? expected.GetAnnotations() : [], + compareAnnotations ? actual.GetAnnotations() : [], compareBackreferences: false, compareMemberAnnotations: compareAnnotations)); } @@ -246,8 +246,8 @@ public virtual void AssertEqual( AssertEqual( expected, actual, - compareAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareAnnotations ? expected.GetAnnotations() : [], + compareAnnotations ? actual.GetAnnotations() : [], compareBackreferences: false, compareMemberAnnotations: compareAnnotations)); } @@ -283,8 +283,8 @@ public virtual bool AssertEqual( () => Assert.Equal(expected.GetPropertyAccessMode(), actual.GetPropertyAccessMode()), () => AssertEqual( expected.ComplexType, actual.ComplexType, - compareMemberAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareMemberAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareMemberAnnotations ? expected.GetAnnotations() : [], + compareMemberAnnotations ? actual.GetAnnotations() : [], compareBackreferences: false, compareMemberAnnotations: compareMemberAnnotations), () => @@ -321,8 +321,8 @@ public virtual void AssertEqual( AssertEqual( expected, actual, - compareAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareAnnotations ? expected.GetAnnotations() : [], + compareAnnotations ? actual.GetAnnotations() : [], compareBackreferences: false, compareAnnotations)); } @@ -462,8 +462,8 @@ public virtual void AssertEqual( AssertEqual( expected, actual, - compareAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareAnnotations ? expected.GetAnnotations() : [], + compareAnnotations ? actual.GetAnnotations() : [], compareBackreferences: false)); } @@ -528,8 +528,8 @@ public virtual void AssertEqual( AssertEqual( expected, actual, - compareAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareAnnotations ? expected.GetAnnotations() : [], + compareAnnotations ? actual.GetAnnotations() : [], compareBackreferences: false)); } @@ -611,8 +611,8 @@ public virtual void AssertEqual( AssertEqual( expected, actual, - compareAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareAnnotations ? expected.GetAnnotations() : [], + compareAnnotations ? actual.GetAnnotations() : [], compareBackreferences: false)); } @@ -685,11 +685,12 @@ public virtual bool AssertEqual( Assert.Null(actual); return true; } + Assert.NotNull(actual); - expectedAnnotations ??= Enumerable.Empty(); + expectedAnnotations ??= []; expectedAnnotations = expectedAnnotations.Where(a => !CoreAnnotationNames.AllNames.Contains(a.Name)); - actualAnnotations ??= Enumerable.Empty(); + actualAnnotations ??= []; actualAnnotations = actualAnnotations.Where(a => !CoreAnnotationNames.AllNames.Contains(a.Name)); Assert.Multiple( () => Assert.Equal(expected.ClrType, actual.ClrType), @@ -732,8 +733,8 @@ public virtual void AssertEqual( AssertEqual( expected, actual, - compareAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareAnnotations ? expected.GetAnnotations() : [], + compareAnnotations ? actual.GetAnnotations() : [], compareBackreferences: false)); } @@ -812,8 +813,8 @@ public virtual void AssertEqual( AssertEqual( expected, actual, - compareAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareAnnotations ? expected.GetAnnotations() : [], + compareAnnotations ? actual.GetAnnotations() : [], compareBackreferences: false, compareMemberAnnotations: compareAnnotations)); } @@ -858,20 +859,20 @@ public virtual bool AssertEqual( () => AssertEqual( expected.DependentToPrincipal, actual.DependentToPrincipal, compareMemberAnnotations - ? expected.DependentToPrincipal?.GetAnnotations() ?? Enumerable.Empty() - : Enumerable.Empty(), + ? expected.DependentToPrincipal?.GetAnnotations() ?? [] + : [], compareMemberAnnotations - ? actual.DependentToPrincipal?.GetAnnotations() ?? Enumerable.Empty() - : Enumerable.Empty(), + ? actual.DependentToPrincipal?.GetAnnotations() ?? [] + : [], compareBackreferences: true), () => AssertEqual( expected.PrincipalToDependent, actual.PrincipalToDependent, compareMemberAnnotations - ? expected.PrincipalToDependent?.GetAnnotations() ?? Enumerable.Empty() - : Enumerable.Empty(), + ? expected.PrincipalToDependent?.GetAnnotations() ?? [] + : [], compareMemberAnnotations - ? actual.PrincipalToDependent?.GetAnnotations() ?? Enumerable.Empty() - : Enumerable.Empty(), + ? actual.PrincipalToDependent?.GetAnnotations() ?? [] + : [], compareBackreferences: true), () => { @@ -907,8 +908,8 @@ public virtual void AssertEqual( AssertEqual( expected, actual, - compareAnnotations ? expected.GetAnnotations() : Enumerable.Empty(), - compareAnnotations ? actual.GetAnnotations() : Enumerable.Empty(), + compareAnnotations ? expected.GetAnnotations() : [], + compareAnnotations ? actual.GetAnnotations() : [], compareBackreferences: false)); } @@ -1044,6 +1045,7 @@ protected virtual void Copy(IReadOnlyEntityType sourceEntityType, IMutableEntity targetEntityType.SetQueryFilter(queryFilter.Key, queryFilter.Expression); } } + targetEntityType.AddData(sourceEntityType.GetSeedData()); targetEntityType.SetPropertyAccessMode(sourceEntityType.GetPropertyAccessMode()); targetEntityType.SetChangeTrackingStrategy(sourceEntityType.GetChangeTrackingStrategy()); diff --git a/test/EFCore.Specification.Tests/TestUtilities/NonSharedFixture.cs b/test/EFCore.Specification.Tests/TestUtilities/NonSharedFixture.cs index 66a5a3d0504..767fb705baa 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/NonSharedFixture.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/NonSharedFixture.cs @@ -14,7 +14,8 @@ public virtual void Dispose() { } - public Task InitializeAsync() => Task.CompletedTask; + public Task InitializeAsync() + => Task.CompletedTask; public virtual async Task DisposeAsync() { diff --git a/test/EFCore.Specification.Tests/TestUtilities/QueryAsserter.cs b/test/EFCore.Specification.Tests/TestUtilities/QueryAsserter.cs index c7c6a62b95c..93165b9cd17 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/QueryAsserter.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/QueryAsserter.cs @@ -1705,8 +1705,8 @@ private void AssertIncludeObject(object? expected, object? actual, IEnumerable i.IsConstructedGenericType && i.GetGenericTypeDefinition() == typeof(IEnumerable<>))) + && expectedType.GetTypeInfo().ImplementedInterfaces + .Any(i => i.IsConstructedGenericType && i.GetGenericTypeDefinition() == typeof(IEnumerable<>))) { _assertIncludeCollectionMethodInfo.MakeGenericMethod(expectedType.GenericTypeArguments[0]) .Invoke(this, [expected, actual, expectedIncludes, assertOrder]); @@ -1824,10 +1824,12 @@ private IQueryable RewriteExpectedQuery(IQueryable query) private class TrackingRewriter(QueryTrackingBehavior queryTrackingBehavior) : ExpressionVisitor { private static readonly MethodInfo AsNoTrackingMethodInfo - = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo().GetDeclaredMethod(nameof(EntityFrameworkQueryableExtensions.AsNoTracking))!; + = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo() + .GetDeclaredMethod(nameof(EntityFrameworkQueryableExtensions.AsNoTracking))!; private static readonly MethodInfo AsNoTrackingWithIdentityResolutionMethodInfo - = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo().GetDeclaredMethod(nameof(EntityFrameworkQueryableExtensions.AsNoTrackingWithIdentityResolution))!; + = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo() + .GetDeclaredMethod(nameof(EntityFrameworkQueryableExtensions.AsNoTrackingWithIdentityResolution))!; protected override Expression VisitExtension(Expression expression) => expression is EntityQueryRootExpression root diff --git a/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/ExpressionMutator.cs b/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/ExpressionMutator.cs index bc8f9030da4..5320b83b76c 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/ExpressionMutator.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/ExpressionMutator.cs @@ -16,19 +16,19 @@ public abstract class ExpressionMutator(DbContext context) static ExpressionMutator() { - IncludeMethodInfo = typeof(EntityFrameworkQueryableExtensions).GetMethods().Where( - m => m.Name == nameof(EntityFrameworkQueryableExtensions.Include) - && m.GetParameters()[1].ParameterType != typeof(string)) + IncludeMethodInfo = typeof(EntityFrameworkQueryableExtensions).GetMethods().Where(m + => m.Name == nameof(EntityFrameworkQueryableExtensions.Include) + && m.GetParameters()[1].ParameterType != typeof(string)) .Single(); - ThenIncludeCollectionMethodInfo = typeof(EntityFrameworkQueryableExtensions).GetMethods().Where( - m => m.Name == nameof(EntityFrameworkQueryableExtensions.ThenInclude) - && m.GetParameters()[0].ParameterType.GetGenericArguments()[1].IsGenericType - && m.GetParameters()[0].ParameterType.GetGenericArguments()[1].GetGenericTypeDefinition() == typeof(IEnumerable<>)) + ThenIncludeCollectionMethodInfo = typeof(EntityFrameworkQueryableExtensions).GetMethods().Where(m + => m.Name == nameof(EntityFrameworkQueryableExtensions.ThenInclude) + && m.GetParameters()[0].ParameterType.GetGenericArguments()[1].IsGenericType + && m.GetParameters()[0].ParameterType.GetGenericArguments()[1].GetGenericTypeDefinition() == typeof(IEnumerable<>)) .Single(); - ThenIncludeReferenceMethodInfo = typeof(EntityFrameworkQueryableExtensions).GetMethods().Where( - m => m.Name == nameof(EntityFrameworkQueryableExtensions.ThenInclude) - && m != ThenIncludeCollectionMethodInfo).Single(); + ThenIncludeReferenceMethodInfo = typeof(EntityFrameworkQueryableExtensions).GetMethods().Where(m + => m.Name == nameof(EntityFrameworkQueryableExtensions.ThenInclude) + && m != ThenIncludeCollectionMethodInfo).Single(); } protected static bool IsQueryableType(Type type) @@ -85,8 +85,8 @@ protected List FilterPropertyInfos(Type type, List p var entityType = Context.Model.FindEntityType(type); if (entityType != null) { - properties = properties.Where( - p => entityType.GetProperties().Where(pp => pp.PropertyInfo != null).Select(pp => pp.Name).Contains(p.Name)).ToList(); + properties = properties.Where(p + => entityType.GetProperties().Where(pp => pp.PropertyInfo != null).Select(pp => pp.Name).Contains(p.Name)).ToList(); } return properties; diff --git a/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/InjectWhereExpressionMutator.cs b/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/InjectWhereExpressionMutator.cs index df0f2dcd13b..6edff3ecf64 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/InjectWhereExpressionMutator.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/InjectWhereExpressionMutator.cs @@ -1,10 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Diagnostics.CodeAnalysis; - #nullable disable +using System.Diagnostics.CodeAnalysis; + namespace Microsoft.EntityFrameworkCore.TestUtilities.QueryTestGeneration; public class InjectWhereExpressionMutator(DbContext context) : ExpressionMutator(context) diff --git a/test/EFCore.Specification.Tests/TestUtilities/ServiceCollectionExtensions.cs b/test/EFCore.Specification.Tests/TestUtilities/ServiceCollectionExtensions.cs index 2a177b63f73..a1917a74ae9 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/ServiceCollectionExtensions.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/ServiceCollectionExtensions.cs @@ -8,10 +8,9 @@ public static class ServiceCollectionExtensions private static readonly MethodInfo _addDbContext = typeof(EntityFrameworkServiceCollectionExtensions) .GetTypeInfo().GetDeclaredMethods(nameof(EntityFrameworkServiceCollectionExtensions.AddDbContext)) - .Single( - mi => mi.GetParameters().Length == 4 - && mi.GetParameters()[1].ParameterType == typeof(Action) - && mi.GetGenericArguments().Length == 1); + .Single(mi => mi.GetParameters().Length == 4 + && mi.GetParameters()[1].ParameterType == typeof(Action) + && mi.GetGenericArguments().Length == 1); public static IServiceCollection AddDbContext( this IServiceCollection serviceCollection, @@ -25,10 +24,9 @@ public static IServiceCollection AddDbContext( private static readonly MethodInfo _addDbContextPool = typeof(EntityFrameworkServiceCollectionExtensions) .GetTypeInfo().GetDeclaredMethods(nameof(EntityFrameworkServiceCollectionExtensions.AddPooledDbContextFactory)) - .Single( - mi => mi.GetParameters().Length == 3 - && mi.GetParameters()[1].ParameterType == typeof(Action) - && mi.GetGenericArguments().Length == 1); + .Single(mi => mi.GetParameters().Length == 3 + && mi.GetParameters()[1].ParameterType == typeof(Action) + && mi.GetGenericArguments().Length == 1); public static IServiceCollection AddPooledDbContextFactory( this IServiceCollection serviceCollection, diff --git a/test/EFCore.Specification.Tests/TestUtilities/TestHelpers.cs b/test/EFCore.Specification.Tests/TestUtilities/TestHelpers.cs index bfad3f6333a..d4b762a2eda 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/TestHelpers.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/TestHelpers.cs @@ -321,10 +321,9 @@ public static void AssertAllMethodsOverridden(Type testClass) { var methods = testClass .GetRuntimeMethods() - .Where( - m => m.DeclaringType != testClass - && (Attribute.IsDefined(m, typeof(ConditionalFactAttribute)) - || Attribute.IsDefined(m, typeof(ConditionalTheoryAttribute)))) + .Where(m => m.DeclaringType != testClass + && (Attribute.IsDefined(m, typeof(ConditionalFactAttribute)) + || Attribute.IsDefined(m, typeof(ConditionalTheoryAttribute)))) .ToList(); var methodCalls = new StringBuilder(); diff --git a/test/EFCore.Specification.Tests/TestUtilities/TestServiceFactory.cs b/test/EFCore.Specification.Tests/TestUtilities/TestServiceFactory.cs index f5bd2f1ab5d..4baa1e0dd69 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/TestServiceFactory.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/TestServiceFactory.cs @@ -22,7 +22,7 @@ private TestServiceFactory() private readonly IReadOnlyList<(Type Type, object Implementation)> _wellKnownExceptions = new List<(Type, object)> { - (typeof(IRegisteredServices), new RegisteredServices(Enumerable.Empty())), + (typeof(IRegisteredServices), new RegisteredServices([])), (typeof(ServiceParameterBindingFactory), new ServiceParameterBindingFactory(typeof(IStateManager))), (typeof(IDiagnosticsLogger), new TestLogger()), (typeof(IDiagnosticsLogger), @@ -91,7 +91,7 @@ private static ServiceCollection AddType( { if (!serviceType.IsInterface) { - return new[] { (serviceType, serviceType) }; + return [(serviceType, serviceType)]; } var elementType = TryGetEnumerableType(serviceType); @@ -110,7 +110,7 @@ private static ServiceCollection AddType( $"Cannot use 'TestServiceFactory' for '{serviceType.ShortDisplayName()}': no single implementation type in same assembly."); } - return new[] { (serviceType, implementationTypes[0]) }; + return [(serviceType, implementationTypes[0])]; } return implementationTypes.Select(t => (elementType, t)).ToList(); diff --git a/test/EFCore.Specification.Tests/TestUtilities/Xunit/ConditionalFactAttribute.cs b/test/EFCore.Specification.Tests/TestUtilities/Xunit/ConditionalFactAttribute.cs index 947dbb12331..bd604502197 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/Xunit/ConditionalFactAttribute.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/Xunit/ConditionalFactAttribute.cs @@ -6,8 +6,7 @@ // ReSharper disable once CheckNamespace namespace Xunit; -[AttributeUsage(AttributeTargets.Method)] -[XunitTestCaseDiscoverer( - "Microsoft.EntityFrameworkCore.TestUtilities.Xunit.ConditionalFactDiscoverer", - "Microsoft.EntityFrameworkCore.Specification.Tests")] +[AttributeUsage(AttributeTargets.Method), XunitTestCaseDiscoverer( + "Microsoft.EntityFrameworkCore.TestUtilities.Xunit.ConditionalFactDiscoverer", + "Microsoft.EntityFrameworkCore.Specification.Tests")] public sealed class ConditionalFactAttribute : FactAttribute; diff --git a/test/EFCore.Specification.Tests/TestUtilities/Xunit/ConditionalTheoryAttribute.cs b/test/EFCore.Specification.Tests/TestUtilities/Xunit/ConditionalTheoryAttribute.cs index b833aa4171c..603fbc60615 100644 --- a/test/EFCore.Specification.Tests/TestUtilities/Xunit/ConditionalTheoryAttribute.cs +++ b/test/EFCore.Specification.Tests/TestUtilities/Xunit/ConditionalTheoryAttribute.cs @@ -6,8 +6,7 @@ // ReSharper disable once CheckNamespace namespace Xunit; -[AttributeUsage(AttributeTargets.Method)] -[XunitTestCaseDiscoverer( - "Microsoft.EntityFrameworkCore.TestUtilities.Xunit.ConditionalTheoryDiscoverer", - "Microsoft.EntityFrameworkCore.Specification.Tests")] +[AttributeUsage(AttributeTargets.Method), XunitTestCaseDiscoverer( + "Microsoft.EntityFrameworkCore.TestUtilities.Xunit.ConditionalTheoryDiscoverer", + "Microsoft.EntityFrameworkCore.Specification.Tests")] public sealed class ConditionalTheoryAttribute : TheoryAttribute; diff --git a/test/EFCore.Specification.Tests/UnidirectionalManyToManyLoadTestBase.cs b/test/EFCore.Specification.Tests/UnidirectionalManyToManyLoadTestBase.cs index 1f95b9372a3..682f23bb125 100644 --- a/test/EFCore.Specification.Tests/UnidirectionalManyToManyLoadTestBase.cs +++ b/test/EFCore.Specification.Tests/UnidirectionalManyToManyLoadTestBase.cs @@ -10,25 +10,24 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class ManyToManyLoadTestBase { - [ConditionalTheory] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true)] - [InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.TrackAll, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTracking, false), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Unchanged, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Modified, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, true), + InlineData(EntityState.Deleted, QueryTrackingBehavior.NoTrackingWithIdentityResolution, false)] public virtual async Task Load_collection_unidirectional(EntityState state, QueryTrackingBehavior queryTrackingBehavior, bool async) { using var context = Fixture.CreateContext(); @@ -79,13 +78,9 @@ public virtual async Task Load_collection_unidirectional(EntityState state, Quer Assert.Equal(1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_unidirectional(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -124,13 +119,9 @@ public virtual async Task Load_collection_using_Query_unidirectional(EntityState Assert.Equal(1 + 3 + 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Added, false)] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Added, true)] + [ConditionalTheory, InlineData(EntityState.Unchanged, false), InlineData(EntityState.Modified, false), + InlineData(EntityState.Added, false), InlineData(EntityState.Unchanged, true), InlineData(EntityState.Modified, true), + InlineData(EntityState.Added, true)] public virtual void Attached_collections_are_not_marked_as_loaded_unidirectional(EntityState state, bool lazy) { using var context = Fixture.CreateContext(); @@ -138,16 +129,15 @@ public virtual void Attached_collections_are_not_marked_as_loaded_unidirectional context.ChangeTracker.LazyLoadingEnabled = false; var left = ExpectLazyLoading - ? context.CreateProxy( - b => - { - b.Id = 7776; - b.TwoSkip = new ObservableCollection { new() { Id = 7777 } }; - b.TwoSkipShared = new ObservableCollection { new() { Id = 7778 } }; - b.SelfSkipPayloadLeft = new ObservableCollection { new() { Id = 7779 } }; - b.BranchSkip = new ObservableCollection { new() { Id = 7781 } }; - b.ThreeSkipPayloadFullShared = new ObservableCollection { new() { Id = 7783 } }; - }) + ? context.CreateProxy(b => + { + b.Id = 7776; + b.TwoSkip = new ObservableCollection { new() { Id = 7777 } }; + b.TwoSkipShared = new ObservableCollection { new() { Id = 7778 } }; + b.SelfSkipPayloadLeft = new ObservableCollection { new() { Id = 7779 } }; + b.BranchSkip = new ObservableCollection { new() { Id = 7781 } }; + b.ThreeSkipPayloadFullShared = new ObservableCollection { new() { Id = 7783 } }; + }) : new UnidirectionalEntityOne { Id = 7776, @@ -200,13 +190,9 @@ public virtual void Attached_collections_are_not_marked_as_loaded_unidirectional Assert.False(context.Entry(left).Collection(e => e.ThreeSkipPayloadFullShared).IsLoaded); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_already_loaded_unidirectional(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -255,13 +241,9 @@ public virtual async Task Load_collection_already_loaded_unidirectional(EntitySt Assert.Equal(1 + 4 + 4, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_already_loaded_unidirectional(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -300,13 +282,9 @@ public virtual async Task Load_collection_using_Query_already_loaded_unidirectio Assert.Equal(1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_untyped_unidirectional(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -355,13 +333,9 @@ public virtual async Task Load_collection_untyped_unidirectional(EntityState sta Assert.Equal(1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_untyped_unidirectional(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -400,13 +374,9 @@ public virtual async Task Load_collection_using_Query_untyped_unidirectional(Ent Assert.Equal(1 + 3 + 3, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_not_found_untyped_unidirectional(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -449,13 +419,9 @@ public virtual async Task Load_collection_not_found_untyped_unidirectional(Entit Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_not_found_untyped_unidirectional(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -488,19 +454,15 @@ public virtual async Task Load_collection_using_Query_not_found_untyped_unidirec Assert.Single(context.ChangeTracker.Entries()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_already_loaded_untyped_unidirectional( EntityState state, bool async, @@ -556,19 +518,15 @@ public virtual async Task Load_collection_already_loaded_untyped_unidirectional( Assert.Equal(1 + 4 + 4, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Modified, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, true, CascadeTiming.Immediate)] - [InlineData(EntityState.Deleted, false, CascadeTiming.Immediate)] - [InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges)] - [InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true, CascadeTiming.Immediate), + InlineData(EntityState.Unchanged, false, CascadeTiming.Immediate), InlineData(EntityState.Modified, true, CascadeTiming.Immediate), + InlineData(EntityState.Modified, false, CascadeTiming.Immediate), InlineData(EntityState.Deleted, true, CascadeTiming.Immediate), + InlineData(EntityState.Deleted, false, CascadeTiming.Immediate), InlineData(EntityState.Unchanged, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Unchanged, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Modified, false, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, true, CascadeTiming.OnSaveChanges), + InlineData(EntityState.Deleted, false, CascadeTiming.OnSaveChanges)] public virtual async Task Load_collection_using_Query_already_loaded_untyped_unidirectional( EntityState state, bool async, @@ -613,13 +571,9 @@ public virtual async Task Load_collection_using_Query_already_loaded_untyped_uni Assert.Equal(1 + 7 + 7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_composite_key_unidirectional(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -668,13 +622,9 @@ public virtual async Task Load_collection_composite_key_unidirectional(EntitySta Assert.Equal(1 + 2 + 2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(EntityState.Unchanged, true)] - [InlineData(EntityState.Unchanged, false)] - [InlineData(EntityState.Modified, true)] - [InlineData(EntityState.Modified, false)] - [InlineData(EntityState.Deleted, true)] - [InlineData(EntityState.Deleted, false)] + [ConditionalTheory, InlineData(EntityState.Unchanged, true), InlineData(EntityState.Unchanged, false), + InlineData(EntityState.Modified, true), InlineData(EntityState.Modified, false), InlineData(EntityState.Deleted, true), + InlineData(EntityState.Deleted, false)] public virtual async Task Load_collection_using_Query_composite_key_unidirectional(EntityState state, bool async) { using var context = Fixture.CreateContext(); @@ -703,13 +653,9 @@ public virtual async Task Load_collection_using_Query_composite_key_unidirection Assert.Equal(1 + 2 + 2, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true, QueryTrackingBehavior.NoTracking)] - [InlineData(true, QueryTrackingBehavior.TrackAll)] - [InlineData(true, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] - [InlineData(false, QueryTrackingBehavior.NoTracking)] - [InlineData(false, QueryTrackingBehavior.TrackAll)] - [InlineData(false, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(true, QueryTrackingBehavior.NoTracking), InlineData(true, QueryTrackingBehavior.TrackAll), + InlineData(true, QueryTrackingBehavior.NoTrackingWithIdentityResolution), InlineData(false, QueryTrackingBehavior.NoTracking), + InlineData(false, QueryTrackingBehavior.TrackAll), InlineData(false, QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual async Task Load_collection_for_detached_throws_unidirectional(bool async, QueryTrackingBehavior queryTrackingBehavior) { using var context = Fixture.CreateContext(); @@ -733,10 +679,8 @@ public virtual async Task Load_collection_for_detached_throws_unidirectional(boo } } - [ConditionalTheory] - [InlineData(QueryTrackingBehavior.NoTracking)] - [InlineData(QueryTrackingBehavior.TrackAll)] - [InlineData(QueryTrackingBehavior.NoTrackingWithIdentityResolution)] + [ConditionalTheory, InlineData(QueryTrackingBehavior.NoTracking), InlineData(QueryTrackingBehavior.TrackAll), + InlineData(QueryTrackingBehavior.NoTrackingWithIdentityResolution)] public virtual void Query_collection_for_detached_throws_unidirectional(QueryTrackingBehavior queryTrackingBehavior) { using var context = Fixture.CreateContext(); @@ -753,9 +697,7 @@ public virtual void Query_collection_for_detached_throws_unidirectional(QueryTra var query = collectionEntry.Query(); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_Include_unidirectional(bool async) { using var context = Fixture.CreateContext(); @@ -800,9 +742,7 @@ public virtual async Task Load_collection_using_Query_with_Include_unidirectiona Assert.Equal(21, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_Include_for_inverse_unidirectional(bool async) { using var context = Fixture.CreateContext(); @@ -841,9 +781,7 @@ public virtual async Task Load_collection_using_Query_with_Include_for_inverse_u Assert.Equal(7, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_filtered_Include_unidirectional(bool async) { using var context = Fixture.CreateContext(); @@ -858,13 +796,11 @@ public virtual async Task Load_collection_using_Query_with_filtered_Include_unid var children = async ? await collectionEntry.Query() - .Include( - e => EF.Property>(e, "UnidirectionalEntityThree") - .Where(e => e.Id == 13 || e.Id == 11)).ToListAsync() + .Include(e => EF.Property>(e, "UnidirectionalEntityThree") + .Where(e => e.Id == 13 || e.Id == 11)).ToListAsync() : collectionEntry.Query() - .Include( - e => EF.Property>(e, "UnidirectionalEntityThree") - .Where(e => e.Id == 13 || e.Id == 11)).ToList(); + .Include(e => EF.Property>(e, "UnidirectionalEntityThree") + .Where(e => e.Id == 13 || e.Id == 11)).ToList(); Assert.False(collectionEntry.IsLoaded); foreach (var entityTwo in left.TwoSkipShared) @@ -898,9 +834,7 @@ public virtual async Task Load_collection_using_Query_with_filtered_Include_unid Assert.Equal(9, context.ChangeTracker.Entries().Count()); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_filtered_Include_and_projection_unidirectional(bool async) { using var context = Fixture.CreateContext(); @@ -915,15 +849,13 @@ public virtual async Task Load_collection_using_Query_with_filtered_Include_and_ var queryable = collectionEntry .Query() - .Include( - e => EF.Property>(e, "UnidirectionalEntityThree") - .Where(e => e.Id == 13 || e.Id == 11)) + .Include(e => EF.Property>(e, "UnidirectionalEntityThree") + .Where(e => e.Id == 13 || e.Id == 11)) .OrderBy(e => e.Id) - .Select( - e => new - { - e.Id, e.Name, - }); + .Select(e => new + { + e.Id, e.Name, + }); var projected = async ? await queryable.ToListAsync() @@ -947,9 +879,7 @@ public virtual async Task Load_collection_using_Query_with_filtered_Include_and_ Assert.Equal("EntityTwo 16", projected[2].Name); } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Load_collection_using_Query_with_join_unidirectional(bool async) { using var context = Fixture.CreateContext(); @@ -985,9 +915,7 @@ on t.Id equals s.Id } } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Query_with_Include_marks_only_left_as_loaded_unidirectional(bool async) { using var context = Fixture.CreateContext(); @@ -1009,9 +937,7 @@ public virtual async Task Query_with_Include_marks_only_left_as_loaded_unidirect } } - [ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual async Task Query_with_filtered_Include_marks_only_left_as_loaded_unidirectional(bool async) { using var context = Fixture.CreateContext(); diff --git a/test/EFCore.Specification.Tests/UnidirectionalManyToManyTrackingTestBase.cs b/test/EFCore.Specification.Tests/UnidirectionalManyToManyTrackingTestBase.cs index 808b986088d..1bffe9147b2 100644 --- a/test/EFCore.Specification.Tests/UnidirectionalManyToManyTrackingTestBase.cs +++ b/test/EFCore.Specification.Tests/UnidirectionalManyToManyTrackingTestBase.cs @@ -10,9 +10,7 @@ namespace Microsoft.EntityFrameworkCore; public abstract partial class ManyToManyTrackingTestBase { - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_composite_with_navs_unidirectional(bool async) { List leftKeys = null; @@ -22,27 +20,24 @@ await ExecuteWithStrategyInTransactionAsync( { var leftEntities = new[] { - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Key2 = "7711"; - e.Key3 = new DateTime(7711, 1, 1); - }), - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Key2 = "7712"; - e.Key3 = new DateTime(7712, 1, 1); - }), - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Key2 = "7713"; - e.Key3 = new DateTime(7713, 1, 1); - }), + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Key2 = "7711"; + e.Key3 = new DateTime(7711, 1, 1); + }), + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Key2 = "7712"; + e.Key3 = new DateTime(7712, 1, 1); + }), + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Key2 = "7713"; + e.Key3 = new DateTime(7713, 1, 1); + }), }; var rightEntities = new[] { @@ -148,45 +143,41 @@ public virtual Task Can_update_many_to_many_composite_with_navs_unidirectional() .ToListAsync(); rightEntities[0].CompositeKeySkipFull.Add( - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Key2 = "7711"; - e.Key3 = new DateTime(7711, 1, 1); - e.Name = "Z7711"; - })); + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Key2 = "7711"; + e.Key3 = new DateTime(7711, 1, 1); + e.Name = "Z7711"; + })); rightEntities[0].CompositeKeySkipFull.Add( - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Key2 = "7712"; - e.Key3 = new DateTime(7712, 1, 1); - e.Name = "Z7712"; - })); + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Key2 = "7712"; + e.Key3 = new DateTime(7712, 1, 1); + e.Name = "Z7712"; + })); rightEntities[0].CompositeKeySkipFull.Add( - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Key2 = "7713"; - e.Key3 = new DateTime(7713, 1, 1); - e.Name = "Z7713"; - })); + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Key2 = "7713"; + e.Key3 = new DateTime(7713, 1, 1); + e.Name = "Z7713"; + })); rightEntities[1].CompositeKeySkipFull.Remove(rightEntities[1].CompositeKeySkipFull.Single(e => e.Key2 == "3_1")); rightEntities[2].CompositeKeySkipFull.Remove(rightEntities[2].CompositeKeySkipFull.Single(e => e.Key2 == "8_3")); rightEntities[2].CompositeKeySkipFull.Add( - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Key2 = "7714"; - e.Key3 = new DateTime(7714, 1, 1); - e.Name = "Z7714"; - })); + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Key2 = "7714"; + e.Key3 = new DateTime(7714, 1, 1); + e.Name = "Z7714"; + })); if (RequiresDetectChanges) { @@ -433,9 +424,7 @@ static void ValidateJoinNavigations(DbContext context) } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_composite_additional_pk_with_navs_unidirectional(bool async) { List keys = null; @@ -445,48 +434,42 @@ await ExecuteWithStrategyInTransactionAsync( { var leftEntities = new[] { - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Key2 = "7711"; - e.Key3 = new DateTime(7711, 1, 1); - }), - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Key2 = "7712"; - e.Key3 = new DateTime(7712, 1, 1); - }), - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Key2 = "7713"; - e.Key3 = new DateTime(7713, 1, 1); - }), + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Key2 = "7711"; + e.Key3 = new DateTime(7711, 1, 1); + }), + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Key2 = "7712"; + e.Key3 = new DateTime(7712, 1, 1); + }), + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Key2 = "7713"; + e.Key3 = new DateTime(7713, 1, 1); + }), }; var rightEntities = new[] { - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }) + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }) }; leftEntities[0].ThreeSkipFull = CreateCollection(); @@ -600,62 +583,54 @@ public virtual Task Can_update_many_to_many_composite_additional_pk_with_navs_un var threes = new[] { - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - }) + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }), + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + }) }; var composites = new[] { - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Key2 = "Z7711"; - e.Key3 = new DateTime(7711, 1, 1); - }), - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Key2 = "Z7712"; - e.Key3 = new DateTime(7712, 1, 1); - }), - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Key2 = "Z7713"; - e.Key3 = new DateTime(7713, 1, 1); - }), - context.UnidirectionalEntityCompositeKeys.CreateInstance( - (e, p) => - { - e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Key2 = "Z7714"; - e.Key3 = new DateTime(7714, 1, 1); - }) + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Key2 = "Z7711"; + e.Key3 = new DateTime(7711, 1, 1); + }), + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Key2 = "Z7712"; + e.Key3 = new DateTime(7712, 1, 1); + }), + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Key2 = "Z7713"; + e.Key3 = new DateTime(7713, 1, 1); + }), + context.UnidirectionalEntityCompositeKeys.CreateInstance((e, p) => + { + e.Key1 = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Key2 = "Z7714"; + e.Key3 = new DateTime(7714, 1, 1); + }) }; leftEntities[0].ThreeSkipFull.Add(threes[0]); @@ -949,9 +924,7 @@ static void ValidateJoinNavigations(DbContext context) } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_self_shared_unidirectional(bool async) { List leftKeys = null; @@ -1073,54 +1046,46 @@ public virtual Task Can_update_many_to_many_self_unidirectional() var twos = new[] { - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - }) + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + }) }; leftEntities[0].SelfSkipSharedRight.Add(twos[0]); @@ -1233,9 +1198,7 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_with_inheritance_unidirectional(bool async) { List keys = null; @@ -1338,51 +1301,45 @@ public virtual Task Can_update_many_to_many_with_inheritance_unidirectional() .ToListAsync(); leftEntities[0].BranchSkip.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + })); leftEntities[0].BranchSkip.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + })); leftEntities[0].BranchSkip.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + })); var rightNav0 = (ICollection)context.Entry(rightEntities[0]) .Collection("UnidirectionalEntityOne").CurrentValue!; rightNav0.Add( - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - })); + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + })); rightNav0.Add( - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - })); + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + })); rightNav0.Add( - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - })); + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + })); leftEntities[1].BranchSkip.Remove(leftEntities[1].BranchSkip.Single(e => e.Name == "Branch 4")); var rightNav1 = (ICollection)context.Entry(rightEntities[1]) @@ -1391,23 +1348,21 @@ public virtual Task Can_update_many_to_many_with_inheritance_unidirectional() leftEntities[4].BranchSkip.Remove(leftEntities[4].BranchSkip.Single(e => e.Name == "Branch 5")); leftEntities[2].BranchSkip.Add( - context.Set().CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - })); + context.Set().CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + })); var rightNav2 = (ICollection)context.Entry(rightEntities[2]) .Collection("UnidirectionalEntityOne").CurrentValue!; rightNav2.Remove(rightNav2.Single(e => e.Name == "EntityOne 8")); rightNav2.Add( - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - })); + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + })); if (RequiresDetectChanges) { @@ -1490,9 +1445,7 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_self_with_payload_unidirectional(bool async) { List leftKeys = null; @@ -1637,54 +1590,46 @@ public virtual Task Can_update_many_to_many_self_with_payload_unidirectional() var ones = new[] { - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }), - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - }), - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - }), - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - }), - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - }), - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - }) + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + }) }; var leftNav0 = (ICollection)context.Entry(leftEntities[0]) @@ -1837,9 +1782,7 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_shared_with_payload_unidirectional(bool async) { List keys = null; @@ -1960,51 +1903,45 @@ public virtual Task Can_update_many_to_many_shared_with_payload_unidirectional() .ToListAsync(); leftEntities[0].ThreeSkipPayloadFullShared.Add( - context.UnidirectionalEntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - })); + context.UnidirectionalEntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + })); leftEntities[0].ThreeSkipPayloadFullShared.Add( - context.UnidirectionalEntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - })); + context.UnidirectionalEntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + })); leftEntities[0].ThreeSkipPayloadFullShared.Add( - context.UnidirectionalEntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - })); + context.UnidirectionalEntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + })); var rightNav0 = (ICollection)context.Entry(rightEntities[0]) .Collection("UnidirectionalEntityOne1").CurrentValue!; rightNav0.Add( - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - })); + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + })); rightNav0.Add( - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - })); + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + })); rightNav0.Add( - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - })); + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + })); leftEntities[2].ThreeSkipPayloadFullShared .Remove(leftEntities[2].ThreeSkipPayloadFullShared.Single(e => e.Name == "EntityThree 10")); @@ -2016,23 +1953,21 @@ public virtual Task Can_update_many_to_many_shared_with_payload_unidirectional() .Remove(leftEntities[3].ThreeSkipPayloadFullShared.Single(e => e.Name == "EntityThree 17")); leftEntities[3].ThreeSkipPayloadFullShared .Add( - context.UnidirectionalEntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - })); + context.UnidirectionalEntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + })); var rightNav2 = (ICollection)context.Entry(rightEntities[2]) .Collection("UnidirectionalEntityOne1").CurrentValue!; rightNav2.Remove(rightNav2.Single(e => e.Name == "EntityOne 12")); rightNav2.Add( - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - })); + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + })); if (RequiresDetectChanges) { @@ -2159,9 +2094,7 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_shared_unidirectional(bool async) { List keys = null; @@ -2265,58 +2198,50 @@ public virtual Task Can_update_many_to_many_shared_unidirectional() var twos = new[] { - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; - e.Name = "Z7724"; - }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7724; + e.Name = "Z7724"; + }), }; var ones = new[] { - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - }), - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - }), - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - }), - context.UnidirectionalEntityOnes.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; - e.Name = "Z7714"; - }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + }), + context.UnidirectionalEntityOnes.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7714; + e.Name = "Z7714"; + }), }; leftEntities[0].TwoSkipShared.Add(twos[0]); @@ -2428,15 +2353,9 @@ void ValidateFixup( } } - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(true, false, false)] - [InlineData(false, true, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(true, false, false), InlineData(false, true, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(true, false, true), InlineData(false, true, true), + InlineData(true, true, true)] public virtual async Task Can_insert_many_to_many_with_suspected_dangling_join_unidirectional( bool async, bool useTrackGraph, @@ -2473,50 +2392,44 @@ await ExecuteWithStrategyInTransactionAsync( var joinEntities = new[] { - context.Set().CreateInstance( - (e, p) => - { - e.One = leftEntities[0]; - e.Two = rightEntities[0]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.One = leftEntities[0]; - e.Two = rightEntities[1]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.One = leftEntities[0]; - e.Two = rightEntities[2]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.One = leftEntities[1]; - e.Two = rightEntities[0]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.One = leftEntities[2]; - e.Two = rightEntities[0]; - }), + context.Set().CreateInstance((e, p) => + { + e.One = leftEntities[0]; + e.Two = rightEntities[0]; + }), + context.Set().CreateInstance((e, p) => + { + e.One = leftEntities[0]; + e.Two = rightEntities[1]; + }), + context.Set().CreateInstance((e, p) => + { + e.One = leftEntities[0]; + e.Two = rightEntities[2]; + }), + context.Set().CreateInstance((e, p) => + { + e.One = leftEntities[1]; + e.Two = rightEntities[0]; + }), + context.Set().CreateInstance((e, p) => + { + e.One = leftEntities[2]; + e.Two = rightEntities[0]; + }), }; - var extra = context.Set().CreateInstance( - (e, p) => + var extra = context.Set().CreateInstance((e, p) => + { + e.JoinEntities = new ObservableCollection { - e.JoinEntities = new ObservableCollection - { - joinEntities[0], - joinEntities[1], - joinEntities[2], - joinEntities[3], - joinEntities[4], - }; - }); + joinEntities[0], + joinEntities[1], + joinEntities[2], + joinEntities[3], + joinEntities[4], + }; + }); rightEntities[0].Extra = extra; rightEntities[1].Extra = extra; @@ -2616,15 +2529,9 @@ void ValidateFixup(DbContext context, IList leftEntitie } } - [ConditionalTheory] - [InlineData(false, false, false)] - [InlineData(true, false, false)] - [InlineData(false, true, false)] - [InlineData(true, true, false)] - [InlineData(false, false, true)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] - [InlineData(true, true, true)] + [ConditionalTheory, InlineData(false, false, false), InlineData(true, false, false), InlineData(false, true, false), + InlineData(true, true, false), InlineData(false, false, true), InlineData(true, false, true), InlineData(false, true, true), + InlineData(true, true, true)] public virtual async Task Can_insert_many_to_many_with_dangling_join_unidirectional( bool async, bool useTrackGraph, @@ -2765,12 +2672,11 @@ public virtual Task Can_insert_update_delete_proxyable_shared_type_entity_type_u return ExecuteWithStrategyInTransactionAsync( async context => { - var entity = context.Set("PST").CreateInstance( - (e, p) => - { - e["Id"] = Fixture.UseGeneratedKeys ? null : 1; - e["Payload"] = "NewlyAdded"; - }); + var entity = context.Set("PST").CreateInstance((e, p) => + { + e["Id"] = Fixture.UseGeneratedKeys ? null : 1; + e["Payload"] = "NewlyAdded"; + }); context.Set("PST").Add(entity); @@ -2807,9 +2713,7 @@ public virtual Task Can_insert_update_delete_proxyable_shared_type_entity_type_u }); } - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_insert_many_to_many_with_navs_by_join_entity_unidirectional(bool async) { await ExecuteWithStrategyInTransactionAsync( @@ -2817,79 +2721,68 @@ await ExecuteWithStrategyInTransactionAsync( { var leftEntities = new[] { - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; - e.Name = "Z7711"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; - e.Name = "Z7712"; - }), - context.UnidirectionalEntityTwos.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; - e.Name = "Z7713"; - }) + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7711; + e.Name = "Z7711"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7712; + e.Name = "Z7712"; + }), + context.UnidirectionalEntityTwos.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7713; + e.Name = "Z7713"; + }) }; var rightEntities = new[] { - context.UnidirectionalEntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; - e.Name = "Z7721"; - }), - context.UnidirectionalEntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; - e.Name = "Z7722"; - }), - context.UnidirectionalEntityThrees.CreateInstance( - (e, p) => - { - e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; - e.Name = "Z7723"; - }) + context.UnidirectionalEntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7721; + e.Name = "Z7721"; + }), + context.UnidirectionalEntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7722; + e.Name = "Z7722"; + }), + context.UnidirectionalEntityThrees.CreateInstance((e, p) => + { + e.Id = Fixture.UseGeneratedKeys ? 0 : 7723; + e.Name = "Z7723"; + }) }; var joinEntities = new[] { - context.Set().CreateInstance( - (e, p) => - { - e.Two = leftEntities[0]; - e.Three = rightEntities[0]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Two = leftEntities[0]; - e.Three = rightEntities[1]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Two = leftEntities[0]; - e.Three = rightEntities[2]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Two = leftEntities[1]; - e.Three = rightEntities[0]; - }), - context.Set().CreateInstance( - (e, p) => - { - e.Two = leftEntities[2]; - e.Three = rightEntities[0]; - }) + context.Set().CreateInstance((e, p) => + { + e.Two = leftEntities[0]; + e.Three = rightEntities[0]; + }), + context.Set().CreateInstance((e, p) => + { + e.Two = leftEntities[0]; + e.Three = rightEntities[1]; + }), + context.Set().CreateInstance((e, p) => + { + e.Two = leftEntities[0]; + e.Three = rightEntities[2]; + }), + context.Set().CreateInstance((e, p) => + { + e.Two = leftEntities[1]; + e.Three = rightEntities[0]; + }), + context.Set().CreateInstance((e, p) => + { + e.Two = leftEntities[2]; + e.Three = rightEntities[0]; + }) }; if (async) diff --git a/test/EFCore.Specification.Tests/Update/UpdatesTestBase.cs b/test/EFCore.Specification.Tests/Update/UpdatesTestBase.cs index 6de5d590d49..2ed28894753 100644 --- a/test/EFCore.Specification.Tests/Update/UpdatesTestBase.cs +++ b/test/EFCore.Specification.Tests/Update/UpdatesTestBase.cs @@ -16,61 +16,56 @@ public abstract class UpdatesTestBase(TFixture fixture) : IClassFixtur public static readonly IEnumerable IsAsyncData = [[false], [true]]; - [ConditionalTheory] // Issue #25905 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #25905 public virtual async Task Can_delete_and_add_for_same_key(bool async) - => await ExecuteWithStrategyInTransactionAsync( - async context => + => await ExecuteWithStrategyInTransactionAsync(async context => + { + var rodney1 = new Rodney { Id = "SnotAndMarmite", Concurrency = new DateTime(1973, 9, 3) }; + if (async) { - var rodney1 = new Rodney { Id = "SnotAndMarmite", Concurrency = new DateTime(1973, 9, 3) }; - if (async) - { - await context.AddAsync(rodney1); - await context.SaveChangesAsync(); - } - else - { - context.Add(rodney1); - await context.SaveChangesAsync(); - } + await context.AddAsync(rodney1); + await context.SaveChangesAsync(); + } + else + { + context.Add(rodney1); + await context.SaveChangesAsync(); + } - context.Remove(rodney1); + context.Remove(rodney1); - var rodney2 = new Rodney { Id = "SnotAndMarmite", Concurrency = new DateTime(1973, 9, 4) }; - if (async) - { - await context.AddAsync(rodney2); - await context.SaveChangesAsync(); - } - else - { - context.Add(rodney2); - await context.SaveChangesAsync(); - } + var rodney2 = new Rodney { Id = "SnotAndMarmite", Concurrency = new DateTime(1973, 9, 4) }; + if (async) + { + await context.AddAsync(rodney2); + await context.SaveChangesAsync(); + } + else + { + context.Add(rodney2); + await context.SaveChangesAsync(); + } - Assert.Equal(1, context.ChangeTracker.Entries().Count()); - Assert.Equal(EntityState.Unchanged, context.Entry(rodney2).State); - Assert.Equal(EntityState.Detached, context.Entry(rodney1).State); - }); + Assert.Equal(1, context.ChangeTracker.Entries().Count()); + Assert.Equal(EntityState.Unchanged, context.Entry(rodney2).State); + Assert.Equal(EntityState.Detached, context.Entry(rodney1).State); + }); - [ConditionalTheory] // Issue #29789 - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] // Issue #29789 public virtual async Task Can_change_type_of_pk_to_pk_dependent_by_replacing_with_new_dependent(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => { var gift = new Gift { Recipient = "Alice", Obscurer = new GiftPaper { Pattern = "Stripes" } }; await context.AddAsync(gift); - _ = async ? await context.SaveChangesAsync() : await context.SaveChangesAsync(); + _ = async ? await context.SaveChangesAsync() : context.SaveChanges(); }, async context => { var gift = await context.Set().Include(e => e.Obscurer).SingleAsync(); var bag = new GiftBag { Pattern = "Gold stars" }; gift.Obscurer = bag; - _ = async ? await context.SaveChangesAsync() : await context.SaveChangesAsync(); + _ = async ? await context.SaveChangesAsync() : context.SaveChanges(); }, async context => { @@ -81,23 +76,21 @@ public virtual async Task Can_change_type_of_pk_to_pk_dependent_by_replacing_wit Assert.Single(context.Set()); }); - [ConditionalTheory] - [InlineData(false)] - [InlineData(true)] + [ConditionalTheory, InlineData(false), InlineData(true)] public virtual async Task Can_change_type_of__dependent_by_replacing_with_new_dependent(bool async) => await ExecuteWithStrategyInTransactionAsync( async context => { var lift = new Lift { Recipient = "Alice", Obscurer = new LiftPaper { Pattern = "Stripes" } }; await context.AddAsync(lift); - _ = async ? await context.SaveChangesAsync() : await context.SaveChangesAsync(); + _ = async ? await context.SaveChangesAsync() : context.SaveChanges(); }, async context => { var lift = await context.Set().Include(e => e.Obscurer).SingleAsync(); var bag = new LiftBag { Pattern = "Gold stars" }; lift.Obscurer = bag; - _ = async ? await context.SaveChangesAsync() : await context.SaveChangesAsync(); + _ = async ? await context.SaveChangesAsync() : context.SaveChanges(); }, async context => { @@ -181,43 +174,39 @@ public virtual Task Save_partial_update() [ConditionalFact] public virtual Task Save_partial_update_on_missing_record_throws() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - var entry = context.Products.Attach( - new Product { Id = new Guid("3d1302c5-4cf8-4043-9758-de9398f6fe10"), Name = "Apple Fritter" }); + => ExecuteWithStrategyInTransactionAsync(async context => + { + var entry = context.Products.Attach( + new Product { Id = new Guid("3d1302c5-4cf8-4043-9758-de9398f6fe10"), Name = "Apple Fritter" }); - entry.Property(c => c.Name).IsModified = true; + entry.Property(c => c.Name).IsModified = true; - Assert.Equal( - UpdateConcurrencyMessage, - (await Assert.ThrowsAsync( - () => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + UpdateConcurrencyMessage, + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); [ConditionalFact] public virtual Task Save_partial_update_on_concurrency_token_original_value_mismatch_throws() { var productId = new Guid("984ade3c-2f7b-4651-a351-642e92ab7146"); - return ExecuteWithStrategyInTransactionAsync( - async context => - { - var entry = context.Products.Attach( - new Product - { - Id = productId, - Name = "Apple Fritter", - Price = 3.49M // Not the same as the value stored in the database - }); + return ExecuteWithStrategyInTransactionAsync(async context => + { + var entry = context.Products.Attach( + new Product + { + Id = productId, + Name = "Apple Fritter", + Price = 3.49M // Not the same as the value stored in the database + }); - entry.Property(c => c.Name).IsModified = true; + entry.Property(c => c.Name).IsModified = true; - Assert.Equal( - UpdateConcurrencyTokenMessage, - (await Assert.ThrowsAsync( - () => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + UpdateConcurrencyTokenMessage, + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); } [ConditionalFact] @@ -250,8 +239,7 @@ public virtual Task Update_on_bytes_concurrency_token_original_value_mismatch_th entry.Entity.Name = "GigaChips"; - await Assert.ThrowsAsync( - () => context.SaveChangesAsync()); + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); }, async context => Assert.Equal("MegaChips", (await context.ProductWithBytes.FindAsync(productId))!.Name)); } @@ -321,8 +309,7 @@ public virtual Task Remove_on_bytes_concurrency_token_original_value_mismatch_th entry.State = EntityState.Deleted; - await Assert.ThrowsAsync( - () => context.SaveChangesAsync()); + await Assert.ThrowsAsync(() => context.SaveChangesAsync()); }, async context => Assert.Equal("MegaChips", (await context.ProductWithBytes.FindAsync(productId))!.Name)); } @@ -482,37 +469,33 @@ public virtual Task Can_remove_partial() [ConditionalFact] public virtual Task Remove_partial_on_missing_record_throws() - => ExecuteWithStrategyInTransactionAsync( - async context => - { - context.Products.Remove( - new Product { Id = new Guid("3d1302c5-4cf8-4043-9758-de9398f6fe10") }); + => ExecuteWithStrategyInTransactionAsync(async context => + { + context.Products.Remove( + new Product { Id = new Guid("3d1302c5-4cf8-4043-9758-de9398f6fe10") }); - Assert.Equal( - UpdateConcurrencyMessage, - (await Assert.ThrowsAsync( - () => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + UpdateConcurrencyMessage, + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); [ConditionalFact] public virtual Task Remove_partial_on_concurrency_token_original_value_mismatch_throws() { var productId = new Guid("984ade3c-2f7b-4651-a351-642e92ab7146"); - return ExecuteWithStrategyInTransactionAsync( - async context => - { - context.Products.Remove( - new Product - { - Id = productId, Price = 3.49M // Not the same as the value stored in the database - }); + return ExecuteWithStrategyInTransactionAsync(async context => + { + context.Products.Remove( + new Product + { + Id = productId, Price = 3.49M // Not the same as the value stored in the database + }); - Assert.Equal( - UpdateConcurrencyTokenMessage, - (await Assert.ThrowsAsync( - () => context.SaveChangesAsync())).Message); - }); + Assert.Equal( + UpdateConcurrencyTokenMessage, + (await Assert.ThrowsAsync(() => context.SaveChangesAsync())).Message); + }); } [ConditionalFact] @@ -545,8 +528,7 @@ public virtual Task Save_replaced_principal() Assert.Equal(2, products.Count); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public Task SaveChanges_processes_all_tracked_entities(bool async) { var categoryId = 0; @@ -600,8 +582,7 @@ public Task SaveChanges_processes_all_tracked_entities(bool async) }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public Task SaveChanges_false_processes_all_tracked_entities_without_calling_AcceptAllChanges(bool async) { var categoryId = 0; @@ -658,8 +639,7 @@ public Task SaveChanges_false_processes_all_tracked_entities_without_calling_Acc }); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public Task Ignore_before_save_property_is_still_generated(bool async) => ExecuteWithStrategyInTransactionAsync( async context => @@ -697,8 +677,7 @@ public Task Ignore_before_save_property_is_still_generated(bool async) Assert.Equal("CC2", ((CupCake)bakedGoods[0]).CupCakeName); }); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public Task Ignore_before_save_property_is_still_generated_graph(bool async) => ExecuteWithStrategyInTransactionAsync( async context => @@ -939,18 +918,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con .HasIndex(e => new { e.Name, e.IsPrimaryNormalized }) .IsUnique(); - modelBuilder.Entity( - pb => - { - pb.HasOne(p => p.Parent) - .WithMany() - .OnDelete(DeleteBehavior.Restrict); - pb.OwnsOne(p => p.Address) - .Property(p => p.Country) - .HasConversion(); - pb.Property(p => p.ZipCode) - .HasConversion(v => v == null ? null : int.Parse(v), v => v == null ? null : v.ToString()!); - }); + modelBuilder.Entity(pb => + { + pb.HasOne(p => p.Parent) + .WithMany() + .OnDelete(DeleteBehavior.Restrict); + pb.OwnsOne(p => p.Address) + .Property(p => p.Country) + .HasConversion(); + pb.Property(p => p.ZipCode) + .HasConversion(v => v == null ? null : int.Parse(v), v => v == null ? null : v.ToString()!); + }); modelBuilder.Entity().HasMany(e => e.ProductCategories).WithOne(e => e.Category) .HasForeignKey(e => e.CategoryId); @@ -964,104 +942,97 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder .Entity< LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWorkingCorrectly - >( - eb => + >(eb => + { + eb.HasKey(l => new + { + l.ProfileId, + l.ProfileId1, + l.ProfileId3, + l.ProfileId4, + l.ProfileId5, + l.ProfileId6, + l.ProfileId7, + l.ProfileId8, + l.ProfileId9, + l.ProfileId10, + l.ProfileId11, + l.ProfileId12, + l.ProfileId13, + l.ProfileId14 + }); + eb.HasIndex(l => new { - eb.HasKey( - l => new - { - l.ProfileId, - l.ProfileId1, - l.ProfileId3, - l.ProfileId4, - l.ProfileId5, - l.ProfileId6, - l.ProfileId7, - l.ProfileId8, - l.ProfileId9, - l.ProfileId10, - l.ProfileId11, - l.ProfileId12, - l.ProfileId13, - l.ProfileId14 - }); - eb.HasIndex( - l => new - { - l.ProfileId, - l.ProfileId1, - l.ProfileId3, - l.ProfileId4, - l.ProfileId5, - l.ProfileId6, - l.ProfileId7, - l.ProfileId8, - l.ProfileId9, - l.ProfileId10, - l.ProfileId11, - l.ProfileId12, - l.ProfileId13, - l.ProfileId14, - l.ExtraProperty - }); + l.ProfileId, + l.ProfileId1, + l.ProfileId3, + l.ProfileId4, + l.ProfileId5, + l.ProfileId6, + l.ProfileId7, + l.ProfileId8, + l.ProfileId9, + l.ProfileId10, + l.ProfileId11, + l.ProfileId12, + l.ProfileId13, + l.ProfileId14, + l.ExtraProperty }); + }); modelBuilder .Entity< LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWorkingCorrectlyDetails - >( - eb => - { - eb.HasKey(l => new { l.ProfileId }); - eb.HasOne(d => d.Login).WithOne() - .HasForeignKey< - LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWorkingCorrectlyDetails - >( - l => new - { - l.ProfileId, - l.ProfileId1, - l.ProfileId3, - l.ProfileId4, - l.ProfileId5, - l.ProfileId6, - l.ProfileId7, - l.ProfileId8, - l.ProfileId9, - l.ProfileId10, - l.ProfileId11, - l.ProfileId12, - l.ProfileId13, - l.ProfileId14 - }); - }); - - modelBuilder.Entity( - pb => + >(eb => { - pb.HasKey( - l => new + eb.HasKey(l => new { l.ProfileId }); + eb.HasOne(d => d.Login).WithOne() + .HasForeignKey< + LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWorkingCorrectlyDetails + >(l => new { - l.Id, - l.Id1, - l.Id3, - l.Id4, - l.Id5, - l.Id6, - l.Id7, - l.Id8, - l.Id9, - l.Id10, - l.Id11, - l.Id12, - l.Id13, - l.Id14 + l.ProfileId, + l.ProfileId1, + l.ProfileId3, + l.ProfileId4, + l.ProfileId5, + l.ProfileId6, + l.ProfileId7, + l.ProfileId8, + l.ProfileId9, + l.ProfileId10, + l.ProfileId11, + l.ProfileId12, + l.ProfileId13, + l.ProfileId14 }); - pb.HasOne(p => p.User) - .WithOne(l => l.Profile) - .IsRequired(); }); + modelBuilder.Entity(pb => + { + pb.HasKey(l => new + { + l.Id, + l.Id1, + l.Id3, + l.Id4, + l.Id5, + l.Id6, + l.Id7, + l.Id8, + l.Id9, + l.Id10, + l.Id11, + l.Id12, + l.Id13, + l.Id14 + }); + pb.HasOne(p => p.User) + .WithOne(l => l.Profile) + .IsRequired(); + }); + modelBuilder.Entity(); modelBuilder.Entity().HasOne().WithOne(x => x.Obscurer).HasForeignKey(e => e.Id); modelBuilder.Entity(); diff --git a/test/EFCore.Specification.Tests/ValueConvertersEndToEndTestBase.cs b/test/EFCore.Specification.Tests/ValueConvertersEndToEndTestBase.cs index 8e2a5415816..7225ce9302a 100644 --- a/test/EFCore.Specification.Tests/ValueConvertersEndToEndTestBase.cs +++ b/test/EFCore.Specification.Tests/ValueConvertersEndToEndTestBase.cs @@ -156,10 +156,7 @@ public abstract class ValueConvertersEndToEndTestBase(TFixture fixture { typeof(TimeSpan), [_timeSpan1.ToString(), _timeSpan2.ToString(), _timeSpan1.ToString(), _timeSpan2.ToString()] }, }; - [ConditionalTheory] - [InlineData(new[] { 0, 1, 2, 3 })] - [InlineData(new[] { 3, 2, 1, 0 })] - [InlineData(new[] { 0, 2, 0, 2 })] + [ConditionalTheory, InlineData(new[] { 0, 1, 2, 3 }), InlineData(new[] { 3, 2, 1, 0 }), InlineData(new[] { 0, 2, 0, 2 })] public virtual async Task Can_insert_and_read_back_with_conversions(int[] valueOrder) { var id = Guid.Empty; @@ -668,214 +665,212 @@ protected override string StoreName => "ValueConvertersEndToEnd"; public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) - => base.AddOptions(builder).ConfigureWarnings( - w => w.Ignore( - CoreEventId.MappedEntityTypeIgnoredWarning, - CoreEventId.MappedPropertyIgnoredWarning, - CoreEventId.MappedNavigationIgnoredWarning)); + => base.AddOptions(builder).ConfigureWarnings(w => w.Ignore( + CoreEventId.MappedEntityTypeIgnoredWarning, + CoreEventId.MappedPropertyIgnoredWarning, + CoreEventId.MappedNavigationIgnoredWarning)); protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) - => modelBuilder.Entity( - b => - { - b.Property(e => e.BoolAsChar).HasConversion(new BoolToTwoValuesConverter('O', 'N')); - b.Property(e => e.BoolAsNullableChar).HasConversion(new BoolToTwoValuesConverter('O', 'N')); - b.Property(e => e.NullableBoolAsChar).HasConversion(new BoolToTwoValuesConverter('O', 'N')); - b.Property(e => e.NullableBoolAsNullableChar).HasConversion(new BoolToTwoValuesConverter('O', 'N')); - - b.Property(e => e.BoolAsString).HasConversion(new BoolToStringConverter("Non", "Oui")); - b.Property(e => e.BoolAsNullableString).HasConversion( - new BoolToTwoValuesConverter("Non", "Oui", mappingHints: new ConverterMappingHints(size: 3))); - b.Property(e => e.NullableBoolAsString).HasConversion(new BoolToStringConverter("Non", "Oui")); - b.Property(e => e.NullableBoolAsNullableString).HasConversion( - new BoolToTwoValuesConverter("Non", "Oui", mappingHints: new ConverterMappingHints(size: 3))); - - b.Property(e => e.BoolAsInt).HasConversion(new BoolToZeroOneConverter()); - b.Property(e => e.BoolAsNullableInt).HasConversion(new BoolToZeroOneConverter()); - b.Property(e => e.NullableBoolAsInt).HasConversion(new BoolToZeroOneConverter()); - b.Property(e => e.NullableBoolAsNullableInt).HasConversion(new BoolToZeroOneConverter()); - - b.Property(e => e.IntAsLong).HasConversion(new CastingConverter()); - b.Property(e => e.IntAsNullableLong).HasConversion(new CastingConverter()); - b.Property(e => e.NullableIntAsLong).HasConversion(new CastingConverter()); - b.Property(e => e.NullableIntAsNullableLong).HasConversion(new CastingConverter()); - - b.Property(e => e.BytesAsString).HasConversion( - (ValueConverter)new BytesToStringConverter(), new ArrayStructuralComparer()); - b.Property(e => e.BytesAsNullableString).HasConversion( - (ValueConverter)new BytesToStringConverter(), new ArrayStructuralComparer()); - b.Property(e => e.NullableBytesAsString).HasConversion( - new BytesToStringConverter(), new ArrayStructuralComparer()); - b.Property(e => e.NullableBytesAsNullableString).HasConversion( - new BytesToStringConverter(), new ArrayStructuralComparer()); - - b.Property(e => e.CharAsString).HasConversion(new CharToStringConverter()); - b.Property(e => e.NullableCharAsString).HasConversion(new CharToStringConverter()); - b.Property(e => e.CharAsNullableString).HasConversion(new CharToStringConverter()); - b.Property(e => e.NullableCharAsNullableString).HasConversion(new CharToStringConverter()); - - b.Property(e => e.DateTimeOffsetToBinary).HasConversion(new DateTimeOffsetToBinaryConverter()); - b.Property(e => e.DateTimeOffsetToNullableBinary).HasConversion(new DateTimeOffsetToBinaryConverter()); - b.Property(e => e.NullableDateTimeOffsetToBinary).HasConversion(new DateTimeOffsetToBinaryConverter()); - b.Property(e => e.NullableDateTimeOffsetToNullableBinary).HasConversion(new DateTimeOffsetToBinaryConverter()); - - b.Property(e => e.DateTimeOffsetToString).HasConversion(new DateTimeOffsetToStringConverter()); - b.Property(e => e.DateTimeOffsetToNullableString).HasConversion(new DateTimeOffsetToStringConverter()); - b.Property(e => e.NullableDateTimeOffsetToString).HasConversion(new DateTimeOffsetToStringConverter()); - b.Property(e => e.NullableDateTimeOffsetToNullableString).HasConversion(new DateTimeOffsetToStringConverter()); - - b.Property(e => e.DateTimeToBinary).HasConversion(new DateTimeToBinaryConverter()); - b.Property(e => e.DateTimeToNullableBinary).HasConversion(new DateTimeToBinaryConverter()); - b.Property(e => e.NullableDateTimeToBinary).HasConversion(new DateTimeToBinaryConverter()); - b.Property(e => e.NullableDateTimeToNullableBinary).HasConversion(new DateTimeToBinaryConverter()); - - b.Property(e => e.DateTimeToString).HasConversion(new DateTimeToStringConverter()); - b.Property(e => e.DateTimeToNullableString).HasConversion(new DateTimeToStringConverter()); - b.Property(e => e.NullableDateTimeToString).HasConversion(new DateTimeToStringConverter()); - b.Property(e => e.NullableDateTimeToNullableString).HasConversion(new DateTimeToStringConverter()); - - b.Property(e => e.DateOnlyToString).HasConversion(new DateOnlyToStringConverter()); - b.Property(e => e.DateOnlyToNullableString).HasConversion(new DateOnlyToStringConverter()); - b.Property(e => e.NullableDateOnlyToString).HasConversion(new DateOnlyToStringConverter()); - b.Property(e => e.NullableDateOnlyToNullableString).HasConversion(new DateOnlyToStringConverter()); - - b.Property(e => e.EnumToString).HasConversion(new EnumToStringConverter()); - b.Property(e => e.EnumToNullableString).HasConversion(new EnumToStringConverter()); - b.Property(e => e.NullableEnumToString).HasConversion(new EnumToStringConverter()); - b.Property(e => e.NullableEnumToNullableString).HasConversion(new EnumToStringConverter()); - - b.Property(e => e.EnumToNumber).HasConversion(new EnumToNumberConverter()); - b.Property(e => e.EnumToNullableNumber).HasConversion(new EnumToNumberConverter()); - b.Property(e => e.NullableEnumToNumber).HasConversion(new EnumToNumberConverter()); - b.Property(e => e.NullableEnumToNullableNumber).HasConversion(new EnumToNumberConverter()); - - b.Property(e => e.GuidToString).HasConversion(new GuidToStringConverter()); - b.Property(e => e.GuidToNullableString).HasConversion(new GuidToStringConverter()); - b.Property(e => e.NullableGuidToString).HasConversion(new GuidToStringConverter()); - b.Property(e => e.NullableGuidToNullableString).HasConversion(new GuidToStringConverter()); - - b.Property(e => e.GuidToBytes).HasConversion(new GuidToBytesConverter()); - b.Property(e => e.GuidToNullableBytes).HasConversion(new GuidToBytesConverter()); - b.Property(e => e.NullableGuidToBytes).HasConversion(new GuidToBytesConverter()); - b.Property(e => e.NullableGuidToNullableBytes).HasConversion(new GuidToBytesConverter()); - - b.Property(e => e.IPAddressToString).HasConversion((ValueConverter)new IPAddressToStringConverter()); - b.Property(e => e.IPAddressToNullableString).HasConversion((ValueConverter)new IPAddressToStringConverter()); - b.Property(e => e.NullableIPAddressToString).HasConversion(new IPAddressToStringConverter()); - b.Property(e => e.NullableIPAddressToNullableString).HasConversion(new IPAddressToStringConverter()); - - b.Property(e => e.IPAddressToBytes).HasConversion((ValueConverter)new IPAddressToBytesConverter()); - b.Property(e => e.IPAddressToNullableBytes).HasConversion((ValueConverter)new IPAddressToBytesConverter()); - b.Property(e => e.NullableIPAddressToBytes).HasConversion(new IPAddressToBytesConverter()); - b.Property(e => e.NullableIPAddressToNullableBytes).HasConversion(new IPAddressToBytesConverter()); - - b.Property(e => e.PhysicalAddressToString).HasConversion((ValueConverter)new PhysicalAddressToStringConverter()); - b.Property(e => e.PhysicalAddressToNullableString) - .HasConversion((ValueConverter)new PhysicalAddressToStringConverter()); - b.Property(e => e.NullablePhysicalAddressToString).HasConversion(new PhysicalAddressToStringConverter()); - b.Property(e => e.NullablePhysicalAddressToNullableString).HasConversion(new PhysicalAddressToStringConverter()); - - b.Property(e => e.PhysicalAddressToBytes).HasConversion((ValueConverter)new PhysicalAddressToBytesConverter()); - b.Property(e => e.PhysicalAddressToNullableBytes) - .HasConversion((ValueConverter)new PhysicalAddressToBytesConverter()); - b.Property(e => e.NullablePhysicalAddressToBytes).HasConversion(new PhysicalAddressToBytesConverter()); - b.Property(e => e.NullablePhysicalAddressToNullableBytes).HasConversion(new PhysicalAddressToBytesConverter()); - - b.Property(e => e.NumberToString).HasConversion(new NumberToStringConverter()); - b.Property(e => e.NumberToNullableString).HasConversion(new NumberToStringConverter()); - b.Property(e => e.NullableNumberToString).HasConversion(new NumberToStringConverter()); - b.Property(e => e.NullableNumberToNullableString).HasConversion(new NumberToStringConverter()); - - b.Property(e => e.NumberToBytes).HasConversion(new NumberToBytesConverter()); - b.Property(e => e.NumberToNullableBytes).HasConversion(new NumberToBytesConverter()); - b.Property(e => e.NullableNumberToBytes).HasConversion(new NumberToBytesConverter()); - b.Property(e => e.NullableNumberToNullableBytes).HasConversion(new NumberToBytesConverter()); - - b.Property(e => e.StringToBool).HasConversion(new StringToBoolConverter()); - b.Property(e => e.StringToNullableBool).HasConversion(new StringToBoolConverter()); - b.Property(e => e.NullableStringToBool).HasConversion((ValueConverter)new StringToBoolConverter()); - b.Property(e => e.NullableStringToNullableBool).HasConversion((ValueConverter)new StringToBoolConverter()); - - b.Property(e => e.StringToBytes).HasConversion((ValueConverter)new StringToBytesConverter(Encoding.UTF32)); - b.Property(e => e.StringToNullableBytes).HasConversion((ValueConverter)new StringToBytesConverter(Encoding.UTF32)); - b.Property(e => e.NullableStringToBytes).HasConversion(new StringToBytesConverter(Encoding.UTF32)); - b.Property(e => e.NullableStringToNullableBytes).HasConversion(new StringToBytesConverter(Encoding.UTF32)); - - b.Property(e => e.StringToChar).HasConversion(new StringToCharConverter()); - b.Property(e => e.StringToNullableChar).HasConversion(new StringToCharConverter()); - b.Property(e => e.NullableStringToChar).HasConversion((ValueConverter)new StringToCharConverter()); - b.Property(e => e.NullableStringToNullableChar).HasConversion((ValueConverter)new StringToCharConverter()); - - b.Property(e => e.StringToDateTime).HasConversion(new StringToDateTimeConverter()); - b.Property(e => e.StringToNullableDateTime).HasConversion(new StringToDateTimeConverter()); - b.Property(e => e.NullableStringToDateTime).HasConversion((ValueConverter)new StringToDateTimeConverter()); - b.Property(e => e.NullableStringToNullableDateTime).HasConversion((ValueConverter)new StringToDateTimeConverter()); - - b.Property(e => e.StringToDateTimeOffset).HasConversion(new StringToDateTimeOffsetConverter()); - b.Property(e => e.StringToNullableDateTimeOffset).HasConversion(new StringToDateTimeOffsetConverter()); - b.Property(e => e.NullableStringToDateTimeOffset) - .HasConversion((ValueConverter)new StringToDateTimeOffsetConverter()); - b.Property(e => e.NullableStringToNullableDateTimeOffset) - .HasConversion((ValueConverter)new StringToDateTimeOffsetConverter()); - - b.Property(e => e.StringToEnum).HasConversion(new StringToEnumConverter()); - b.Property(e => e.StringToNullableEnum).HasConversion(new StringToEnumConverter()); - b.Property(e => e.NullableStringToEnum).HasConversion((ValueConverter)new StringToEnumConverter()); - b.Property(e => e.NullableStringToNullableEnum) - .HasConversion((ValueConverter)new StringToEnumConverter()); - - b.Property(e => e.StringToGuid).HasConversion(new StringToGuidConverter()); - b.Property(e => e.StringToNullableGuid).HasConversion(new StringToGuidConverter()); - b.Property(e => e.NullableStringToGuid).HasConversion((ValueConverter)new StringToGuidConverter()); - b.Property(e => e.NullableStringToNullableGuid).HasConversion((ValueConverter)new StringToGuidConverter()); - - b.Property(e => e.StringToNumber).HasConversion(new StringToNumberConverter()); - b.Property(e => e.StringToNullableNumber).HasConversion(new StringToNumberConverter()); - b.Property(e => e.NullableStringToNumber).HasConversion((ValueConverter)new StringToNumberConverter()); - b.Property(e => e.NullableStringToNullableNumber) - .HasConversion((ValueConverter)new StringToNumberConverter()); - - b.Property(e => e.StringToTimeSpan).HasConversion(new StringToTimeSpanConverter()); - b.Property(e => e.StringToNullableTimeSpan).HasConversion(new StringToTimeSpanConverter()); - b.Property(e => e.NullableStringToTimeSpan).HasConversion((ValueConverter)new StringToTimeSpanConverter()); - b.Property(e => e.NullableStringToNullableTimeSpan).HasConversion((ValueConverter)new StringToTimeSpanConverter()); - - b.Property(e => e.TimeSpanToTicks).HasConversion(new TimeSpanToTicksConverter()); - b.Property(e => e.TimeSpanToNullableTicks).HasConversion(new TimeSpanToTicksConverter()); - b.Property(e => e.NullableTimeSpanToTicks).HasConversion(new TimeSpanToTicksConverter()); - b.Property(e => e.NullableTimeSpanToNullableTicks).HasConversion(new TimeSpanToTicksConverter()); - - b.Property(e => e.TimeSpanToString).HasConversion(new TimeSpanToStringConverter()); - b.Property(e => e.TimeSpanToNullableString).HasConversion(new TimeSpanToStringConverter()); - b.Property(e => e.NullableTimeSpanToString).HasConversion(new TimeSpanToStringConverter()); - b.Property(e => e.NullableTimeSpanToNullableString).HasConversion(new TimeSpanToStringConverter()); - - b.Property(e => e.UriToString).HasConversion((ValueConverter)new UriToStringConverter()); - b.Property(e => e.UriToNullableString).HasConversion((ValueConverter)new UriToStringConverter()); - b.Property(e => e.NullableUriToString).HasConversion(new UriToStringConverter()); - b.Property(e => e.NullableUriToNullableString).HasConversion(new UriToStringConverter()); - - b.Property(e => e.NonNullIntToNullString).HasConversion(new NonNullIntToNullStringConverter()); - b.Property(e => e.NonNullIntToNonNullString).HasConversion(new NonNullIntToNonNullStringConverter()); - b.Property(e => e.NullIntToNullString).HasConversion(new NullIntToNullStringConverter()).IsRequired(false); - b.Property(e => e.NullIntToNonNullString).HasConversion(new NullIntToNonNullStringConverter()).IsRequired(false); - - b.Property(e => e.NullStringToNonNullString).HasConversion(new NullStringToNonNullStringConverter()).IsRequired(); - b.Property(e => e.NonNullStringToNullString).HasConversion(new NonNullStringToNullStringConverter()) - .IsRequired(false); - - b.Property(e => e.NullableListOfInt).HasConversion( - (ValueConverter?)new ListOfIntToJsonConverter(), new ListOfIntComparer()); - - b.Property(e => e.ListOfInt).HasConversion( - new ListOfIntToJsonConverter(), new ListOfIntComparer()); - - b.Property(e => e.NullableEnumerableOfInt).HasConversion( - (ValueConverter?)new EnumerableOfIntToJsonConverter(), new EnumerableOfIntComparer()); - - b.Property(e => e.EnumerableOfInt).HasConversion( - new EnumerableOfIntToJsonConverter(), new EnumerableOfIntComparer()); - }); + => modelBuilder.Entity(b => + { + b.Property(e => e.BoolAsChar).HasConversion(new BoolToTwoValuesConverter('O', 'N')); + b.Property(e => e.BoolAsNullableChar).HasConversion(new BoolToTwoValuesConverter('O', 'N')); + b.Property(e => e.NullableBoolAsChar).HasConversion(new BoolToTwoValuesConverter('O', 'N')); + b.Property(e => e.NullableBoolAsNullableChar).HasConversion(new BoolToTwoValuesConverter('O', 'N')); + + b.Property(e => e.BoolAsString).HasConversion(new BoolToStringConverter("Non", "Oui")); + b.Property(e => e.BoolAsNullableString).HasConversion( + new BoolToTwoValuesConverter("Non", "Oui", mappingHints: new ConverterMappingHints(size: 3))); + b.Property(e => e.NullableBoolAsString).HasConversion(new BoolToStringConverter("Non", "Oui")); + b.Property(e => e.NullableBoolAsNullableString).HasConversion( + new BoolToTwoValuesConverter("Non", "Oui", mappingHints: new ConverterMappingHints(size: 3))); + + b.Property(e => e.BoolAsInt).HasConversion(new BoolToZeroOneConverter()); + b.Property(e => e.BoolAsNullableInt).HasConversion(new BoolToZeroOneConverter()); + b.Property(e => e.NullableBoolAsInt).HasConversion(new BoolToZeroOneConverter()); + b.Property(e => e.NullableBoolAsNullableInt).HasConversion(new BoolToZeroOneConverter()); + + b.Property(e => e.IntAsLong).HasConversion(new CastingConverter()); + b.Property(e => e.IntAsNullableLong).HasConversion(new CastingConverter()); + b.Property(e => e.NullableIntAsLong).HasConversion(new CastingConverter()); + b.Property(e => e.NullableIntAsNullableLong).HasConversion(new CastingConverter()); + + b.Property(e => e.BytesAsString).HasConversion( + (ValueConverter)new BytesToStringConverter(), new ArrayStructuralComparer()); + b.Property(e => e.BytesAsNullableString).HasConversion( + (ValueConverter)new BytesToStringConverter(), new ArrayStructuralComparer()); + b.Property(e => e.NullableBytesAsString).HasConversion( + new BytesToStringConverter(), new ArrayStructuralComparer()); + b.Property(e => e.NullableBytesAsNullableString).HasConversion( + new BytesToStringConverter(), new ArrayStructuralComparer()); + + b.Property(e => e.CharAsString).HasConversion(new CharToStringConverter()); + b.Property(e => e.NullableCharAsString).HasConversion(new CharToStringConverter()); + b.Property(e => e.CharAsNullableString).HasConversion(new CharToStringConverter()); + b.Property(e => e.NullableCharAsNullableString).HasConversion(new CharToStringConverter()); + + b.Property(e => e.DateTimeOffsetToBinary).HasConversion(new DateTimeOffsetToBinaryConverter()); + b.Property(e => e.DateTimeOffsetToNullableBinary).HasConversion(new DateTimeOffsetToBinaryConverter()); + b.Property(e => e.NullableDateTimeOffsetToBinary).HasConversion(new DateTimeOffsetToBinaryConverter()); + b.Property(e => e.NullableDateTimeOffsetToNullableBinary).HasConversion(new DateTimeOffsetToBinaryConverter()); + + b.Property(e => e.DateTimeOffsetToString).HasConversion(new DateTimeOffsetToStringConverter()); + b.Property(e => e.DateTimeOffsetToNullableString).HasConversion(new DateTimeOffsetToStringConverter()); + b.Property(e => e.NullableDateTimeOffsetToString).HasConversion(new DateTimeOffsetToStringConverter()); + b.Property(e => e.NullableDateTimeOffsetToNullableString).HasConversion(new DateTimeOffsetToStringConverter()); + + b.Property(e => e.DateTimeToBinary).HasConversion(new DateTimeToBinaryConverter()); + b.Property(e => e.DateTimeToNullableBinary).HasConversion(new DateTimeToBinaryConverter()); + b.Property(e => e.NullableDateTimeToBinary).HasConversion(new DateTimeToBinaryConverter()); + b.Property(e => e.NullableDateTimeToNullableBinary).HasConversion(new DateTimeToBinaryConverter()); + + b.Property(e => e.DateTimeToString).HasConversion(new DateTimeToStringConverter()); + b.Property(e => e.DateTimeToNullableString).HasConversion(new DateTimeToStringConverter()); + b.Property(e => e.NullableDateTimeToString).HasConversion(new DateTimeToStringConverter()); + b.Property(e => e.NullableDateTimeToNullableString).HasConversion(new DateTimeToStringConverter()); + + b.Property(e => e.DateOnlyToString).HasConversion(new DateOnlyToStringConverter()); + b.Property(e => e.DateOnlyToNullableString).HasConversion(new DateOnlyToStringConverter()); + b.Property(e => e.NullableDateOnlyToString).HasConversion(new DateOnlyToStringConverter()); + b.Property(e => e.NullableDateOnlyToNullableString).HasConversion(new DateOnlyToStringConverter()); + + b.Property(e => e.EnumToString).HasConversion(new EnumToStringConverter()); + b.Property(e => e.EnumToNullableString).HasConversion(new EnumToStringConverter()); + b.Property(e => e.NullableEnumToString).HasConversion(new EnumToStringConverter()); + b.Property(e => e.NullableEnumToNullableString).HasConversion(new EnumToStringConverter()); + + b.Property(e => e.EnumToNumber).HasConversion(new EnumToNumberConverter()); + b.Property(e => e.EnumToNullableNumber).HasConversion(new EnumToNumberConverter()); + b.Property(e => e.NullableEnumToNumber).HasConversion(new EnumToNumberConverter()); + b.Property(e => e.NullableEnumToNullableNumber).HasConversion(new EnumToNumberConverter()); + + b.Property(e => e.GuidToString).HasConversion(new GuidToStringConverter()); + b.Property(e => e.GuidToNullableString).HasConversion(new GuidToStringConverter()); + b.Property(e => e.NullableGuidToString).HasConversion(new GuidToStringConverter()); + b.Property(e => e.NullableGuidToNullableString).HasConversion(new GuidToStringConverter()); + + b.Property(e => e.GuidToBytes).HasConversion(new GuidToBytesConverter()); + b.Property(e => e.GuidToNullableBytes).HasConversion(new GuidToBytesConverter()); + b.Property(e => e.NullableGuidToBytes).HasConversion(new GuidToBytesConverter()); + b.Property(e => e.NullableGuidToNullableBytes).HasConversion(new GuidToBytesConverter()); + + b.Property(e => e.IPAddressToString).HasConversion((ValueConverter)new IPAddressToStringConverter()); + b.Property(e => e.IPAddressToNullableString).HasConversion((ValueConverter)new IPAddressToStringConverter()); + b.Property(e => e.NullableIPAddressToString).HasConversion(new IPAddressToStringConverter()); + b.Property(e => e.NullableIPAddressToNullableString).HasConversion(new IPAddressToStringConverter()); + + b.Property(e => e.IPAddressToBytes).HasConversion((ValueConverter)new IPAddressToBytesConverter()); + b.Property(e => e.IPAddressToNullableBytes).HasConversion((ValueConverter)new IPAddressToBytesConverter()); + b.Property(e => e.NullableIPAddressToBytes).HasConversion(new IPAddressToBytesConverter()); + b.Property(e => e.NullableIPAddressToNullableBytes).HasConversion(new IPAddressToBytesConverter()); + + b.Property(e => e.PhysicalAddressToString).HasConversion((ValueConverter)new PhysicalAddressToStringConverter()); + b.Property(e => e.PhysicalAddressToNullableString) + .HasConversion((ValueConverter)new PhysicalAddressToStringConverter()); + b.Property(e => e.NullablePhysicalAddressToString).HasConversion(new PhysicalAddressToStringConverter()); + b.Property(e => e.NullablePhysicalAddressToNullableString).HasConversion(new PhysicalAddressToStringConverter()); + + b.Property(e => e.PhysicalAddressToBytes).HasConversion((ValueConverter)new PhysicalAddressToBytesConverter()); + b.Property(e => e.PhysicalAddressToNullableBytes) + .HasConversion((ValueConverter)new PhysicalAddressToBytesConverter()); + b.Property(e => e.NullablePhysicalAddressToBytes).HasConversion(new PhysicalAddressToBytesConverter()); + b.Property(e => e.NullablePhysicalAddressToNullableBytes).HasConversion(new PhysicalAddressToBytesConverter()); + + b.Property(e => e.NumberToString).HasConversion(new NumberToStringConverter()); + b.Property(e => e.NumberToNullableString).HasConversion(new NumberToStringConverter()); + b.Property(e => e.NullableNumberToString).HasConversion(new NumberToStringConverter()); + b.Property(e => e.NullableNumberToNullableString).HasConversion(new NumberToStringConverter()); + + b.Property(e => e.NumberToBytes).HasConversion(new NumberToBytesConverter()); + b.Property(e => e.NumberToNullableBytes).HasConversion(new NumberToBytesConverter()); + b.Property(e => e.NullableNumberToBytes).HasConversion(new NumberToBytesConverter()); + b.Property(e => e.NullableNumberToNullableBytes).HasConversion(new NumberToBytesConverter()); + + b.Property(e => e.StringToBool).HasConversion(new StringToBoolConverter()); + b.Property(e => e.StringToNullableBool).HasConversion(new StringToBoolConverter()); + b.Property(e => e.NullableStringToBool).HasConversion((ValueConverter)new StringToBoolConverter()); + b.Property(e => e.NullableStringToNullableBool).HasConversion((ValueConverter)new StringToBoolConverter()); + + b.Property(e => e.StringToBytes).HasConversion((ValueConverter)new StringToBytesConverter(Encoding.UTF32)); + b.Property(e => e.StringToNullableBytes).HasConversion((ValueConverter)new StringToBytesConverter(Encoding.UTF32)); + b.Property(e => e.NullableStringToBytes).HasConversion(new StringToBytesConverter(Encoding.UTF32)); + b.Property(e => e.NullableStringToNullableBytes).HasConversion(new StringToBytesConverter(Encoding.UTF32)); + + b.Property(e => e.StringToChar).HasConversion(new StringToCharConverter()); + b.Property(e => e.StringToNullableChar).HasConversion(new StringToCharConverter()); + b.Property(e => e.NullableStringToChar).HasConversion((ValueConverter)new StringToCharConverter()); + b.Property(e => e.NullableStringToNullableChar).HasConversion((ValueConverter)new StringToCharConverter()); + + b.Property(e => e.StringToDateTime).HasConversion(new StringToDateTimeConverter()); + b.Property(e => e.StringToNullableDateTime).HasConversion(new StringToDateTimeConverter()); + b.Property(e => e.NullableStringToDateTime).HasConversion((ValueConverter)new StringToDateTimeConverter()); + b.Property(e => e.NullableStringToNullableDateTime).HasConversion((ValueConverter)new StringToDateTimeConverter()); + + b.Property(e => e.StringToDateTimeOffset).HasConversion(new StringToDateTimeOffsetConverter()); + b.Property(e => e.StringToNullableDateTimeOffset).HasConversion(new StringToDateTimeOffsetConverter()); + b.Property(e => e.NullableStringToDateTimeOffset) + .HasConversion((ValueConverter)new StringToDateTimeOffsetConverter()); + b.Property(e => e.NullableStringToNullableDateTimeOffset) + .HasConversion((ValueConverter)new StringToDateTimeOffsetConverter()); + + b.Property(e => e.StringToEnum).HasConversion(new StringToEnumConverter()); + b.Property(e => e.StringToNullableEnum).HasConversion(new StringToEnumConverter()); + b.Property(e => e.NullableStringToEnum).HasConversion((ValueConverter)new StringToEnumConverter()); + b.Property(e => e.NullableStringToNullableEnum) + .HasConversion((ValueConverter)new StringToEnumConverter()); + + b.Property(e => e.StringToGuid).HasConversion(new StringToGuidConverter()); + b.Property(e => e.StringToNullableGuid).HasConversion(new StringToGuidConverter()); + b.Property(e => e.NullableStringToGuid).HasConversion((ValueConverter)new StringToGuidConverter()); + b.Property(e => e.NullableStringToNullableGuid).HasConversion((ValueConverter)new StringToGuidConverter()); + + b.Property(e => e.StringToNumber).HasConversion(new StringToNumberConverter()); + b.Property(e => e.StringToNullableNumber).HasConversion(new StringToNumberConverter()); + b.Property(e => e.NullableStringToNumber).HasConversion((ValueConverter)new StringToNumberConverter()); + b.Property(e => e.NullableStringToNullableNumber) + .HasConversion((ValueConverter)new StringToNumberConverter()); + + b.Property(e => e.StringToTimeSpan).HasConversion(new StringToTimeSpanConverter()); + b.Property(e => e.StringToNullableTimeSpan).HasConversion(new StringToTimeSpanConverter()); + b.Property(e => e.NullableStringToTimeSpan).HasConversion((ValueConverter)new StringToTimeSpanConverter()); + b.Property(e => e.NullableStringToNullableTimeSpan).HasConversion((ValueConverter)new StringToTimeSpanConverter()); + + b.Property(e => e.TimeSpanToTicks).HasConversion(new TimeSpanToTicksConverter()); + b.Property(e => e.TimeSpanToNullableTicks).HasConversion(new TimeSpanToTicksConverter()); + b.Property(e => e.NullableTimeSpanToTicks).HasConversion(new TimeSpanToTicksConverter()); + b.Property(e => e.NullableTimeSpanToNullableTicks).HasConversion(new TimeSpanToTicksConverter()); + + b.Property(e => e.TimeSpanToString).HasConversion(new TimeSpanToStringConverter()); + b.Property(e => e.TimeSpanToNullableString).HasConversion(new TimeSpanToStringConverter()); + b.Property(e => e.NullableTimeSpanToString).HasConversion(new TimeSpanToStringConverter()); + b.Property(e => e.NullableTimeSpanToNullableString).HasConversion(new TimeSpanToStringConverter()); + + b.Property(e => e.UriToString).HasConversion((ValueConverter)new UriToStringConverter()); + b.Property(e => e.UriToNullableString).HasConversion((ValueConverter)new UriToStringConverter()); + b.Property(e => e.NullableUriToString).HasConversion(new UriToStringConverter()); + b.Property(e => e.NullableUriToNullableString).HasConversion(new UriToStringConverter()); + + b.Property(e => e.NonNullIntToNullString).HasConversion(new NonNullIntToNullStringConverter()); + b.Property(e => e.NonNullIntToNonNullString).HasConversion(new NonNullIntToNonNullStringConverter()); + b.Property(e => e.NullIntToNullString).HasConversion(new NullIntToNullStringConverter()).IsRequired(false); + b.Property(e => e.NullIntToNonNullString).HasConversion(new NullIntToNonNullStringConverter()).IsRequired(false); + + b.Property(e => e.NullStringToNonNullString).HasConversion(new NullStringToNonNullStringConverter()).IsRequired(); + b.Property(e => e.NonNullStringToNullString).HasConversion(new NonNullStringToNullStringConverter()) + .IsRequired(false); + + b.Property(e => e.NullableListOfInt).HasConversion( + (ValueConverter?)new ListOfIntToJsonConverter(), new ListOfIntComparer()); + + b.Property(e => e.ListOfInt).HasConversion( + new ListOfIntToJsonConverter(), new ListOfIntComparer()); + + b.Property(e => e.NullableEnumerableOfInt).HasConversion( + (ValueConverter?)new EnumerableOfIntToJsonConverter(), new EnumerableOfIntComparer()); + + b.Property(e => e.EnumerableOfInt).HasConversion( + new EnumerableOfIntToJsonConverter(), new EnumerableOfIntComparer()); + }); } protected class NullStringToNonNullStringConverter() : ValueConverter( diff --git a/test/EFCore.Specification.Tests/WithConstructorsTestBase.cs b/test/EFCore.Specification.Tests/WithConstructorsTestBase.cs index 018a307eef4..fa28a273ecf 100644 --- a/test/EFCore.Specification.Tests/WithConstructorsTestBase.cs +++ b/test/EFCore.Specification.Tests/WithConstructorsTestBase.cs @@ -1551,25 +1551,22 @@ protected override string StoreName protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) { - modelBuilder.Entity( - b => - { - b.Property(e => e.Title); - }); - - modelBuilder.Entity( - b => - { - b.HasNoKey(); - b.Property(e => e.Title); - }); - - modelBuilder.Entity( - b => - { - b.HasKey("_id"); - b.Property(e => e.Title); - }); + modelBuilder.Entity(b => + { + b.Property(e => e.Title); + }); + + modelBuilder.Entity(b => + { + b.HasNoKey(); + b.Property(e => e.Title); + }); + + modelBuilder.Entity(b => + { + b.HasKey("_id"); + b.Property(e => e.Title); + }); modelBuilder.Entity>(); modelBuilder.Entity>();