Example #1
0
        public void Equals_WithEquals_ShouldReturnTrue()
        {
            var tester = new StandardEqualityTester <Block>(
                this.subject,
                s => s,
                s => new Block(s.Height, s.Hash, s.Time, s.Version, s.Target, s.Nonce, s.MerkleRoot),
                s => new Block(s.Height, uint256.One, s.Time, s.Version, s.Target, s.Nonce, s.MerkleRoot),
                s => new Block(s.Height, s.Hash, DateTime.Now, s.Version, s.Target, s.Nonce, s.MerkleRoot),
                s => new Block(s.Height, s.Hash, s.Time, 10, s.Target, s.Nonce, s.MerkleRoot),
                s => new Block(s.Height, s.Hash, s.Time, s.Version, Target.Difficulty1, s.Nonce, s.MerkleRoot),
                s => new Block(s.Height, s.Hash, s.Time, s.Version, s.Target, 100, s.MerkleRoot),
                s => new Block(s.Height, s.Hash, s.Time, s.Version, s.Target, s.Nonce, uint256.One),
                s => new Block(s.Height, s.Hash, s.Time, s.Version, s.Target, s.Nonce, s.MerkleRoot)
            {
                MtpData = new MtpData(s.Hash, uint256.One, 100, uint256.Zero, uint256.Zero),
            },
                s =>
            {
                var o = new Block(s.Height, s.Hash, s.Time, s.Version, s.Target, s.Nonce, s.MerkleRoot);
                o.Transactions.Add(new BlockTransaction(s.Hash, 0, uint256.One));
                return(o);
            });

            Assert.DoesNotContain(false, tester);
        }
Example #2
0
        public void Equals_WithUnequals_ShouldReturnFalse()
        {
            var tester = new StandardEqualityTester <Block>(
                this.subject,
                s => null,
                s => string.Empty,
                s => new Block(s.Height + 1, s.Hash, s.Time, s.Version, s.Target, s.Nonce, s.MerkleRoot));

            Assert.DoesNotContain(true, tester);
        }
Example #3
0
        public void Equals_WithUnequals_ShouldReturnFalse()
        {
            var tester = new StandardEqualityTester <Input>(
                this.subject,
                s => null,
                s => string.Empty,
                s => new Input(s.TransactionHash, 0, s.OutputHash, s.OutputIndex, s.Script, s.Sequence));

            Assert.DoesNotContain(true, tester);
        }
Example #4
0
        public void Equals_WithUnequals_ShouldReturnFalse()
        {
            var tester = new StandardEqualityTester <BlockTransaction>(
                this.subject,
                s => null,
                s => string.Empty,
                s => new BlockTransaction(uint256.One, s.Index, s.TransactionHash),
                s => new BlockTransaction(s.BlockHash, 0, s.TransactionHash));

            Assert.DoesNotContain(true, tester);
        }
Example #5
0
        public void Equals_WithEquals_ShouldReturnTrue()
        {
            var tester = new StandardEqualityTester <Output>(
                this.subject,
                s => s,
                s => new Output(s.TransactionHash, s.Index, s.Script, s.Value),
                s => new Output(uint256.One, s.Index, s.Script, s.Value),
                s => new Output(s.TransactionHash, s.Index, Script.Empty, s.Value),
                s => new Output(s.TransactionHash, s.Index, s.Script, 0));

            Assert.DoesNotContain(false, tester);
        }
Example #6
0
        public void Equals_WithEquals_ShouldReturnTrue()
        {
            var tester = new StandardEqualityTester <BlockTransaction>(
                this.subject,
                s => s,
                s => new BlockTransaction(s.BlockHash, s.Index, s.TransactionHash),
                s => new BlockTransaction(s.BlockHash, s.Index, uint256.One),
                s => new BlockTransaction(s.BlockHash, s.Index, s.TransactionHash)
            {
                Block = new Block(0, uint256.Zero, DateTime.Now, 0, Target.Difficulty1, 0, uint256.Zero),
            },
                s => new BlockTransaction(s.BlockHash, s.Index, s.TransactionHash)
            {
                Transaction = new Transaction(uint256.Zero, TransactionType.Coinbase, 0, 0),
            });

            Assert.DoesNotContain(false, tester);
        }
 public StandardEqualityTesterTests()
 {
     this.comparand   = new FakeComparand();
     this.comparator1 = new object();
     this.subject     = new StandardEqualityTester <FakeComparand>(this.comparand, s => this.comparator1, s => null);
 }