|
1 | 1 | using System.Linq; |
2 | 2 | using System.Threading.Tasks; |
| 3 | +using Microsoft.EntityFrameworkCore; |
3 | 4 | using Microsoft.EntityFrameworkCore.BulkUpdates; |
4 | 5 | using Microsoft.EntityFrameworkCore.TestModels.Northwind; |
5 | 6 | using Microsoft.EntityFrameworkCore.TestUtilities; |
@@ -1475,6 +1476,28 @@ public override async Task Update_with_two_inner_joins(bool async) |
1475 | 1476 | """); |
1476 | 1477 | } |
1477 | 1478 |
|
| 1479 | + [ConditionalTheory] |
| 1480 | + [MemberData(nameof(IsAsyncData))] |
| 1481 | + public virtual Task Update_Where_set_ordering_is_preserved(bool async) |
| 1482 | + => TestHelpers.ExecuteWithStrategyInTransactionAsync( |
| 1483 | + Fixture.CreateContext, Fixture.UseTransaction, |
| 1484 | + async context => |
| 1485 | + { |
| 1486 | + var updated = await context.Set<Customer>().ExecuteUpdateAsync( |
| 1487 | + setters => setters |
| 1488 | + .SetProperty(c => c.ContactName, "X") |
| 1489 | + .SetProperty(c => c.ContactTitle, c => c.ContactName + "Y")); |
| 1490 | + Assert.True(updated > 0); |
| 1491 | + Assert.Equal(updated, await context.Set<Customer>().CountAsync(c => c.ContactTitle == "XY")); |
| 1492 | + |
| 1493 | + updated = await context.Set<Customer>().ExecuteUpdateAsync( |
| 1494 | + setters => setters |
| 1495 | + .SetProperty(c => c.City, "Y") |
| 1496 | + .SetProperty(c => c.ContactName, c => c.City + "X")); |
| 1497 | + Assert.True(updated > 0); |
| 1498 | + Assert.Equal(updated, await context.Set<Customer>().CountAsync(c => c.ContactName == "YX")); |
| 1499 | + }); |
| 1500 | + |
1478 | 1501 | private void AssertSql(params string[] expected) |
1479 | 1502 | => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); |
1480 | 1503 |
|
|
0 commit comments