Caching tests: the open verdict is asserted where the store is attached
AddBackingStore pulls, so a file the reader refuses throws on attach, outside the assertion. Wrap attach and pull together. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e1ff5b2278
commit
4b3c76e418
1 changed files with 8 additions and 3 deletions
|
|
@ -66,11 +66,16 @@ namespace GameCult.Caching.Tests
|
|||
File.WriteAllBytes(path, File.ReadAllBytes(Path.Combine(VectorRoot(), vector)));
|
||||
|
||||
using var cache = new CultCache();
|
||||
cache.AddBackingStore(new SingleFileMessagePackBackingStore(path));
|
||||
void Open()
|
||||
{
|
||||
cache.AddBackingStore(new SingleFileMessagePackBackingStore(path));
|
||||
cache.PullAllBackingStoresAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
if (reads)
|
||||
Assert.DoesNotThrow(() => cache.PullAllBackingStoresAsync().GetAwaiter().GetResult());
|
||||
Assert.DoesNotThrow(Open);
|
||||
else
|
||||
Assert.That(() => cache.PullAllBackingStoresAsync().GetAwaiter().GetResult(), Throws.Exception);
|
||||
Assert.That(Open, Throws.Exception);
|
||||
}
|
||||
|
||||
[TestCaseSource(nameof(Vectors))]
|
||||
|
|
|
|||
Loading…
Reference in a new issue