public void GetBlockQuery_Should_Return_Null_When_More_Do_Not_Found_Block()
        {
            var dbContext = GetDatabase();
            var query     = new GetBlockQueryHandler(dbContext);

            var block = query.Handle(new GetBlockQuery()
            {
                BlockHash = "BLOCK_4",
                Type      = GetBlockQueryType.PreviousInMainChain
            });

            Assert.Null(block);
        }
        public void GetBlockQuery_Should_Return_Proper_Block_When_BlockHash_Is_Defined()
        {
            var dbContext = GetDatabase();
            var query     = new GetBlockQueryHandler(dbContext);

            var block = query.Handle(new GetBlockQuery()
            {
                BlockHash = "BLOCK_4"
            });

            Assert.True(block.BlockHash == "BLOCK_4");
            Assert.True(block.BlockHashPrevious == "BLOCK_1");
            Assert.True(block.Length == 2);
        }
        public void GetBlockQuery_Should_Return_Proper_Block_InMainChain_When_BlockHash_And_Previous_Are_Defined_With_Branch()
        {
            var dbContext = GetDatabase();
            var query     = new GetBlockQueryHandler(dbContext);

            var block = query.Handle(new GetBlockQuery()
            {
                BlockHash = "BLOCK_1",
                Type      = GetBlockQueryType.PreviousInMainChain
            });

            Assert.True(block.BlockHash == "BLOCK_2");
            Assert.True(block.BlockHashPrevious == "BLOCK_1");
            Assert.True(block.Length == 2);
            Assert.True(block.IsInMainChain);
        }