From 61ed0c0ed0cc6ce2712ee01c94487f20c7a88f16 Mon Sep 17 00:00:00 2001 From: Davide Grilli Date: Tue, 7 Jul 2026 16:25:20 +0200 Subject: [PATCH] test(chain): cover PalladiumNetworks.For and the INetworkSet plumbing The out-of-range throw in For(NetKind) and the entire PalladiumNetworkSet class (CryptoCode, the three network getters, GetNetwork including its throw for an unrecognised ChainName) had no coverage. --- .../Chain/PalladiumNetworksTests.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/PalladiumWallet.Tests/Chain/PalladiumNetworksTests.cs b/tests/PalladiumWallet.Tests/Chain/PalladiumNetworksTests.cs index 96014a6..a92cab0 100644 --- a/tests/PalladiumWallet.Tests/Chain/PalladiumNetworksTests.cs +++ b/tests/PalladiumWallet.Tests/Chain/PalladiumNetworksTests.cs @@ -75,4 +75,25 @@ public class PalladiumNetworksTests Assert.NotSame(PalladiumNetworks.Testnet, PalladiumNetworks.Regtest); Assert.Same(PalladiumNetworks.Mainnet, PalladiumNetworks.For(NetKind.Mainnet)); } + + [Fact] + public void For_con_un_kind_fuori_enum_lancia_eccezione() + { + Assert.Throws(() => PalladiumNetworks.For((NetKind)99)); + } + + [Fact] + public void Il_network_set_espone_le_tre_reti_sotto_il_codice_plm() + { + var set = PalladiumNetworkSet.Instance; + + Assert.Equal("PLM", set.CryptoCode); + Assert.Same(PalladiumNetworks.Mainnet, set.Mainnet); + Assert.Same(PalladiumNetworks.Testnet, set.Testnet); + Assert.Same(PalladiumNetworks.Regtest, set.Regtest); + Assert.Same(PalladiumNetworks.Mainnet, set.GetNetwork(ChainName.Mainnet)); + Assert.Same(PalladiumNetworks.Testnet, set.GetNetwork(ChainName.Testnet)); + Assert.Same(PalladiumNetworks.Regtest, set.GetNetwork(ChainName.Regtest)); + Assert.Throws(() => set.GetNetwork(new ChainName("signet"))); + } }