Add explicit write transactions and deterministic ordering tests
This commit is contained in:
@@ -244,11 +244,11 @@ public class AdminTests
|
||||
{
|
||||
var p = await db.Players.FirstAsync(x => !x.IsAdmin);
|
||||
p.VotesFinal = true;
|
||||
var state = await db.AppState.FirstAsync();
|
||||
state.UpdatedAt = DateTimeOffset.UnixEpoch;
|
||||
await db.SaveChangesAsync();
|
||||
});
|
||||
|
||||
var beforeState = await factory.WithDbContextAsync(async db => await db.AppState.AsNoTracking().FirstAsync());
|
||||
await Task.Delay(5);
|
||||
var close = await admin.PostAsJsonAsync("/api/admin/results", new { resultsOpen = false });
|
||||
close.EnsureSuccessStatusCode();
|
||||
|
||||
@@ -259,7 +259,7 @@ public class AdminTests
|
||||
Assert.False(p.VotesFinal);
|
||||
var state = await db.AppState.AsNoTracking().FirstAsync();
|
||||
Assert.False(state.ResultsOpen);
|
||||
Assert.True(state.UpdatedAt > beforeState.UpdatedAt);
|
||||
Assert.True(state.UpdatedAt > DateTimeOffset.UnixEpoch);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user