Skip to content

Commit

Permalink
A test for non-default collations #7172
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriySvyryd committed Aug 23, 2021
1 parent 0557acb commit 310d721
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/EFCore.SqlServer.FunctionalTests/BatchingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,34 @@ public void Inserts_when_database_type_is_different()
context => Assert.Equal(2, context.Owners.Count()));
}

[ConditionalFact]
public void Inserts_when_database_collation_is_different()
{
ExecuteWithStrategyInTransaction(
context =>
{
context.Database.ExecuteSqlRaw(@"
DROP TABLE dbo.Blogs;
ALTER TABLE dbo.Owners
DROP CONSTRAINT PK_Owners;
ALTER TABLE dbo.Owners
ALTER COLUMN Id nvarchar(450) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL;
ALTER TABLE dbo.Owners
ALTER COLUMN Name nvarchar(MAX) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL;
ALTER TABLE dbo.Owners ADD CONSTRAINT
PK_Owners PRIMARY KEY CLUSTERED (Id);");
var owner1 = new Owner { Id = "0", Name = "Zero" };
var owner2 = new Owner { Id = "A", Name = string.Join("", Enumerable.Repeat('A', 900)) };
context.Owners.Add(owner1);
context.Owners.Add(owner2);
context.SaveChanges();
},
context => Assert.Equal(2, context.Owners.Count()));
}

[ConditionalTheory]
[InlineData(3)]
[InlineData(4)]
Expand Down

0 comments on commit 310d721

Please sign in to comment.