Reach the empty admission through a commit that removes nothing

Attaching a store with no file never calls Loaded, so it did not exercise the
rule; a commit removing a key the cache does not hold admits nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-29 20:04:59 +02:00
commit 36acb4295a

View file

@ -120,15 +120,14 @@ namespace GameCult.Caching.Tests
}
[Test]
public void AJournalIsCalledForAnAdmissionThatChangedSomethingAndNeverForOneThatDidNot()
public void AnAdmissionThatChangesNothingIsNotJournaled()
{
using var cache = Memory();
var calls = 0;
using var journal = cache.AddJournal(_ => calls++);
// Attaching a store with nothing in it is an admission with no change.
cache.AddBackingStore(new SingleFileMessagePackBackingStore(Path.Combine(_directory, "empty.cc")));
Assert.That(cache.Remove(KeyOf("absent")), Is.False);
// Removing a record the cache does not hold is a commit that admits nothing.
cache.Commit(batch => batch.Remove(KeyOf("absent")));
Assert.That(calls, Is.Zero);
}