Exemplo n.º 1
0
 public BlockTransactionTests()
 {
     this.subject = new BlockTransaction()
     {
         BlockHash = uint256.One,
         Index     = 1
     };
 }
Exemplo n.º 2
0
        public void CompareTo_WithLowerIndex_ShouldGreater()
        {
            var other = new BlockTransaction(
                this.subject.BlockHash,
                this.subject.Index - 1,
                this.subject.TransactionHash);

            var result = this.subject.CompareTo(other);

            Assert.True(result > 0);
        }
Exemplo n.º 3
0
        public void CompareTo_WithGreaterIndex_ShouldReturnNegative()
        {
            var other = new BlockTransaction(
                this.subject.BlockHash,
                this.subject.Index + 1,
                this.subject.TransactionHash);

            var result = this.subject.CompareTo(other);

            Assert.True(result < 0);
        }
Exemplo n.º 4
0
        public void CompareTo_LowerBlockHash_ShouldReturnPositive()
        {
            var other = new BlockTransaction(
                uint256.Parse("046217b009a488569697af675d623bb9fc438cbac2a762efae249239f43bcd65"),
                this.subject.Index,
                this.subject.TransactionHash);

            var result = this.subject.CompareTo(other);

            Assert.True(result > 0);
        }
Exemplo n.º 5
0
        public void CompareTo_WithSameBlockHashAndIndex_ShouldReturnZero()
        {
            var other = new BlockTransaction(
                this.subject.BlockHash,
                this.subject.Index,
                this.subject.TransactionHash);

            var result = this.subject.CompareTo(other);

            Assert.Equal(0, result);
        }
Exemplo n.º 6
0
 public DataBlock(int index, int proof, string previousHash, string currentHash, long timeStamp, BlockTransaction transactions)
 {
     this.Index        = index;
     this.Proof        = proof;
     this.PreviousHash = previousHash;
     this.CurrentHash  = currentHash;
     this.TimeStamp    = timeStamp;
     this.Transaction  = transactions;
 }
Exemplo n.º 7
0
 public BlockTransactionTests()
 {
     this.block       = uint256.Parse("046217b009a488569697af675d623bb9fc438cbac2a762efae249239f43bcd66");
     this.transaction = uint256.Parse("9d80e018f3a876fe050c8efc9eff71504316491c30f333931979261e3d888807");
     this.subject     = new BlockTransaction(this.block, 1, this.transaction);
 }
Exemplo n.º 8
0
        public void GetHashCode_WithSameBlockHashAndIndex_ShouldReturnSameValue()
        {
            var other = new BlockTransaction(this.subject.BlockHash, this.subject.Index, this.subject.TransactionHash);

            Assert.Equal(this.subject.GetHashCode(), other.GetHashCode());
        }
Exemplo n.º 9
0
        public void GetHashCode_WithDifferentBlockHashAndIndex_ShouldReturnDifferentValue(string blockHash, int index)
        {
            var other = new BlockTransaction(uint256.Parse(blockHash), index, this.subject.TransactionHash);

            Assert.NotEqual(this.subject.GetHashCode(), other.GetHashCode());
        }