예제 #1
0
        public async Task SendBlockTip_Should_Be_Able_To_Send_IBlockTipAsync()
        {
            TestingHttpClient.PrepareWorkingHttpClient(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(0).Log <object>(LogLevel.Error, 0, Arg.Any <object>(), Arg.Any <Exception>(), Arg.Any <Func <object, Exception, string> >());
        }
예제 #2
0
        public async Task SendMaturedBlockDeposits_Should_Be_Able_To_Send_IMaturedBlockDepositsAsync()
        {
            TestingHttpClient.PrepareWorkingHttpClient(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(0).Log <object>(LogLevel.Error, 0, Arg.Any <object>(), Arg.Any <Exception>(), 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);
        }