Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling sql asserts in query tests #16052

Merged
merged 1 commit into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public void AssertBaseline(string[] expected, bool assertOrder = true)

var contents = testInfo + newBaseLine + FileNewLine + FileNewLine;

//File.AppendAllText(logFile, contents);
File.AppendAllText(logFile, contents);

//throw;
throw;
}
}

Expand Down
102 changes: 51 additions & 51 deletions test/EFCore.SqlServer.FunctionalTests/FindSqlServerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public override void Find_int_key_from_store()
AssertSql(
@"@__p_0='77'

SELECT TOP(1) [e].[Id], [e].[Foo]
FROM [IntKey] AS [e]
WHERE [e].[Id] = @__p_0");
SELECT TOP(1) [i].[Id], [i].[Foo]
FROM [IntKey] AS [i]
WHERE ([i].[Id] = @__p_0) AND @__p_0 IS NOT NULL");
}

public override void Returns_null_for_int_key_not_in_store()
Expand All @@ -83,9 +83,9 @@ public override void Returns_null_for_int_key_not_in_store()
AssertSql(
@"@__p_0='99'

SELECT TOP(1) [e].[Id], [e].[Foo]
FROM [IntKey] AS [e]
WHERE [e].[Id] = @__p_0");
SELECT TOP(1) [i].[Id], [i].[Foo]
FROM [IntKey] AS [i]
WHERE ([i].[Id] = @__p_0) AND @__p_0 IS NOT NULL");
}

public override void Find_nullable_int_key_tracked()
Expand All @@ -102,9 +102,9 @@ public override void Find_nullable_int_key_from_store()
AssertSql(
@"@__p_0='77'

SELECT TOP(1) [e].[Id], [e].[Foo]
FROM [IntKey] AS [e]
WHERE [e].[Id] = @__p_0");
SELECT TOP(1) [i].[Id], [i].[Foo]
FROM [IntKey] AS [i]
WHERE ([i].[Id] = @__p_0) AND @__p_0 IS NOT NULL");
}

public override void Returns_null_for_nullable_int_key_not_in_store()
Expand All @@ -114,9 +114,9 @@ public override void Returns_null_for_nullable_int_key_not_in_store()
AssertSql(
@"@__p_0='99'

SELECT TOP(1) [e].[Id], [e].[Foo]
FROM [IntKey] AS [e]
WHERE [e].[Id] = @__p_0");
SELECT TOP(1) [i].[Id], [i].[Foo]
FROM [IntKey] AS [i]
WHERE ([i].[Id] = @__p_0) AND @__p_0 IS NOT NULL");
}

public override void Find_string_key_tracked()
Expand All @@ -133,9 +133,9 @@ public override void Find_string_key_from_store()
AssertSql(
@"@__p_0='Cat' (Size = 450)

SELECT TOP(1) [e].[Id], [e].[Foo]
FROM [StringKey] AS [e]
WHERE [e].[Id] = @__p_0");
SELECT TOP(1) [s].[Id], [s].[Foo]
FROM [StringKey] AS [s]
WHERE ([s].[Id] = @__p_0) AND @__p_0 IS NOT NULL");
}

public override void Returns_null_for_string_key_not_in_store()
Expand All @@ -145,9 +145,9 @@ public override void Returns_null_for_string_key_not_in_store()
AssertSql(
@"@__p_0='Fox' (Size = 450)

SELECT TOP(1) [e].[Id], [e].[Foo]
FROM [StringKey] AS [e]
WHERE [e].[Id] = @__p_0");
SELECT TOP(1) [s].[Id], [s].[Foo]
FROM [StringKey] AS [s]
WHERE ([s].[Id] = @__p_0) AND @__p_0 IS NOT NULL");
}

public override void Find_composite_key_tracked()
Expand All @@ -165,9 +165,9 @@ public override void Find_composite_key_from_store()
@"@__p_0='77'
@__p_1='Dog' (Size = 450)

SELECT TOP(1) [e].[Id1], [e].[Id2], [e].[Foo]
FROM [CompositeKey] AS [e]
WHERE ([e].[Id1] = @__p_0) AND ([e].[Id2] = @__p_1)");
SELECT TOP(1) [c].[Id1], [c].[Id2], [c].[Foo]
FROM [CompositeKey] AS [c]
WHERE (([c].[Id1] = @__p_0) AND @__p_0 IS NOT NULL) AND (([c].[Id2] = @__p_1) AND @__p_1 IS NOT NULL)");
}

public override void Returns_null_for_composite_key_not_in_store()
Expand All @@ -178,9 +178,9 @@ public override void Returns_null_for_composite_key_not_in_store()
@"@__p_0='77'
@__p_1='Fox' (Size = 450)

SELECT TOP(1) [e].[Id1], [e].[Id2], [e].[Foo]
FROM [CompositeKey] AS [e]
WHERE ([e].[Id1] = @__p_0) AND ([e].[Id2] = @__p_1)");
SELECT TOP(1) [c].[Id1], [c].[Id2], [c].[Foo]
FROM [CompositeKey] AS [c]
WHERE (([c].[Id1] = @__p_0) AND @__p_0 IS NOT NULL) AND (([c].[Id2] = @__p_1) AND @__p_1 IS NOT NULL)");
}

public override void Find_base_type_tracked()
Expand All @@ -197,9 +197,9 @@ public override void Find_base_type_from_store()
AssertSql(
@"@__p_0='77'

SELECT TOP(1) [e].[Id], [e].[Discriminator], [e].[Foo], [e].[Boo]
FROM [BaseType] AS [e]
WHERE [e].[Discriminator] IN (N'DerivedType', N'BaseType') AND ([e].[Id] = @__p_0)");
SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo]
FROM [BaseType] AS [b]
WHERE [b].[Discriminator] IN (N'BaseType', N'DerivedType') AND (([b].[Id] = @__p_0) AND @__p_0 IS NOT NULL)");
}

public override void Returns_null_for_base_type_not_in_store()
Expand All @@ -209,9 +209,9 @@ public override void Returns_null_for_base_type_not_in_store()
AssertSql(
@"@__p_0='99'

SELECT TOP(1) [e].[Id], [e].[Discriminator], [e].[Foo], [e].[Boo]
FROM [BaseType] AS [e]
WHERE [e].[Discriminator] IN (N'DerivedType', N'BaseType') AND ([e].[Id] = @__p_0)");
SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo]
FROM [BaseType] AS [b]
WHERE [b].[Discriminator] IN (N'BaseType', N'DerivedType') AND (([b].[Id] = @__p_0) AND @__p_0 IS NOT NULL)");
}

public override void Find_derived_type_tracked()
Expand All @@ -228,9 +228,9 @@ public override void Find_derived_type_from_store()
AssertSql(
@"@__p_0='78'

SELECT TOP(1) [e].[Id], [e].[Discriminator], [e].[Foo], [e].[Boo]
FROM [BaseType] AS [e]
WHERE ([e].[Discriminator] = N'DerivedType') AND ([e].[Id] = @__p_0)");
SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo]
FROM [BaseType] AS [b]
WHERE ([b].[Discriminator] = N'DerivedType') AND (([b].[Id] = @__p_0) AND @__p_0 IS NOT NULL)");
}

public override void Returns_null_for_derived_type_not_in_store()
Expand All @@ -240,9 +240,9 @@ public override void Returns_null_for_derived_type_not_in_store()
AssertSql(
@"@__p_0='99'

SELECT TOP(1) [e].[Id], [e].[Discriminator], [e].[Foo], [e].[Boo]
FROM [BaseType] AS [e]
WHERE ([e].[Discriminator] = N'DerivedType') AND ([e].[Id] = @__p_0)");
SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo]
FROM [BaseType] AS [b]
WHERE ([b].[Discriminator] = N'DerivedType') AND (([b].[Id] = @__p_0) AND @__p_0 IS NOT NULL)");
}

public override void Find_base_type_using_derived_set_tracked()
Expand All @@ -252,9 +252,9 @@ public override void Find_base_type_using_derived_set_tracked()
AssertSql(
@"@__p_0='88'

SELECT TOP(1) [e].[Id], [e].[Discriminator], [e].[Foo], [e].[Boo]
FROM [BaseType] AS [e]
WHERE ([e].[Discriminator] = N'DerivedType') AND ([e].[Id] = @__p_0)");
SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo]
FROM [BaseType] AS [b]
WHERE ([b].[Discriminator] = N'DerivedType') AND (([b].[Id] = @__p_0) AND @__p_0 IS NOT NULL)");
}

public override void Find_base_type_using_derived_set_from_store()
Expand All @@ -264,9 +264,9 @@ public override void Find_base_type_using_derived_set_from_store()
AssertSql(
@"@__p_0='77'

SELECT TOP(1) [e].[Id], [e].[Discriminator], [e].[Foo], [e].[Boo]
FROM [BaseType] AS [e]
WHERE ([e].[Discriminator] = N'DerivedType') AND ([e].[Id] = @__p_0)");
SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo]
FROM [BaseType] AS [b]
WHERE ([b].[Discriminator] = N'DerivedType') AND (([b].[Id] = @__p_0) AND @__p_0 IS NOT NULL)");
}

public override void Find_derived_type_using_base_set_tracked()
Expand All @@ -283,9 +283,9 @@ public override void Find_derived_using_base_set_type_from_store()
AssertSql(
@"@__p_0='78'

SELECT TOP(1) [e].[Id], [e].[Discriminator], [e].[Foo], [e].[Boo]
FROM [BaseType] AS [e]
WHERE [e].[Discriminator] IN (N'DerivedType', N'BaseType') AND ([e].[Id] = @__p_0)");
SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo]
FROM [BaseType] AS [b]
WHERE [b].[Discriminator] IN (N'BaseType', N'DerivedType') AND (([b].[Id] = @__p_0) AND @__p_0 IS NOT NULL)");
}

public override void Find_shadow_key_tracked()
Expand All @@ -302,9 +302,9 @@ public override void Find_shadow_key_from_store()
AssertSql(
@"@__p_0='77'

SELECT TOP(1) [e].[Id], [e].[Foo]
FROM [ShadowKey] AS [e]
WHERE [e].[Id] = @__p_0");
SELECT TOP(1) [s].[Id], [s].[Foo]
FROM [ShadowKey] AS [s]
WHERE ([s].[Id] = @__p_0) AND @__p_0 IS NOT NULL");
}

public override void Returns_null_for_shadow_key_not_in_store()
Expand All @@ -314,9 +314,9 @@ public override void Returns_null_for_shadow_key_not_in_store()
AssertSql(
@"@__p_0='99'

SELECT TOP(1) [e].[Id], [e].[Foo]
FROM [ShadowKey] AS [e]
WHERE [e].[Id] = @__p_0");
SELECT TOP(1) [s].[Id], [s].[Foo]
FROM [ShadowKey] AS [s]
WHERE ([s].[Id] = @__p_0) AND @__p_0 IS NOT NULL");
}

private string Sql => Fixture.TestSqlLoggerFactory.Sql;
Expand Down
Loading