Tests: a cacheless write never takes a record a same-named version of its schema claims
Kills the written-by-name mutant (the claimant condition compared schema names instead of ids). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cad173ef11
commit
01a750afb2
1 changed files with 16 additions and 0 deletions
|
|
@ -540,6 +540,22 @@ namespace GameCult.Caching.Tests
|
|||
Assert.That(Fingerprint(path), Is.EqualTo(before));
|
||||
}
|
||||
|
||||
// Claiming is by entry, not by schema name: a record under an id a same-named other version of the written schema lists is
|
||||
// that version's, and a write of Narrow does not take it.
|
||||
[Test]
|
||||
public void ACachelessWriterNeverOwnsARecordASameNamedVersionClaims()
|
||||
{
|
||||
var path = SeedRenamed(listsNarrow: false, alsoLists: WideId);
|
||||
var snapshot = Snapshot(path);
|
||||
foreach (var record in snapshot.Records)
|
||||
record.SchemaId = WideId;
|
||||
File.WriteAllBytes(path, CultDocumentMessagePackSerialization.SerializeSnapshot(snapshot));
|
||||
var before = Fingerprint(path);
|
||||
|
||||
Assert.Throws<CultSchemaConflictException>(() => WriteNarrow(path, cacheless: true, CultDocumentRegistry.ForTypes(new[] { typeof(NoteNarrow), typeof(NoteGrownDeclaring) })));
|
||||
Assert.That(Fingerprint(path), Is.EqualTo(before));
|
||||
}
|
||||
|
||||
// The registry's other types change nothing about a record the written type claims itself.
|
||||
[Test]
|
||||
public void AnotherRegisteredTypeDoesNotTakeAWritersOwnDriftRecord()
|
||||
|
|
|
|||
Loading…
Reference in a new issue