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:
parent
281e1b238c
commit
36acb4295a
1 changed files with 3 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue