public TransactionEncoderTests()
        {
            this.encoder0 = Substitute.For <ITransactionPayloadEncoder>();
            this.encoder0.Type.Returns(0);

            this.encoder1 = Substitute.For <ITransactionPayloadEncoder>();
            this.encoder1.Type.Returns(1);

            this.subject = new TransactionEncoder(new[] { this.encoder0, this.encoder1 });
        }
        public void EncodeDecodeTransaction()
        {
            TransactionEncoder encoder = new TransactionEncoder();
            var sender   = new Address();
            var receiver = new Address();

            Transaction transaction = new Transaction(sender, receiver, new BigInteger(100));

            var result = encoder.Decode(encoder.Encode(transaction));

            Assert.IsNotNull(result);

            Assert.IsNotNull(result.Receiver);
            Assert.AreEqual(receiver, result.Receiver);

            Assert.IsNotNull(result.Sender);
            Assert.AreEqual(sender, result.Sender);

            Assert.AreEqual(new BigInteger(100), result.Value);
        }