Tests: a refusal leaves staged what it did not refuse, with the refused record now refused again at staging

ARefusalLeavesStagedWhatItDidNotRefuse re-staged the refused record and
expected the flush to refuse it; since b636a69f lists it foreign, that
re-staging is refused at once. The partial case now stages two records before
another writer makes one foreign.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-03 15:18:21 +02:00
commit de401056e0

View file

@ -471,13 +471,16 @@ namespace GameCult.Caching.Tests
Assert.Throws<CultSchemaConflictException>(() => cache.FlushAsync().GetAwaiter().GetResult());
Assert.That(cache.IsDirty, Is.False, "nothing is left staged");
cache.UpsertAsync(Deck, DeckOf(Canary), D).GetAwaiter().GetResult();
cache.UpsertAsync(Deck, DeckOf("e"), E).GetAwaiter().GetResult();
cache.Commit(batch => batch.Upsert(Deck, DeckOf("e"), E));
cache.UpsertAsync(Deck, DeckOf(Canary), E).GetAwaiter().GetResult();
cache.UpsertAsync(Deck, DeckOf("v"), V).GetAwaiter().GetResult();
using (var other = Open(path, Full, directory))
other.Commit(batch => batch.Upsert(Widget, WidgetOf("now a widget"), E));
Assert.Throws<CultSchemaConflictException>(() => cache.FlushAsync().GetAwaiter().GetResult());
Assert.That(cache.IsDirty, Is.True, "e is still staged");
Assert.That(cache.IsDirty, Is.True, "v is still staged");
cache.FlushAsync().GetAwaiter().GetResult();
Assert.That(Read(path).Records.Select(record => record.Key), Does.Contain("e"));
Assert.That(Read(path).Records.Select(record => record.Key), Does.Contain("v"));
Assert.That(cache.IsDirty, Is.False);
}