public void Should_become_unhealthy_after_failed_send()
        {
            sender
            .SendAsync(Arg.Any <TimeSpan>(), Arg.Any <CancellationToken>())
            .Returns(SendResult(HerculesStatus.NetworkError));

            Send();

            job.IsHealthy.Should().BeFalse();
        }
Beispiel #2
0
 public async Task SendAsync(CancellationToken cancellationToken)
 {
     try
     {
         lastSendResult = await sender.SendAsync(requestTimeout, cancellationToken).ConfigureAwait(false);
     }
     catch (Exception error)
     {
         if (!cancellationToken.IsCancellationRequested)
         {
             log.Error(error);
         }
     }
 }
        public void TestSetup()
        {
            sender = Substitute.For <IStreamSender>();
            sender
            .SendAsync(Arg.Any <TimeSpan>(), Arg.Any <CancellationToken>())
            .Returns(SendResult(HerculesStatus.Success));

            planner = Substitute.For <IPlanner>();
            planner
            .WaitForNextSendAsync(Arg.Any <StreamSendResult>(), Arg.Any <CancellationToken>())
            .Returns(Task.CompletedTask);

            log = new SynchronousConsoleLog();

            job = new StreamJob(sender, planner, log, RequestTimeout);
        }