コード例 #1
0
        public void TryTake_WrongIndex_After_RegisterNewChain()
        {
            int chainId = 123;

            _crossChainCacheEntityProvider.AddChainCacheEntity(chainId, 1);
            CrossChainCacheEntityProvider.TryGetChainCacheEntity(chainId, out var blockInfoCache);
            Assert.NotNull(blockInfoCache);
            var expectedBlockInfo = CreateSideChainBlockData(chainId, 1);

            blockInfoCache.TryAdd(expectedBlockInfo);
            var blockInfo = _blockCacheEntityConsumer.Take <SideChainBlockData>(chainId, 2, false);

            Assert.Null(blockInfo);
        }
コード例 #2
0
        public void TryTake_After_RegisterNewChain()
        {
            int chainId = 123;

            _crossChainCacheEntityProvider.AddChainCacheEntity(chainId, 1);
            var blockInfoCache = CrossChainCacheEntityProvider.GetChainCacheEntity(chainId);

            Assert.NotNull(blockInfoCache);
            var expectedBlockInfo = CreateSideChainBlockData(chainId, 1);

            blockInfoCache.TryAdd(expectedBlockInfo);
            var actualBlockInfo = _blockCacheEntityConsumer.Take <SideChainBlockData>(chainId, 1, false);

            Assert.Equal(expectedBlockInfo, actualBlockInfo);
        }