public MaturedBlocksSyncManagerTests() { ILoggerFactory loggerFactory = Substitute.For <ILoggerFactory>(); this.federationGatewayClient = Substitute.For <IFederationGatewayClient>(); this.crossChainTransferStore = Substitute.For <ICrossChainTransferStore>(); this.syncManager = new TestOnlyMaturedBlocksSyncManager(this.crossChainTransferStore, this.federationGatewayClient, loggerFactory); }
public MaturedBlocksSyncManagerTests() { this.asyncProvider = Substitute.For <IAsyncProvider>(); this.crossChainTransferStore = Substitute.For <ICrossChainTransferStore>(); this.federationGatewayClient = Substitute.For <IFederationGatewayClient>(); ILoggerFactory loggerFactory = Substitute.For <ILoggerFactory>(); this.syncManager = new TestOnlyMaturedBlocksSyncManager(this.asyncProvider, this.crossChainTransferStore, this.federationGatewayClient, loggerFactory, new NodeLifetime()); }
public async Task NodeIsInIBD_DelayRequiredAsync() { this.initialBlockDownloadState = Substitute.For <IInitialBlockDownloadState>(); this.initialBlockDownloadState.IsInitialBlockDownload().Returns(true); this.syncManager = new TestOnlyMaturedBlocksSyncManager(this.asyncProvider, this.chainIndexer, this.crossChainTransferStore, this.federationGatewayClient, this.federationWalletManager, this.initialBlockDownloadState, new NodeLifetime()); bool delayRequired = await this.syncManager.ExposedSyncBatchOfBlocksAsync(); Assert.True(delayRequired); }
public MaturedBlocksSyncManagerTests() { this.network = new StraxTest(); this.asyncProvider = Substitute.For <IAsyncProvider>(); this.chainIndexer = new ChainIndexer(this.network); this.crossChainTransferStore = Substitute.For <ICrossChainTransferStore>(); this.federationGatewayClient = Substitute.For <IFederationGatewayClient>(); this.federationWalletManager = Substitute.For <IFederationWalletManager>(); this.federationWalletManager.WalletTipHeight.Returns(0); this.initialBlockDownloadState = Substitute.For <IInitialBlockDownloadState>(); this.initialBlockDownloadState.IsInitialBlockDownload().Returns(false); this.syncManager = new TestOnlyMaturedBlocksSyncManager(this.asyncProvider, this.chainIndexer, this.crossChainTransferStore, this.federationGatewayClient, this.federationWalletManager, this.initialBlockDownloadState, new NodeLifetime()); }
public async Task FederationWalletIsSyncing_DelayRequiredAsync() { this.initialBlockDownloadState = Substitute.For <IInitialBlockDownloadState>(); this.initialBlockDownloadState.IsInitialBlockDownload().Returns(false); // Create chain of 15 blocks var testbase = new TestBase(this.network); List <Block> blocks = new TestBase(this.network).CreateBlocks(15); testbase.AppendBlocksToChain(this.chainIndexer, blocks); this.federationWalletManager = Substitute.For <IFederationWalletManager>(); this.federationWalletManager.WalletTipHeight.Returns(0); this.syncManager = new TestOnlyMaturedBlocksSyncManager(this.asyncProvider, this.chainIndexer, this.crossChainTransferStore, this.federationGatewayClient, this.federationWalletManager, this.initialBlockDownloadState, new NodeLifetime()); bool delayRequired = await this.syncManager.ExposedSyncBatchOfBlocksAsync(); Assert.True(delayRequired); }