예제 #1
0
        public void AddressGetNetwork()
        {
            NetworkParameters networkParameters = Address.getParametersFromAddress("17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL");

            Assert.Equal(NetworkParameters.prodNet().getId(), networkParameters.getId());
            networkParameters = Address.getParametersFromAddress("n4eA2nbYqErp7H6jebchxAN59DmNpksexv");
            Assert.Equal(NetworkParameters.testNet().getId(), networkParameters.getId());
        }
예제 #2
0
        public void AddressErrorPaths()
        {
            // Check what happens if we try and Decode garbage.
            Assert.Throws <AddressFormatException>(() => new Address(testParams, "this is not a valid address!"));

            // Check the empty case.
            Assert.Throws <AddressFormatException>(() => new Address(testParams, ""));

            // Check the case of a mismatched network.
            try {
                new Address(testParams, "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL");
                Assert.True(false, "expected exception not thrown.");
            } catch (WrongNetworkException e) {
                // Success.
                Assert.Equal(NetworkParameters.prodNet().addressHeader, e.VerCode);
                Assert.Equal(NetworkParameters.testNet().acceptableAddressCodes, e.AcceptableVersions);
            }
        }