diff --git a/test/EFCore.SqlServer.FunctionalTests/BuiltInDataTypesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BuiltInDataTypesSqlServerTest.cs index 373acaf35b6..4fd50b1c877 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BuiltInDataTypesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BuiltInDataTypesSqlServerTest.cs @@ -46,12 +46,11 @@ var results .ToList(); Assert.Equal(0, results.Count); - Assert.Equal( + + AssertSql( @"SELECT [m].[Int] FROM [MappedNullableDataTypes] AS [m] -WHERE ([m].[TimeSpanAsTime] = '00:01:02') AND [m].[TimeSpanAsTime] IS NOT NULL", - Sql, - ignoreLineEndingDifferences: true); +WHERE ([m].[TimeSpanAsTime] = '00:01:02') AND [m].[TimeSpanAsTime] IS NOT NULL"); } } @@ -65,12 +64,10 @@ public void Translate_array_length() .Select(p => p.BytesAsImage.Length) .FirstOrDefault(); - Assert.Equal( + AssertSql( @"SELECT TOP(1) CAST(DATALENGTH([p].[BytesAsImage]) AS int) FROM [MappedDataTypesWithIdentity] AS [p] -WHERE CAST(DATALENGTH([p].[BytesAsImage]) AS int) = 0", - Sql, - ignoreLineEndingDifferences: true); +WHERE CAST(DATALENGTH([p].[BytesAsImage]) AS int) = 0"); } } @@ -88,14 +85,12 @@ var results .ToList(); Assert.Equal(0, results.Count); - Assert.Equal( + AssertSql( @"@__timeSpan_0='02:01:00' (Nullable = true) SELECT [m].[Int] FROM [MappedNullableDataTypes] AS [m] -WHERE (([m].[TimeSpanAsTime] = @__timeSpan_0) AND ([m].[TimeSpanAsTime] IS NOT NULL AND @__timeSpan_0 IS NOT NULL)) OR ([m].[TimeSpanAsTime] IS NULL AND @__timeSpan_0 IS NULL)", - Sql, - ignoreLineEndingDifferences: true); +WHERE (([m].[TimeSpanAsTime] = @__timeSpan_0) AND ([m].[TimeSpanAsTime] IS NOT NULL AND @__timeSpan_0 IS NOT NULL)) OR ([m].[TimeSpanAsTime] IS NULL AND @__timeSpan_0 IS NULL)"); } } @@ -113,14 +108,12 @@ var results .ToList(); Assert.Equal(0, results.Count); - Assert.Equal( + AssertSql( @"@__timeSpan_1='02:01:00' (Nullable = true) SELECT [m].[Int] FROM [MappedNullableDataTypes] AS [m] -WHERE (DATEDIFF(HOUR, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(HOUR, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL", - Sql, - ignoreLineEndingDifferences: true); +WHERE (DATEDIFF(HOUR, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(HOUR, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL"); } } @@ -138,14 +131,12 @@ var results .ToList(); Assert.Equal(0, results.Count); - Assert.Equal( + AssertSql( @"@__timeSpan_1='02:01:00' (Nullable = true) SELECT [m].[Int] FROM [MappedNullableDataTypes] AS [m] -WHERE (DATEDIFF(MINUTE, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(MINUTE, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL", - Sql, - ignoreLineEndingDifferences: true); +WHERE (DATEDIFF(MINUTE, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(MINUTE, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL"); } } @@ -163,14 +154,12 @@ var results .ToList(); Assert.Equal(0, results.Count); - Assert.Equal( + AssertSql( @"@__timeSpan_1='02:01:00' (Nullable = true) SELECT [m].[Int] FROM [MappedNullableDataTypes] AS [m] -WHERE (DATEDIFF(SECOND, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(SECOND, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL", - Sql, - ignoreLineEndingDifferences: true); +WHERE (DATEDIFF(SECOND, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(SECOND, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL"); } } @@ -188,14 +177,12 @@ var results .ToList(); Assert.Equal(0, results.Count); - Assert.Equal( + AssertSql( @"@__timeSpan_1='02:01:00' (Nullable = true) SELECT [m].[Int] FROM [MappedNullableDataTypes] AS [m] -WHERE (DATEDIFF(MILLISECOND, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(MILLISECOND, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL", - Sql, - ignoreLineEndingDifferences: true); +WHERE (DATEDIFF(MILLISECOND, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(MILLISECOND, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL"); } } @@ -213,14 +200,12 @@ var results .ToList(); Assert.Equal(0, results.Count); - Assert.Equal( + AssertSql( @"@__timeSpan_1='02:01:00' (Nullable = true) SELECT [m].[Int] FROM [MappedNullableDataTypes] AS [m] -WHERE (DATEDIFF(MICROSECOND, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(MICROSECOND, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL", - Sql, - ignoreLineEndingDifferences: true); +WHERE (DATEDIFF(MICROSECOND, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(MICROSECOND, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL"); } } @@ -238,14 +223,12 @@ var results .ToList(); Assert.Equal(0, results.Count); - Assert.Equal( + AssertSql( @"@__timeSpan_1='02:01:00' (Nullable = true) SELECT [m].[Int] FROM [MappedNullableDataTypes] AS [m] -WHERE (DATEDIFF(NANOSECOND, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(NANOSECOND, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL", - Sql, - ignoreLineEndingDifferences: true); +WHERE (DATEDIFF(NANOSECOND, [m].[TimeSpanAsTime], @__timeSpan_1) = 0) AND DATEDIFF(NANOSECOND, [m].[TimeSpanAsTime], @__timeSpan_1) IS NOT NULL"); } } @@ -3051,7 +3034,8 @@ const string query return actual; } - private string Sql => Fixture.TestSqlLoggerFactory.Sql; + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); public class BuiltInDataTypesSqlServerFixture : BuiltInDataTypesFixtureBase { diff --git a/test/EFCore.SqlServer.FunctionalTests/DataAnnotationSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/DataAnnotationSqlServerTest.cs index 4153f45ab76..7fc604f1f60 100644 --- a/test/EFCore.SqlServer.FunctionalTests/DataAnnotationSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/DataAnnotationSqlServerTest.cs @@ -147,7 +147,7 @@ public override void ConcurrencyCheckAttribute_throws_if_value_in_database_chang base.ConcurrencyCheckAttribute_throws_if_value_in_database_changed(); // Issue #15285 - /*Assert.Equal( + /*AssertSql( @"SELECT TOP(1) [r].[UniqueNo], [r].[MaxLengthProperty], [r].[Name], [r].[RowVersion], [t].[UniqueNo], [t].[Details_Name], [t0].[UniqueNo], [t0].[AdditionalDetails_Name] FROM [Sample] AS [r] LEFT JOIN ( @@ -194,16 +194,14 @@ WHERE [r.AdditionalDetails].[AdditionalDetails_Name] IS NOT NULL SET NOCOUNT ON; UPDATE [Sample] SET [Name] = @p0, [RowVersion] = @p1 WHERE [UniqueNo] = @p2 AND [RowVersion] = @p3; -SELECT @@ROWCOUNT;", - Sql, - ignoreLineEndingDifferences: true);*/ +SELECT @@ROWCOUNT;");*/ } public override void DatabaseGeneratedAttribute_autogenerates_values_when_set_to_identity() { base.DatabaseGeneratedAttribute_autogenerates_values_when_set_to_identity(); - Assert.Equal( + AssertSql( @"@p0='' (Size = 10) @p1='Third' (Nullable = false) (Size = 4000) @p2='00000000-0000-0000-0000-000000000003' @@ -215,16 +213,14 @@ INSERT INTO [Sample] ([MaxLengthProperty], [Name], [RowVersion], [AdditionalDeta VALUES (@p0, @p1, @p2, @p3, @p4); SELECT [UniqueNo] FROM [Sample] -WHERE @@ROWCOUNT = 1 AND [UniqueNo] = scope_identity();", - Sql, - ignoreLineEndingDifferences: true); +WHERE @@ROWCOUNT = 1 AND [UniqueNo] = scope_identity();"); } public override void MaxLengthAttribute_throws_while_inserting_value_longer_than_max_length() { base.MaxLengthAttribute_throws_while_inserting_value_longer_than_max_length(); - Assert.Equal( + AssertSql( @"@p0='Short' (Size = 10) @p1='ValidString' (Nullable = false) (Size = 4000) @p2='00000000-0000-0000-0000-000000000001' @@ -236,9 +232,9 @@ INSERT INTO [Sample] ([MaxLengthProperty], [Name], [RowVersion], [AdditionalDeta VALUES (@p0, @p1, @p2, @p3, @p4); SELECT [UniqueNo] FROM [Sample] -WHERE @@ROWCOUNT = 1 AND [UniqueNo] = scope_identity(); - -@p0='VeryVeryVeryVeryVeryVeryLongString' (Size = -1) +WHERE @@ROWCOUNT = 1 AND [UniqueNo] = scope_identity();", + // + @"@p0='VeryVeryVeryVeryVeryVeryLongString' (Size = -1) @p1='ValidString' (Nullable = false) (Size = 4000) @p2='00000000-0000-0000-0000-000000000002' @p3='Third Additional Name' (Size = 4000) @@ -249,29 +245,40 @@ INSERT INTO [Sample] ([MaxLengthProperty], [Name], [RowVersion], [AdditionalDeta VALUES (@p0, @p1, @p2, @p3, @p4); SELECT [UniqueNo] FROM [Sample] -WHERE @@ROWCOUNT = 1 AND [UniqueNo] = scope_identity();", - Sql, - ignoreLineEndingDifferences: true); +WHERE @@ROWCOUNT = 1 AND [UniqueNo] = scope_identity();"); } public override void RequiredAttribute_for_navigation_throws_while_inserting_null_value() { base.RequiredAttribute_for_navigation_throws_while_inserting_null_value(); - Assert.Contains( - "@p1='1'" + _eol, - Sql); + AssertSql( + @"@p0='' (DbType = Int32) +@p1='1' - Assert.Contains( - "@p1='' (Nullable = false) (DbType = Int32)" + _eol, - Sql); +SET NOCOUNT ON; +INSERT INTO [BookDetails] ([AdditionalBookDetailsId], [AnotherBookId]) +VALUES (@p0, @p1); +SELECT [Id] +FROM [BookDetails] +WHERE @@ROWCOUNT = 1 AND [Id] = scope_identity();", + // + @"@p0='' (DbType = Int32) +@p1='' (Nullable = false) (DbType = Int32) + +SET NOCOUNT ON; +INSERT INTO [BookDetails] ([AdditionalBookDetailsId], [AnotherBookId]) +VALUES (@p0, @p1); +SELECT [Id] +FROM [BookDetails] +WHERE @@ROWCOUNT = 1 AND [Id] = scope_identity();"); } public override void RequiredAttribute_for_property_throws_while_inserting_null_value() { base.RequiredAttribute_for_property_throws_while_inserting_null_value(); - Assert.Equal( + AssertSql( @"@p0='' (Size = 10) @p1='ValidString' (Nullable = false) (Size = 4000) @p2='00000000-0000-0000-0000-000000000001' @@ -283,9 +290,9 @@ INSERT INTO [Sample] ([MaxLengthProperty], [Name], [RowVersion], [AdditionalDeta VALUES (@p0, @p1, @p2, @p3, @p4); SELECT [UniqueNo] FROM [Sample] -WHERE @@ROWCOUNT = 1 AND [UniqueNo] = scope_identity(); - -@p0='' (Size = 10) +WHERE @@ROWCOUNT = 1 AND [UniqueNo] = scope_identity();", + // + @"@p0='' (Size = 10) @p1='' (Nullable = false) (Size = 4000) @p2='00000000-0000-0000-0000-000000000002' @p3='Two' (Size = 4000) @@ -296,16 +303,14 @@ INSERT INTO [Sample] ([MaxLengthProperty], [Name], [RowVersion], [AdditionalDeta VALUES (@p0, @p1, @p2, @p3, @p4); SELECT [UniqueNo] FROM [Sample] -WHERE @@ROWCOUNT = 1 AND [UniqueNo] = scope_identity();", - Sql, - ignoreLineEndingDifferences: true); +WHERE @@ROWCOUNT = 1 AND [UniqueNo] = scope_identity();"); } public override void StringLengthAttribute_throws_while_inserting_value_longer_than_max_length() { base.StringLengthAttribute_throws_while_inserting_value_longer_than_max_length(); - Assert.Equal( + AssertSql( @"@p0='ValidString' (Size = 16) SET NOCOUNT ON; @@ -313,18 +318,16 @@ INSERT INTO [Two] ([Data]) VALUES (@p0); SELECT [Id], [Timestamp] FROM [Two] -WHERE @@ROWCOUNT = 1 AND [Id] = scope_identity(); - -@p0='ValidButLongString' (Size = -1) +WHERE @@ROWCOUNT = 1 AND [Id] = scope_identity();", + // + @"@p0='ValidButLongString' (Size = -1) SET NOCOUNT ON; INSERT INTO [Two] ([Data]) VALUES (@p0); SELECT [Id], [Timestamp] FROM [Two] -WHERE @@ROWCOUNT = 1 AND [Id] = scope_identity();", - Sql, - ignoreLineEndingDifferences: true); +WHERE @@ROWCOUNT = 1 AND [Id] = scope_identity();"); } public override void TimestampAttribute_throws_if_value_in_database_changed() @@ -336,8 +339,8 @@ public override void TimestampAttribute_throws_if_value_in_database_changed() } private static readonly string _eol = Environment.NewLine; - - private string Sql => Fixture.TestSqlLoggerFactory.Sql; + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); public class DataAnnotationSqlServerFixture : DataAnnotationFixtureBase { diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlSprocQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlSprocQuerySqlServerTest.cs index 9372fb37058..65d66a5aaac 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlSprocQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlSprocQuerySqlServerTest.cs @@ -32,39 +32,31 @@ public override async Task From_sql_queryable_stored_procedure(bool async) { await base.From_sql_queryable_stored_procedure(async); - Assert.Equal( - "[dbo].[Ten Most Expensive Products]", - Sql); + AssertSql("[dbo].[Ten Most Expensive Products]"); } public override async Task From_sql_queryable_stored_procedure_projection(bool async) { await base.From_sql_queryable_stored_procedure_projection(async); - Assert.Equal( - "[dbo].[Ten Most Expensive Products]", - Sql); + AssertSql("[dbo].[Ten Most Expensive Products]"); } public override async Task From_sql_queryable_stored_procedure_with_parameter(bool async) { await base.From_sql_queryable_stored_procedure_with_parameter(async); - Assert.Equal( + AssertSql( @"p0='ALFKI' (Size = 4000) -[dbo].[CustOrderHist] @CustomerID = @p0", - Sql, - ignoreLineEndingDifferences: true); +[dbo].[CustOrderHist] @CustomerID = @p0"); } public override async Task From_sql_queryable_stored_procedure_re_projection_on_client(bool async) { await base.From_sql_queryable_stored_procedure_re_projection_on_client(async); - Assert.Equal( - "[dbo].[Ten Most Expensive Products]", - Sql); + AssertSql("[dbo].[Ten Most Expensive Products]"); } public override async Task From_sql_queryable_stored_procedure_re_projection(bool async) @@ -74,9 +66,7 @@ public override async Task From_sql_queryable_stored_procedure_composed_on_clien { await base.From_sql_queryable_stored_procedure_composed_on_client(async); - Assert.Equal( - "[dbo].[Ten Most Expensive Products]", - Sql); + AssertSql("[dbo].[Ten Most Expensive Products]"); } public override async Task From_sql_queryable_stored_procedure_composed(bool async) @@ -86,12 +76,10 @@ public override async Task From_sql_queryable_stored_procedure_with_parameter_co { await base.From_sql_queryable_stored_procedure_with_parameter_composed_on_client(async); - Assert.Equal( + AssertSql( @"p0='ALFKI' (Size = 4000) -[dbo].[CustOrderHist] @CustomerID = @p0", - Sql, - ignoreLineEndingDifferences: true); +[dbo].[CustOrderHist] @CustomerID = @p0"); } public override async Task From_sql_queryable_stored_procedure_with_parameter_composed(bool async) @@ -101,9 +89,7 @@ public override async Task From_sql_queryable_stored_procedure_take_on_client(bo { await base.From_sql_queryable_stored_procedure_take_on_client(async); - Assert.Equal( - "[dbo].[Ten Most Expensive Products]", - Sql); + AssertSql("[dbo].[Ten Most Expensive Products]"); } public override async Task From_sql_queryable_stored_procedure_take(bool async) @@ -113,9 +99,7 @@ public override async Task From_sql_queryable_stored_procedure_min_on_client(boo { await base.From_sql_queryable_stored_procedure_min_on_client(async); - Assert.Equal( - "[dbo].[Ten Most Expensive Products]", - Sql); + AssertSql("[dbo].[Ten Most Expensive Products]"); } public override async Task From_sql_queryable_stored_procedure_min(bool async) @@ -130,9 +114,8 @@ public override async Task From_sql_queryable_stored_procedure_and_se public override async Task From_sql_queryable_select_and_stored_procedure(bool async) => AssertSqlException(await base.From_sql_queryable_select_and_stored_procedure(async)); - private static readonly string _eol = Environment.NewLine; - - private string Sql => Fixture.TestSqlLoggerFactory.Sql; + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); protected override string TenMostExpensiveProductsSproc => "[dbo].[Ten Most Expensive Products]"; diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs index c0ac6bf36e0..5b7b0f0aa58 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs @@ -21,38 +21,35 @@ public override void String_ends_with_equals_nullable_column() { base.String_ends_with_equals_nullable_column(); - Assert.Equal( + AssertSql( @"SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool], [f0].[Id], [f0].[FirstName], [f0].[LastName], [f0].[NullableBool] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] WHERE (CASE WHEN (([f0].[LastName] = N'') AND [f0].[LastName] IS NOT NULL) OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (((RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]) AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) IS NOT NULL AND [f0].[LastName] IS NOT NULL)) OR (RIGHT([f].[FirstName], LEN([f0].[LastName])) IS NULL AND [f0].[LastName] IS NULL)))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END = [f].[NullableBool]) AND [f].[NullableBool] IS NOT NULL", - Sql, - ignoreLineEndingDifferences: true); +END = [f].[NullableBool]) AND [f].[NullableBool] IS NOT NULL"); } public override void String_ends_with_not_equals_nullable_column() { base.String_ends_with_not_equals_nullable_column(); - Assert.Equal( + AssertSql( @"SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool], [f0].[Id], [f0].[FirstName], [f0].[LastName], [f0].[NullableBool] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] WHERE (CASE WHEN (([f0].[LastName] = N'') AND [f0].[LastName] IS NOT NULL) OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (((RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]) AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) IS NOT NULL AND [f0].[LastName] IS NOT NULL)) OR (RIGHT([f].[FirstName], LEN([f0].[LastName])) IS NULL AND [f0].[LastName] IS NULL)))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END <> [f].[NullableBool]) OR [f].[NullableBool] IS NULL", - Sql, - ignoreLineEndingDifferences: true); +END <> [f].[NullableBool]) OR [f].[NullableBool] IS NULL"); } protected override void ClearLog() => Fixture.TestSqlLoggerFactory.Clear(); - private string Sql => Fixture.TestSqlLoggerFactory.Sql; + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); public class FunkyDataQuerySqlServerFixture : FunkyDataQueryFixtureBase { diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/IncludeOneToOneSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/IncludeOneToOneSqlServerTest.cs index 7d25b8867b4..fe8f89ceb6d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/IncludeOneToOneSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/IncludeOneToOneSqlServerTest.cs @@ -19,51 +19,44 @@ public override void Include_person() { base.Include_person(); -// Assert.Equal( -// @"SELECT [a].[Id], [a].[City], [a].[Street], [a.Resident].[Id], [a.Resident].[Name] -//FROM [Address] AS [a] -//INNER JOIN [Person] AS [a.Resident] ON [a].[Id] = [a.Resident].[Id]", -// Sql, -// ignoreLineEndingDifferences: true); + AssertSql( + @"SELECT [a].[Id], [a].[City], [a].[Street], [p].[Id], [p].[Name] +FROM [Address] AS [a] +INNER JOIN [Person] AS [p] ON [a].[Id] = [p].[Id]"); } public override void Include_person_shadow() { base.Include_person_shadow(); -// Assert.Equal( -// @"SELECT [a].[Id], [a].[City], [a].[PersonId], [a].[Street], [a.Resident].[Id], [a.Resident].[Name] -//FROM [Address2] AS [a] -//INNER JOIN [Person2] AS [a.Resident] ON [a].[PersonId] = [a.Resident].[Id]", -// Sql, -// ignoreLineEndingDifferences: true); + AssertSql( + @"SELECT [a].[Id], [a].[City], [a].[PersonId], [a].[Street], [p].[Id], [p].[Name] +FROM [Address2] AS [a] +INNER JOIN [Person2] AS [p] ON [a].[PersonId] = [p].[Id]"); } public override void Include_address() { base.Include_address(); -// Assert.Equal( -// @"SELECT [p].[Id], [p].[Name], [p.Address].[Id], [p.Address].[City], [p.Address].[Street] -//FROM [Person] AS [p] -//LEFT JOIN [Address] AS [p.Address] ON [p].[Id] = [p.Address].[Id]", -// Sql, -// ignoreLineEndingDifferences: true); + AssertSql( + @"SELECT [p].[Id], [p].[Name], [a].[Id], [a].[City], [a].[Street] +FROM [Person] AS [p] +LEFT JOIN [Address] AS [a] ON [p].[Id] = [a].[Id]"); } public override void Include_address_shadow() { base.Include_address_shadow(); -// Assert.Equal( -// @"SELECT [p].[Id], [p].[Name], [p.Address].[Id], [p.Address].[City], [p.Address].[PersonId], [p.Address].[Street] -//FROM [Person2] AS [p] -//LEFT JOIN [Address2] AS [p.Address] ON [p].[Id] = [p.Address].[PersonId]", -// Sql, -// ignoreLineEndingDifferences: true); + AssertSql( + @"SELECT [p].[Id], [p].[Name], [a].[Id], [a].[City], [a].[PersonId], [a].[Street] +FROM [Person2] AS [p] +LEFT JOIN [Address2] AS [a] ON [p].[Id] = [a].[PersonId]"); } - private string Sql => Fixture.TestSqlLoggerFactory.SqlStatements.Last(); + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); public class OneToOneQuerySqlServerFixture : OneToOneQueryFixtureBase { diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/MappingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/MappingQuerySqlServerTest.cs index 550de0071de..ba1ddcd20e8 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/MappingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/MappingQuerySqlServerTest.cs @@ -12,44 +12,36 @@ public override void All_customers() { base.All_customers(); - Assert.Equal( + AssertSql( @"SELECT [c].[CustomerID], [c].[CompanyName] -FROM [dbo].[Customers] AS [c]", - Sql, - ignoreLineEndingDifferences: true); +FROM [dbo].[Customers] AS [c]"); } public override void All_employees() { base.All_employees(); - Assert.Equal( + AssertSql( @"SELECT [e].[EmployeeID], [e].[City] -FROM [dbo].[Employees] AS [e]", - Sql, - ignoreLineEndingDifferences: true); +FROM [dbo].[Employees] AS [e]"); } public override void All_orders() { base.All_orders(); - Assert.Equal( + AssertSql( @"SELECT [o].[OrderID], [o].[ShipVia] -FROM [dbo].[Orders] AS [o]", - Sql, - ignoreLineEndingDifferences: true); +FROM [dbo].[Orders] AS [o]"); } public override void Project_nullable_enum() { base.Project_nullable_enum(); - Assert.Equal( + AssertSql( @"SELECT [o].[ShipVia] -FROM [dbo].[Orders] AS [o]", - Sql, - ignoreLineEndingDifferences: true); +FROM [dbo].[Orders] AS [o]"); } public MappingQuerySqlServerTest(MappingQuerySqlServerFixture fixture) @@ -58,7 +50,8 @@ public MappingQuerySqlServerTest(MappingQuerySqlServerFixture fixture) Fixture.TestSqlLoggerFactory.Clear(); } - private string Sql => Fixture.TestSqlLoggerFactory.Sql; + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); public class MappingQuerySqlServerFixture : MappingQueryFixtureBase { diff --git a/test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs index fcb32b3487d..5b9301abbbf 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs @@ -35,13 +35,11 @@ public void Translate_array_length() .Select(p => p.Blob.Length) .FirstOrDefault(); - Assert.Equal( + AssertSql( @"SELECT length(""p"".""Blob"") FROM ""MappedDataTypesWithIdentity"" AS ""p"" WHERE length(""p"".""Blob"") = 0 -LIMIT 1", - Fixture.TestSqlLoggerFactory.Sql, - ignoreLineEndingDifferences: true); +LIMIT 1"); } } @@ -1510,6 +1508,9 @@ public virtual void Can_query_modulo_of_converted_types() } } + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); + public class BuiltInDataTypesSqliteFixture : BuiltInDataTypesFixtureBase { public override bool StrictEquality => false; diff --git a/test/EFCore.Sqlite.FunctionalTests/MigrationsSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/MigrationsSqliteTest.cs index e539f808d39..df9e98993cb 100644 --- a/test/EFCore.Sqlite.FunctionalTests/MigrationsSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/MigrationsSqliteTest.cs @@ -364,222 +364,222 @@ protected override void BuildModel(ModelBuilder modelBuilder) } } - public class AspNetIdentity21ModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) + public class AspNetIdentity21ModelSnapshot : ModelSnapshot { + protected override void BuildModel(ModelBuilder modelBuilder) + { #pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "2.1.0"); + modelBuilder + .HasAnnotation("ProductVersion", "2.1.0"); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); - b.Property("Name") - .HasMaxLength(256); + b.Property("Name") + .HasMaxLength(256); - b.Property("NormalizedName") - .HasMaxLength(256); + b.Property("NormalizedName") + .HasMaxLength(256); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("NormalizedName") - .IsUnique() - .HasName("RoleNameIndex"); + b.HasIndex("NormalizedName") + .IsUnique() + .HasName("RoleNameIndex"); - b.ToTable("AspNetRoles"); - }); + b.ToTable("AspNetRoles"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ClaimType"); + b.Property("ClaimType"); - b.Property("ClaimValue"); + b.Property("ClaimValue"); - b.Property("RoleId") - .IsRequired(); + b.Property("RoleId") + .IsRequired(); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("RoleId"); + b.HasIndex("RoleId"); - b.ToTable("AspNetRoleClaims"); - }); + b.ToTable("AspNetRoleClaims"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount"); - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); - b.Property("Email") - .HasMaxLength(256); + b.Property("Email") + .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd"); - b.Property("NormalizedEmail") - .HasMaxLength(256); + b.Property("NormalizedEmail") + .HasMaxLength(256); - b.Property("NormalizedUserName") - .HasMaxLength(256); + b.Property("NormalizedUserName") + .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled"); - b.Property("UserName") - .HasMaxLength(256); + b.Property("UserName") + .HasMaxLength(256); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); + b.HasIndex("NormalizedEmail") + .HasName("EmailIndex"); - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasName("UserNameIndex"); + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasName("UserNameIndex"); - b.ToTable("AspNetUsers"); - }); + b.ToTable("AspNetUsers"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ClaimType"); + b.Property("ClaimType"); - b.Property("ClaimValue"); + b.Property("ClaimValue"); - b.Property("UserId") - .IsRequired(); + b.Property("UserId") + .IsRequired(); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("UserId"); + b.HasIndex("UserId"); - b.ToTable("AspNetUserClaims"); - }); + b.ToTable("AspNetUserClaims"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(128); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128); - b.Property("ProviderKey") - .HasMaxLength(128); + b.Property("ProviderKey") + .HasMaxLength(128); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName"); - b.Property("UserId") - .IsRequired(); + b.Property("UserId") + .IsRequired(); - b.HasKey("LoginProvider", "ProviderKey"); + b.HasKey("LoginProvider", "ProviderKey"); - b.HasIndex("UserId"); + b.HasIndex("UserId"); - b.ToTable("AspNetUserLogins"); - }); + b.ToTable("AspNetUserLogins"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId"); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId"); - b.Property("RoleId"); + b.Property("RoleId"); - b.HasKey("UserId", "RoleId"); + b.HasKey("UserId", "RoleId"); - b.HasIndex("RoleId"); + b.HasIndex("RoleId"); - b.ToTable("AspNetUserRoles"); - }); + b.ToTable("AspNetUserRoles"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId"); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId"); - b.Property("LoginProvider") - .HasMaxLength(128); + b.Property("LoginProvider") + .HasMaxLength(128); - b.Property("Name") - .HasMaxLength(128); + b.Property("Name") + .HasMaxLength(128); - b.Property("Value"); + b.Property("Value"); - b.HasKey("UserId", "LoginProvider", "Name"); + b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AspNetUserTokens"); - }); + b.ToTable("AspNetUserTokens"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); #pragma warning restore 612, 618 + } } - } public override void Can_diff_against_2_1_ASP_NET_Identity_model() { @@ -589,222 +589,222 @@ public override void Can_diff_against_2_1_ASP_NET_Identity_model() } } - public class AspNetIdentity22ModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) + public class AspNetIdentity22ModelSnapshot : ModelSnapshot { + protected override void BuildModel(ModelBuilder modelBuilder) + { #pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "2.2.0-preview1"); + modelBuilder + .HasAnnotation("ProductVersion", "2.2.0-preview1"); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); - b.Property("Name") - .HasMaxLength(256); + b.Property("Name") + .HasMaxLength(256); - b.Property("NormalizedName") - .HasMaxLength(256); + b.Property("NormalizedName") + .HasMaxLength(256); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("NormalizedName") - .IsUnique() - .HasName("RoleNameIndex"); + b.HasIndex("NormalizedName") + .IsUnique() + .HasName("RoleNameIndex"); - b.ToTable("AspNetRoles"); - }); + b.ToTable("AspNetRoles"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ClaimType"); + b.Property("ClaimType"); - b.Property("ClaimValue"); + b.Property("ClaimValue"); - b.Property("RoleId") - .IsRequired(); + b.Property("RoleId") + .IsRequired(); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("RoleId"); + b.HasIndex("RoleId"); - b.ToTable("AspNetRoleClaims"); - }); + b.ToTable("AspNetRoleClaims"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount"); - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); - b.Property("Email") - .HasMaxLength(256); + b.Property("Email") + .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd"); - b.Property("NormalizedEmail") - .HasMaxLength(256); + b.Property("NormalizedEmail") + .HasMaxLength(256); - b.Property("NormalizedUserName") - .HasMaxLength(256); + b.Property("NormalizedUserName") + .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled"); - b.Property("UserName") - .HasMaxLength(256); + b.Property("UserName") + .HasMaxLength(256); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); + b.HasIndex("NormalizedEmail") + .HasName("EmailIndex"); - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasName("UserNameIndex"); + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasName("UserNameIndex"); - b.ToTable("AspNetUsers"); - }); + b.ToTable("AspNetUsers"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); - b.Property("ClaimType"); + b.Property("ClaimType"); - b.Property("ClaimValue"); + b.Property("ClaimValue"); - b.Property("UserId") - .IsRequired(); + b.Property("UserId") + .IsRequired(); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("UserId"); + b.HasIndex("UserId"); - b.ToTable("AspNetUserClaims"); - }); + b.ToTable("AspNetUserClaims"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(128); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128); - b.Property("ProviderKey") - .HasMaxLength(128); + b.Property("ProviderKey") + .HasMaxLength(128); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName"); - b.Property("UserId") - .IsRequired(); + b.Property("UserId") + .IsRequired(); - b.HasKey("LoginProvider", "ProviderKey"); + b.HasKey("LoginProvider", "ProviderKey"); - b.HasIndex("UserId"); + b.HasIndex("UserId"); - b.ToTable("AspNetUserLogins"); - }); + b.ToTable("AspNetUserLogins"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId"); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId"); - b.Property("RoleId"); + b.Property("RoleId"); - b.HasKey("UserId", "RoleId"); + b.HasKey("UserId", "RoleId"); - b.HasIndex("RoleId"); + b.HasIndex("RoleId"); - b.ToTable("AspNetUserRoles"); - }); + b.ToTable("AspNetUserRoles"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId"); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId"); - b.Property("LoginProvider") - .HasMaxLength(128); + b.Property("LoginProvider") + .HasMaxLength(128); - b.Property("Name") - .HasMaxLength(128); + b.Property("Name") + .HasMaxLength(128); - b.Property("Value"); + b.Property("Value"); - b.HasKey("UserId", "LoginProvider", "Name"); + b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AspNetUserTokens"); - }); + b.ToTable("AspNetUserTokens"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); #pragma warning restore 612, 618 + } } - } public override void Can_diff_against_2_2_ASP_NET_Identity_model() { @@ -814,263 +814,263 @@ public override void Can_diff_against_2_2_ASP_NET_Identity_model() } } - public class AspNetIdentity30ModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) + public class AspNetIdentity30ModelSnapshot : ModelSnapshot { + protected override void BuildModel(ModelBuilder modelBuilder) + { #pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.0.0"); + modelBuilder + .HasAnnotation("ProductVersion", "3.0.0"); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); - b.Property("Name") - .HasColumnType("TEXT") - .HasMaxLength(256); + b.Property("Name") + .HasColumnType("TEXT") + .HasMaxLength(256); - b.Property("NormalizedName") - .HasColumnType("TEXT") - .HasMaxLength(256); + b.Property("NormalizedName") + .HasColumnType("TEXT") + .HasMaxLength(256); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("NormalizedName") - .IsUnique() - .HasName("RoleNameIndex"); + b.HasIndex("NormalizedName") + .IsUnique() + .HasName("RoleNameIndex"); - b.ToTable("AspNetRoles"); - }); + b.ToTable("AspNetRoles"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType") - .HasColumnType("TEXT"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue") - .HasColumnType("TEXT"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("RoleId"); + b.HasIndex("RoleId"); - b.ToTable("AspNetRoleClaims"); - }); + b.ToTable("AspNetRoleClaims"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); - b.Property("Email") - .HasColumnType("TEXT") - .HasMaxLength(256); + b.Property("Email") + .HasColumnType("TEXT") + .HasMaxLength(256); - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); - b.Property("LockoutEnd") - .HasColumnType("TEXT"); + b.Property("LockoutEnd") + .HasColumnType("TEXT"); - b.Property("NormalizedEmail") - .HasColumnType("TEXT") - .HasMaxLength(256); + b.Property("NormalizedEmail") + .HasColumnType("TEXT") + .HasMaxLength(256); - b.Property("NormalizedUserName") - .HasColumnType("TEXT") - .HasMaxLength(256); + b.Property("NormalizedUserName") + .HasColumnType("TEXT") + .HasMaxLength(256); - b.Property("PasswordHash") - .HasColumnType("TEXT"); + b.Property("PasswordHash") + .HasColumnType("TEXT"); - b.Property("PhoneNumber") - .HasColumnType("TEXT"); + b.Property("PhoneNumber") + .HasColumnType("TEXT"); - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); - b.Property("SecurityStamp") - .HasColumnType("TEXT"); + b.Property("SecurityStamp") + .HasColumnType("TEXT"); - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); - b.Property("UserName") - .HasColumnType("TEXT") - .HasMaxLength(256); + b.Property("UserName") + .HasColumnType("TEXT") + .HasMaxLength(256); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); + b.HasIndex("NormalizedEmail") + .HasName("EmailIndex"); - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasName("UserNameIndex"); + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasName("UserNameIndex"); - b.ToTable("AspNetUsers"); - }); + b.ToTable("AspNetUsers"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType") - .HasColumnType("TEXT"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue") - .HasColumnType("TEXT"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("UserId"); + b.HasIndex("UserId"); - b.ToTable("AspNetUserClaims"); - }); + b.ToTable("AspNetUserClaims"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT") - .HasMaxLength(128); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT") + .HasMaxLength(128); - b.Property("ProviderKey") - .HasColumnType("TEXT") - .HasMaxLength(128); + b.Property("ProviderKey") + .HasColumnType("TEXT") + .HasMaxLength(128); - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); - b.HasKey("LoginProvider", "ProviderKey"); + b.HasKey("LoginProvider", "ProviderKey"); - b.HasIndex("UserId"); + b.HasIndex("UserId"); - b.ToTable("AspNetUserLogins"); - }); + b.ToTable("AspNetUserLogins"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); - b.Property("RoleId") - .HasColumnType("TEXT"); + b.Property("RoleId") + .HasColumnType("TEXT"); - b.HasKey("UserId", "RoleId"); + b.HasKey("UserId", "RoleId"); - b.HasIndex("RoleId"); + b.HasIndex("RoleId"); - b.ToTable("AspNetUserRoles"); - }); + b.ToTable("AspNetUserRoles"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); - b.Property("LoginProvider") - .HasColumnType("TEXT") - .HasMaxLength(128); + b.Property("LoginProvider") + .HasColumnType("TEXT") + .HasMaxLength(128); - b.Property("Name") - .HasColumnType("TEXT") - .HasMaxLength(128); + b.Property("Name") + .HasColumnType("TEXT") + .HasMaxLength(128); - b.Property("Value") - .HasColumnType("TEXT"); + b.Property("Value") + .HasColumnType("TEXT"); - b.HasKey("UserId", "LoginProvider", "Name"); + b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AspNetUserTokens"); - }); + b.ToTable("AspNetUserTokens"); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); #pragma warning restore 612, 618 + } } - } public override void Can_diff_against_3_0_ASP_NET_Identity_model() {