public async Task SendBlockTip_Should_Log_Error_When_Failing_To_Send_IBlockTipAsync() { TestingHttpClient.PrepareFailingHttpClient(ref this.messageHandler, ref this.httpClient, ref this.httpClientFactory); var restSender = new RestBlockTipSender(this.loggerFactory, this.federationSettings, this.httpClientFactory); var blockTip = new BlockTipModel(TestingValues.GetUint256(), TestingValues.GetPositiveInt(), TestingValues.GetPositiveInt()); await restSender.SendBlockTipAsync(blockTip).ConfigureAwait(false); this.logger.Received(1).Log <object>(LogLevel.Error, 0, Arg.Any <object>(), Arg.Is <Exception>(e => e != null), Arg.Any <Func <object, Exception, string> >()); }
public async Task SendMaturedBlockDeposits_Should_Log_Error_When_Failing_To_Send_MaturedBlockDepositAsync() { TestingHttpClient.PrepareFailingHttpClient(ref this.messageHandler, ref this.httpClient, ref this.httpClientFactory); var maturedBlockDeposits = TestingValues.GetMaturedBlockDeposits(); var restSender = new RestMaturedBlockSender(this.loggerFactory, this.federationSettings, this.httpClientFactory); await restSender.SendMaturedBlockDepositsAsync(maturedBlockDeposits).ConfigureAwait(false); this.logger.Received(1).Log <object>(LogLevel.Error, 0, Arg.Any <object>(), Arg.Is <Exception>(e => e != null), Arg.Any <Func <object, Exception, string> >()); }
private FederationGatewayClient createClient(bool isFailingClient = false) { if (isFailingClient) { TestingHttpClient.PrepareFailingHttpClient(ref this.messageHandler, ref this.httpClient, ref this.httpClientFactory); } else { TestingHttpClient.PrepareWorkingHttpClient(ref this.messageHandler, ref this.httpClient, ref this.httpClientFactory); } IFederationGatewaySettings federationSettings = Substitute.For <IFederationGatewaySettings>(); FederationGatewayClient client = new FederationGatewayClient(this.loggerFactory, federationSettings, this.httpClientFactory); return(client); }