예제 #1
0
    public void TestValidateHeader(bool baseReturnValue, bool isInvalidBlockReported)
    {
        BlockHeader header = Build.A.BlockHeader.TestObject;

        _baseValidator.Validate(header, false).Returns(baseReturnValue);
        _invalidHeaderInterceptor.Validate(header, false);

        _tracker.Received().SetChildParent(header.Hash, header.ParentHash);
        if (isInvalidBlockReported)
        {
            _tracker.Received().OnInvalidBlock(header.Hash, header.ParentHash);
        }
        else
        {
            _tracker.DidNotReceive().OnInvalidBlock(header.Hash, header.ParentHash);
        }
    }
예제 #2
0
    public void TestValidateSuggestedBlock(bool baseReturnValue, bool isInvalidBlockReported)
    {
        Block block = Build.A.Block.TestObject;

        _baseValidator.ValidateSuggestedBlock(block).Returns(baseReturnValue);
        _invalidBlockInterceptor.ValidateSuggestedBlock(block);

        _tracker.Received().SetChildParent(block.Hash, block.ParentHash);
        if (isInvalidBlockReported)
        {
            _tracker.Received().OnInvalidBlock(block.Hash, block.ParentHash);
        }
        else
        {
            _tracker.DidNotReceive().OnInvalidBlock(block.Hash, block.ParentHash);
        }
    }