Skip to content

Commit 96acdfb

Browse files
committed
Update tests for Jet: deps, locale, SQL, and coverage
- Bump Microsoft.Build.Tasks.Core to 18.4.0 and EFCore.* to 10.0.* - Add ModuleInitializer to enforce en-US culture for tests - Update test SQL assertions for new parameter naming (@p1, etc.) - Add/adjust tests for DefaultIfEmpty, Contains, and parameterized collections - Mark unsupported/unstable tests as skipped for Jet - Remove/comment out Jet-unsupported features (collation, idempotent migrations) - Treat NotSupportedException as a valid skip in test runner - Add scaffolding test for non-nullable identity columns - Clean up code and ensure all new/overridden tests assert expected Jet SQL
1 parent 6a794f5 commit 96acdfb

56 files changed

Lines changed: 866 additions & 587 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using Xunit;
2+
3+
[assembly: CollectionBehavior(
4+
DisableTestParallelization = false,
5+
MaxParallelThreads = 1)]

test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs

Lines changed: 82 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ SELECT 1
273273
FROM (
274274
SELECT `o4`.`OrderID`, `o4`.`ProductID`
275275
FROM (
276-
SELECT TOP @p2 `o3`.`OrderID`, `o3`.`ProductID`
276+
SELECT TOP @p3 `o3`.`OrderID`, `o3`.`ProductID`
277277
FROM (
278-
SELECT TOP @p1 + @p2 `o0`.`OrderID`, `o0`.`ProductID`
278+
SELECT TOP @p2 + @p3 `o0`.`OrderID`, `o0`.`ProductID`
279279
FROM (
280280
SELECT `o6`.`OrderID`, `o6`.`ProductID`
281281
FROM (
@@ -528,9 +528,9 @@ SELECT 1
528528
INNER JOIN (
529529
SELECT `o4`.`OrderID`
530530
FROM (
531-
SELECT TOP @p0 `o3`.`OrderID`
531+
SELECT TOP @p1 `o3`.`OrderID`
532532
FROM (
533-
SELECT TOP @p + @p0 `o2`.`OrderID`
533+
SELECT TOP @p + @p1 `o2`.`OrderID`
534534
FROM `Orders` AS `o2`
535535
WHERE `o2`.`OrderID` < 10300
536536
ORDER BY `o2`.`OrderID`
@@ -556,9 +556,9 @@ SELECT 1
556556
LEFT JOIN (
557557
SELECT `o4`.`OrderID`
558558
FROM (
559-
SELECT TOP @p0 `o3`.`OrderID`
559+
SELECT TOP @p1 `o3`.`OrderID`
560560
FROM (
561-
SELECT TOP @p + @p0 `o2`.`OrderID`
561+
SELECT TOP @p + @p1 `o2`.`OrderID`
562562
FROM `Orders` AS `o2`
563563
WHERE `o2`.`OrderID` < 10300
564564
ORDER BY `o2`.`OrderID`
@@ -584,9 +584,9 @@ SELECT 1
584584
LEFT JOIN (
585585
SELECT `o4`.`OrderID`
586586
FROM (
587-
SELECT TOP @p0 `o3`.`OrderID`
587+
SELECT TOP @p1 `o3`.`OrderID`
588588
FROM (
589-
SELECT TOP @p + @p0 `o2`.`OrderID`
589+
SELECT TOP @p + @p1 `o2`.`OrderID`
590590
FROM `Orders` AS `o2`
591591
WHERE `o2`.`OrderID` < 10300
592592
ORDER BY `o2`.`OrderID`
@@ -678,9 +678,9 @@ SELECT 1
678678
RIGHT JOIN (
679679
SELECT `o4`.`OrderID`
680680
FROM (
681-
SELECT TOP @p0 `o3`.`OrderID`
681+
SELECT TOP @p1 `o3`.`OrderID`
682682
FROM (
683-
SELECT TOP @p + @p0 `o2`.`OrderID`
683+
SELECT TOP @p + @p1 `o2`.`OrderID`
684684
FROM `Orders` AS `o2`
685685
WHERE `o2`.`OrderID` < 10300
686686
ORDER BY `o2`.`OrderID`
@@ -855,15 +855,15 @@ public override async Task Update_Where_Take_set_constant(bool async)
855855

856856
AssertExecuteUpdateSql(
857857
"""
858-
@p0='Updated' (Size = 30)
858+
@p1='Updated' (Size = 30)
859859
860860
UPDATE `Customers` AS `c0`
861861
INNER JOIN (
862862
SELECT TOP @p `c`.`CustomerID`
863863
FROM `Customers` AS `c`
864864
WHERE `c`.`CustomerID` LIKE 'F%'
865865
) AS `c1` ON `c0`.`CustomerID` = `c1`.`CustomerID`
866-
SET `c0`.`ContactName` = @p0
866+
SET `c0`.`ContactName` = @p1
867867
""");
868868
}
869869

@@ -873,21 +873,21 @@ public override async Task Update_Where_Skip_Take_set_constant(bool async)
873873

874874
AssertExecuteUpdateSql(
875875
"""
876-
@p1='Updated' (Size = 30)
876+
@p2='Updated' (Size = 30)
877877
878878
UPDATE `Customers` AS `c0`
879879
INNER JOIN (
880880
SELECT `c3`.`CustomerID`
881881
FROM (
882-
SELECT TOP @p0 `c2`.`CustomerID`
882+
SELECT TOP @p1 `c2`.`CustomerID`
883883
FROM (
884-
SELECT TOP @p + @p0 `c`.`CustomerID`
884+
SELECT TOP @p + @p1 `c`.`CustomerID`
885885
FROM `Customers` AS `c`
886886
WHERE `c`.`CustomerID` LIKE 'F%'
887887
) AS `c2`
888888
) AS `c3`
889889
) AS `c1` ON `c0`.`CustomerID` = `c1`.`CustomerID`
890-
SET `c0`.`ContactName` = @p1
890+
SET `c0`.`ContactName` = @p2
891891
""");
892892
}
893893

@@ -936,7 +936,7 @@ public override async Task Update_Where_OrderBy_Take_set_constant(bool async)
936936

937937
AssertExecuteUpdateSql(
938938
"""
939-
@p0='Updated' (Size = 30)
939+
@p1='Updated' (Size = 30)
940940
941941
UPDATE `Customers` AS `c0`
942942
INNER JOIN (
@@ -945,7 +945,7 @@ SELECT TOP @p `c`.`CustomerID`
945945
WHERE `c`.`CustomerID` LIKE 'F%'
946946
ORDER BY `c`.`City`
947947
) AS `c1` ON `c0`.`CustomerID` = `c1`.`CustomerID`
948-
SET `c0`.`ContactName` = @p0
948+
SET `c0`.`ContactName` = @p1
949949
""");
950950
}
951951

@@ -955,15 +955,15 @@ public override async Task Update_Where_OrderBy_Skip_Take_set_constant(bool asyn
955955

956956
AssertExecuteUpdateSql(
957957
"""
958-
@p1='Updated' (Size = 30)
958+
@p2='Updated' (Size = 30)
959959
960960
UPDATE `Customers` AS `c0`
961961
INNER JOIN (
962962
SELECT `c3`.`CustomerID`
963963
FROM (
964-
SELECT TOP @p0 `c2`.`CustomerID`, `c2`.`City`
964+
SELECT TOP @p1 `c2`.`CustomerID`, `c2`.`City`
965965
FROM (
966-
SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`City`
966+
SELECT TOP @p + @p1 `c`.`CustomerID`, `c`.`City`
967967
FROM `Customers` AS `c`
968968
WHERE `c`.`CustomerID` LIKE 'F%'
969969
ORDER BY `c`.`City`
@@ -972,7 +972,7 @@ ORDER BY `c2`.`City` DESC
972972
) AS `c3`
973973
ORDER BY `c3`.`City`
974974
) AS `c1` ON `c0`.`CustomerID` = `c1`.`CustomerID`
975-
SET `c0`.`ContactName` = @p1
975+
SET `c0`.`ContactName` = @p2
976976
""");
977977
}
978978

@@ -982,7 +982,7 @@ public override async Task Update_Where_OrderBy_Skip_Take_Skip_Take_set_constant
982982

983983
AssertExecuteUpdateSql(
984984
"""
985-
@p3='Updated' (Size = 30)
985+
@p4='Updated' (Size = 30)
986986
987987
UPDATE `Customers` AS `c1`
988988
INNER JOIN (
@@ -992,9 +992,9 @@ INNER JOIN (
992992
FROM (
993993
SELECT TOP @p + @p `c0`.`CustomerID`, `c0`.`City`
994994
FROM (
995-
SELECT TOP @p0 `c5`.`CustomerID`, `c5`.`City`
995+
SELECT TOP @p1 `c5`.`CustomerID`, `c5`.`City`
996996
FROM (
997-
SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`City`
997+
SELECT TOP @p + @p1 `c`.`CustomerID`, `c`.`City`
998998
FROM `Customers` AS `c`
999999
WHERE `c`.`CustomerID` LIKE 'F%'
10001000
ORDER BY `c`.`City`
@@ -1007,7 +1007,7 @@ ORDER BY `c3`.`City` DESC
10071007
) AS `c4`
10081008
ORDER BY `c4`.`City`
10091009
) AS `c2` ON `c1`.`CustomerID` = `c2`.`CustomerID`
1010-
SET `c1`.`ContactName` = @p3
1010+
SET `c1`.`ContactName` = @p4
10111011
""");
10121012
}
10131013

@@ -1624,6 +1624,62 @@ public override async Task Update_with_two_inner_joins(bool async)
16241624
""");
16251625
}
16261626

1627+
[ConditionalTheory, MemberData(nameof(IsAsyncData))]
1628+
public override async Task Update_with_PK_pushdown_and_join_and_multiple_setters(bool async)
1629+
{
1630+
await base.Update_with_PK_pushdown_and_join_and_multiple_setters(async);
1631+
1632+
AssertExecuteUpdateSql(
1633+
"""
1634+
@p='1'
1635+
@p2='10' (DbType = Currency)
1636+
1637+
UPDATE [o2]
1638+
SET [o2].[Quantity] = CAST(@p AS smallint),
1639+
[o2].[UnitPrice] = @p2
1640+
FROM [Order Details] AS [o2]
1641+
INNER JOIN (
1642+
SELECT [o1].[OrderID], [o1].[ProductID]
1643+
FROM (
1644+
SELECT [o].[OrderID], [o].[ProductID]
1645+
FROM [Order Details] AS [o]
1646+
ORDER BY [o].[OrderID]
1647+
OFFSET @p ROWS
1648+
) AS [o1]
1649+
INNER JOIN [Orders] AS [o0] ON [o1].[OrderID] = [o0].[OrderID]
1650+
WHERE [o0].[CustomerID] = N'ALFKI'
1651+
) AS [s] ON [o2].[OrderID] = [s].[OrderID] AND [o2].[ProductID] = [s].[ProductID]
1652+
""");
1653+
}
1654+
1655+
/*public override async Task Update_with_select_mixed_entity_scalar_anonymous_projection(bool async)
1656+
{
1657+
await base.Update_with_select_mixed_entity_scalar_anonymous_projection(async);
1658+
1659+
AssertSql(
1660+
"""
1661+
@p='Updated' (Size = 30)
1662+
1663+
UPDATE [c]
1664+
SET [c].[ContactName] = @p
1665+
FROM [Customers] AS [c]
1666+
""");
1667+
}
1668+
1669+
public override async Task Update_with_select_scalar_anonymous_projection(bool async)
1670+
{
1671+
await base.Update_with_select_scalar_anonymous_projection(async);
1672+
1673+
AssertSql(
1674+
"""
1675+
@p='Updated' (Size = 30)
1676+
1677+
UPDATE [c]
1678+
SET [c].[ContactName] = @p
1679+
FROM [Customers] AS [c]
1680+
""");
1681+
}
1682+
*/
16271683
private void AssertSql(params string[] expected)
16281684
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
16291685

test/EFCore.Jet.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesJetTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ public override async Task Update_base_and_derived_types(bool async)
188188
AssertExecuteUpdateSql(
189189
"""
190190
@p='Kiwi' (Size = 255)
191-
@p0='0' (Size = 1)
191+
@p1='0' (Size = 1)
192192
193193
UPDATE `Kiwi` AS `k`
194194
SET `k`.`Name` = @p,
195-
`k`.`FoundOn` = @p0
195+
`k`.`FoundOn` = @p1
196196
WHERE `k`.`CountryId` = 1
197197
""");
198198
}

test/EFCore.Jet.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesJetTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ public override async Task Update_base_and_derived_types(bool async)
185185
AssertExecuteUpdateSql(
186186
"""
187187
@p='Kiwi' (Size = 255)
188-
@p0='0' (Size = 1)
188+
@p1='0' (Size = 1)
189189
190190
UPDATE `Kiwi` AS `k`
191191
SET `k`.`Name` = @p,
192-
`k`.`FoundOn` = @p0
192+
`k`.`FoundOn` = @p1
193193
""");
194194
}
195195

test/EFCore.Jet.FunctionalTests/BulkUpdates/TPHInheritanceBulkUpdatesJetTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ DELETE FROM `Animals` AS `a`
119119
WHERE `a`.`Id` IN (
120120
SELECT `a2`.`Id`
121121
FROM (
122-
SELECT TOP @p0 `a1`.`Id`, `a1`.`Name`
122+
SELECT TOP @p1 `a1`.`Id`, `a1`.`Name`
123123
FROM (
124-
SELECT TOP @p + @p0 `a0`.`Id`, `a0`.`Name`
124+
SELECT TOP @p + @p1 `a0`.`Id`, `a0`.`Name`
125125
FROM `Animals` AS `a0`
126126
WHERE `a0`.`Name` = 'Great spotted kiwi'
127127
ORDER BY `a0`.`Name`
@@ -220,11 +220,11 @@ public override async Task Update_base_and_derived_types(bool async)
220220
AssertExecuteUpdateSql(
221221
"""
222222
@p='Kiwi' (Size = 255)
223-
@p0='0' (Size = 1)
223+
@p1='0' (Size = 1)
224224
225225
UPDATE `Animals` AS `a`
226226
SET `a`.`Name` = @p,
227-
`a`.`FoundOn` = @p0
227+
`a`.`FoundOn` = @p1
228228
WHERE `a`.`Discriminator` = 'Kiwi'
229229
""");
230230
}

test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.14.28" />
18+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="18.4.0" />
1919
<PackageReference Include="MSTest.TestFramework" />
2020
<PackageReference Include="xunit.core" />
2121
<PackageReference Include="xunit.assert" />

test/EFCore.Jet.FunctionalTests/FindJetTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ public override void Find_composite_key_from_store()
190190
AssertSql(
191191
"""
192192
@p='77'
193-
@p0='Dog' (Size = 255)
193+
@p1='Dog' (Size = 255)
194194
195195
SELECT TOP 1 `c`.`Id1`, `c`.`Id2`, `c`.`Foo`
196196
FROM `CompositeKey` AS `c`
197-
WHERE `c`.`Id1` = @p AND `c`.`Id2` = @p0
197+
WHERE `c`.`Id1` = @p AND `c`.`Id2` = @p1
198198
""");
199199
}
200200

@@ -205,11 +205,11 @@ public override void Returns_null_for_composite_key_not_in_store()
205205
AssertSql(
206206
"""
207207
@p='77'
208-
@p0='Fox' (Size = 255)
208+
@p1='Fox' (Size = 255)
209209
210210
SELECT TOP 1 `c`.`Id1`, `c`.`Id2`, `c`.`Foo`
211211
FROM `CompositeKey` AS `c`
212-
WHERE `c`.`Id1` = @p AND `c`.`Id2` = @p0
212+
WHERE `c`.`Id1` = @p AND `c`.`Id2` = @p1
213213
""");
214214
}
215215

test/EFCore.Jet.FunctionalTests/GraphUpdates/ProxyGraphUpdatesJetTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
7878
public class ChangeTracking(ChangeTracking.ProxyGraphUpdatesWithChangeTrackingJetFixture fixture)
7979
: ProxyGraphUpdatesJetTestBase<ChangeTracking.ProxyGraphUpdatesWithChangeTrackingJetFixture>(fixture)
8080
{
81+
// Needs lazy loading
82+
public override Task Save_two_entity_cycle_with_lazy_loading()
83+
=> Task.CompletedTask;
84+
8185
protected override bool DoesLazyLoading => false;
8286
protected override bool DoesChangeTracking => true;
8387

@@ -114,7 +118,7 @@ public class ChangeTrackingAndLazyLoading(
114118

115119
public class ProxyGraphUpdatesWithChangeTrackingAndLazyLoadingJetFixture : ProxyGraphUpdatesJetFixtureBase
116120
{
117-
protected override string StoreName { get; } = "ProxyGraphChangeTrackingAndLazyLoadingUpdatesTest";
121+
protected override string StoreName => "ProxyGraphChangeTrackingAndLazyLoadingUpdatesTest";
118122

119123
public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
120124
=> base.AddOptions(builder.UseLazyLoadingProxies().UseChangeTrackingProxies());

0 commit comments

Comments
 (0)