test: extend wallet/storage/property coverage and fix nullable warnings
- AppPaths: data-root resolution, per-network paths, wallet file listing. - TransactionFactory: legacy/P2SH/segwit destinations, multi-UTXO selection, dust change absorbed into fee, and a golden txid for the PSBT signing path (RFC 6979 makes it deterministic; the builder's own output shuffling for privacy makes anchoring the vector at the top-level Build() unreliable). - PropertyTests: Slip132 roundtrip for every script kind and network, WalletDocument JSON roundtrip with arbitrary labels/contacts, Scripthash cross-checked against an independent SHA-256 computation. - StorageTests: regression cases for the IsEncrypted fix. - Removed CS8602/CS8604 nullable warnings from existing address/loader tests.
This commit is contained in:
@@ -77,6 +77,31 @@ public class StorageTests
|
||||
Assert.False(EncryptedFile.IsEncrypted("non è json"));
|
||||
}
|
||||
|
||||
// Regression: valid JSON whose root is not an object (found by the
|
||||
// property test) must not throw from TryGetProperty.
|
||||
[Theory]
|
||||
[InlineData("5")]
|
||||
[InlineData("true")]
|
||||
[InlineData("\"stringa\"")]
|
||||
[InlineData("[1, 2]")]
|
||||
public void IsEncrypted_restituisce_false_per_json_con_radice_non_oggetto(string content)
|
||||
{
|
||||
Assert.False(EncryptedFile.IsEncrypted(content));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsEncrypted_restituisce_false_per_utf16_invalido()
|
||||
{
|
||||
// Lone surrogate: cannot be transcoded to UTF-8 for JSON parsing.
|
||||
Assert.False(EncryptedFile.IsEncrypted("\ud800"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsEncrypted_restituisce_false_se_Format_non_e_una_stringa()
|
||||
{
|
||||
Assert.False(EncryptedFile.IsEncrypted("{\"Format\": 42}"));
|
||||
}
|
||||
|
||||
// ---- WalletDocument JSON ----
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user