Test AStoreRefusesAMissingCatalog (red: AetheriaStores.Open does not yet refuse)
Builds; the new test fails against the current Open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
30c008d7a8
commit
fe9da2e0af
1 changed files with 16 additions and 0 deletions
|
|
@ -200,6 +200,22 @@ public sealed class AetheriaStoresTests : IDisposable
|
|||
Assert.Null(record);
|
||||
}
|
||||
|
||||
// A shipped player with no catalog must not boot into an empty game: a read-only open of a missing path throws
|
||||
// naming the path, and does not create the file. A writable open still seeds an empty catalog.
|
||||
[Fact]
|
||||
public void AStoreRefusesAMissingCatalog()
|
||||
{
|
||||
var missing = Path.Combine(_root, "absent", "Aetheria.cc");
|
||||
|
||||
var error = Assert.Throws<InvalidOperationException>(() => AetheriaStores.Open(missing));
|
||||
Assert.Contains(missing, error.Message);
|
||||
Assert.False(File.Exists(missing));
|
||||
Assert.False(Directory.Exists(Path.GetDirectoryName(missing)));
|
||||
|
||||
using (var seeded = AetheriaStores.Open(missing, catalogWritable: true))
|
||||
Assert.Empty(seeded.GetAll<Faction>());
|
||||
}
|
||||
|
||||
private static string Hash(string path) => Convert.ToHexString(SHA256.HashData(File.ReadAllBytes(path)));
|
||||
|
||||
private static string[] SchemaNames(string path)
|
||||
|
|
|
|||
Loading…
Reference in a new issue