public BlockStoreCacheTest() { this.blockRepository = new Mock <Bitcoin.BlockStore.IBlockRepository>(); this.cache = new Mock <IMemoryCache>(); this.blockStoreCache = new BlockStoreCache(this.blockRepository.Object, this.cache.Object); }
public BlockStoreCacheTest() { this.loggerFactory = new LoggerFactory(); this.blockRepository = new Mock <IBlockRepository>(); this.storeSettings = new StoreSettings(new Configuration.NodeSettings()); this.blockStoreCache = new BlockStoreCache(this.blockRepository.Object, DateTimeProvider.Default, this.loggerFactory, this.storeSettings); }
public BlockStoreCacheTest() { this.loggerFactory = new LoggerFactory(); this.network = KnownNetworks.StratisMain; this.blockRepository = new Mock <IBlockRepository>(); this.storeSettings = new StoreSettings(); this.blockStoreCache = new BlockStoreCache(this.blockRepository.Object, DateTimeProvider.Default, this.loggerFactory, this.storeSettings); }
public WalletSyncManager(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain, Network network, BlockStoreCache blockStoreCache, NodeSettings nodeSettings) { this.walletManager = walletManager as WalletManager; this.chain = chain; this.blockStoreCache = blockStoreCache; this.coinType = (CoinType)network.Consensus.CoinType; this.nodeSettings = nodeSettings; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); }
public BlockStoreCacheTest() { this.loggerFactory = new LoggerFactory(); this.blockRepository = new Mock <IBlockRepository>(); this.nodeSettings = new NodeSettings(); this.nodeSettings.LoadArguments(new string[] { }); this.blockStoreCache = new BlockStoreCache(this.blockRepository.Object, DateTimeProvider.Default, this.loggerFactory, this.nodeSettings); }
public BlockStoreCacheTest() { this.loggerFactory = new LoggerFactory(); this.blockRepository = new Mock <IBlockRepository>(); this.cache = new Mock <IMemoryCache>(); this.nodeSettings = new NodeSettings { ConnectionManager = new Configuration.Settings.ConnectionManagerSettings() }; this.nodeSettings.LoadArguments(new string[] { }); this.blockStoreCache = new BlockStoreCache(this.blockRepository.Object, DateTimeProvider.Default, this.loggerFactory, this.nodeSettings, this.cache.Object); }
public void GetBlockAsyncBlockNotInCacheQueriesRepositoryStoresBlockInCacheAndReturnsBlock() { var blockId = new uint256(2389704); Block repositoryBlock = this.network.CreateBlock(); repositoryBlock.Header.Version = 1451; this.blockRepository.Setup(b => b.GetAsync(blockId)).Returns(Task.FromResult(repositoryBlock)); this.blockStoreCache = new BlockStoreCache(this.blockRepository.Object, DateTimeProvider.Default, this.loggerFactory, this.storeSettings); Task <Block> result = this.blockStoreCache.GetBlockAsync(blockId); result.Wait(); 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.loggerFactory); 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()); }