public void GetBlockAsyncBlockNotInCacheQueriesRepositoryStoresBlockInCacheAndReturnsBlock()
        {
            uint256 blockId         = new uint256(2389704);
            Block   repositoryBlock = new Block();

            repositoryBlock.Header.Version = 1451;
            this.blockRepository.Setup(b => b.GetAsync(blockId))
            .Returns(Task.FromResult(repositoryBlock));

            var memoryCacheStub = new MemoryCacheStub();

            this.blockStoreCache = new BlockStoreCache(this.blockRepository.Object, memoryCacheStub);

            var result = this.blockStoreCache.GetBlockAsync(blockId);

            result.Wait();

            Assert.Equal(blockId, memoryCacheStub.GetLastCreateCalled());
            Assert.Equal(1451, result.Result.Header.Version);
        }
        public void GetBlockByTrxAsyncBlockNotInCacheLookupInRepository()
        {
            uint256 txId    = new uint256(3252);
            uint256 blockId = new uint256(2389704);
            Block   block   = new Block();

            block.Header.Version = 1451;
            var dict = new Dictionary <object, object>();

            dict.Add(blockId, block);

            var memoryCacheStub = new MemoryCacheStub(dict);

            this.blockStoreCache = new BlockStoreCache(this.blockRepository.Object, memoryCacheStub);
            this.blockRepository.Setup(b => b.GetTrxBlockIdAsync(txId))
            .Returns(Task.FromResult(blockId));

            var result = this.blockStoreCache.GetBlockByTrxAsync(txId);

            result.Wait();

            Assert.Equal(1451, result.Result.Header.Version);
            Assert.Equal(txId, memoryCacheStub.GetLastCreateCalled());
        }