fix(test): use precise InvalidDataException assertion in wrong-key encryption test
Code quality review feedback: Should.Throw<Exception> was too broad, changed to Should.Throw<InvalidDataException> to match the actual exception type thrown when AEAD decryption fails with wrong key.
This commit is contained in:
@@ -92,13 +92,13 @@ public class FileStoreEncryptionTests
|
|||||||
await store.AppendAsync("secret", "data"u8.ToArray(), default);
|
await store.AppendAsync("secret", "data"u8.ToArray(), default);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recovery with wrong key should throw or return no messages
|
// Recovery with wrong key should throw InvalidDataException (from CryptographicException)
|
||||||
var act = () => new FileStore(new FileStoreOptions
|
var act = () => new FileStore(new FileStoreOptions
|
||||||
{
|
{
|
||||||
Directory = dir.FullName,
|
Directory = dir.FullName,
|
||||||
Cipher = StoreCipher.ChaCha,
|
Cipher = StoreCipher.ChaCha,
|
||||||
EncryptionKey = key2,
|
EncryptionKey = key2,
|
||||||
});
|
});
|
||||||
Should.Throw<Exception>(act);
|
Should.Throw<InvalidDataException>(act);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user