fix(#15): make test time stable — use same DateTime instance for unchanged fields
This commit is contained in:
@@ -173,6 +173,7 @@ public sealed class AuthorizedSessionServiceTests
|
||||
var gmId = 1001L;
|
||||
var groupId = Guid.NewGuid();
|
||||
var sessionId = Guid.NewGuid();
|
||||
var originalTime = DateTime.UtcNow;
|
||||
var store = new FakeSessionStore(
|
||||
groups:
|
||||
[
|
||||
@@ -180,11 +181,11 @@ public sealed class AuthorizedSessionServiceTests
|
||||
],
|
||||
sessions:
|
||||
[
|
||||
new(sessionId, groupId, "Session A", DateTime.UtcNow, "Planned", "https://example.test/a", Guid.NewGuid(), 10, 42, 4, 1, 0)
|
||||
new(sessionId, groupId, "Session A", originalTime, "Planned", "https://example.test/a", Guid.NewGuid(), 10, 42, 4, 1, 0)
|
||||
]);
|
||||
var service = new AuthorizedSessionService(store);
|
||||
|
||||
await service.UpdateSessionForGmAsync(sessionId, gmId, "Updated Title", DateTime.UtcNow.AddDays(1), "https://example.test/b", 4);
|
||||
await service.UpdateSessionForGmAsync(sessionId, gmId, "Updated Title", originalTime, "https://example.test/a", 4);
|
||||
|
||||
Assert.Single(store.LogEntries);
|
||||
Assert.Equal("Title", store.LogEntries[0].ChangeType);
|
||||
|
||||
Reference in New Issue
Block a user