Restore the codec-less variant test's cache; the one-batch retype test keeps the replacement through a later add of the batch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-28 05:16:32 +01:00
commit 20be80cc23
2 changed files with 3 additions and 2 deletions

View file

@ -418,7 +418,7 @@ namespace GameCult.Caching.Tests
[Test]
public void ACacheWithoutACodecHoldsNoVariants()
{
using var cache = new CultCache(Registry, CultCacheMessagePack.CreateCodec(Registry));
using var cache = new CultCache(Registry);
cache.Commit(batch => batch.Upsert(typeof(VariantGear), Laser(), BaseKey));
var error = Refused(() => cache.UpsertVariantAsync(BigKey, BaseKey).GetAwaiter().GetResult());
Assert.That(error.Message, Does.Contain(BigKey.Value).And.Contain("codec"));

View file

@ -265,8 +265,9 @@ namespace GameCult.Caching.Tests
Assert.That(cache.Commit(batch =>
{
batch.Remove(K2);
batch.Upsert(new WoB { Name = "k2", Value = 8 }, new CultRecordHandle<WoB>(K2));
batch.Upsert(new WoA { Name = "k2", Value = 9 }, new CultRecordHandle<WoA>(K2));
}), Is.True);
}), Is.True, "the key stays a replacement through a later add of the same batch");
Assert.That(cache.GetStored(K2)!.Descriptor.DocumentType, Is.EqualTo(typeof(WoA)));
}