BitSharper.Test.BlockChainTest.TestBasicChaining C# (CSharp) Method

TestBasicChaining() private method

private TestBasicChaining ( ) : void
return void
        public void TestBasicChaining()
        {
            // Check that we can plug a few blocks together.
            // Block 1 from the testnet.
            var b1 = GetBlock1();
            Assert.IsTrue(_testNetChain.Add(b1));
            // Block 2 from the testnet.
            var b2 = GetBlock2();

            // Let's try adding an invalid block.
            var n = b2.Nonce;
            try
            {
                b2.Nonce = 12345;
                _testNetChain.Add(b2);
                Assert.Fail();
            }
            catch (VerificationException)
            {
                b2.Nonce = n;
            }

            // Now it works because we reset the nonce.
            Assert.IsTrue(_testNetChain.Add(b2));
        }