feat(render #53): EntityClassificationCache.Populate + roundtrip tests

Implements Populate (insert-or-overwrite) and adds 5 tests covering the
populate->TryGet round-trip including the Setup pre-flatten shape. Per
spec test plan section 7.1 tests #2, #3, #9, #10, #14.

Tests use xUnit Assert.* (not FluentAssertions) to match the Task 2
implementer's choice and the existing 149 sibling assertions in the Wb
test directory.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-10 17:34:48 +02:00
parent 773e9703da
commit 694815c499
2 changed files with 100 additions and 0 deletions

View file

@ -48,4 +48,18 @@ internal sealed class EntityClassificationCache
/// </summary>
public bool TryGet(uint entityId, out EntityCacheEntry? entry)
=> _entries.TryGetValue(entityId, out entry);
/// <summary>
/// Insert or overwrite a cache entry for <paramref name="entityId"/>.
/// Defensive: if an entry already exists, replaces it.
/// </summary>
public void Populate(uint entityId, uint landblockHint, CachedBatch[] batches)
{
_entries[entityId] = new EntityCacheEntry
{
EntityId = entityId,
LandblockHint = landblockHint,
Batches = batches,
};
}
}