public async Task ShouldRestartTheGatewayServiceWithIsResumable( bool resumable, [Frozen, Substitute] IGatewayService gateway, [Target] InvalidSessionEventController controller ) { var cancellationToken = new CancellationToken(false); var @event = new InvalidSessionEvent(resumable); await controller.Handle(@event, cancellationToken); await gateway.Received().Restart(Is(resumable)); }
public async Task ShouldReportAReconnectMetric( bool resumable, [Frozen, Substitute] IMetricReporter reporter, [Target] InvalidSessionEventController controller ) { var cancellationToken = new CancellationToken(false); var @event = new InvalidSessionEvent(resumable); await controller.Handle(@event, cancellationToken); await reporter.Received().Report(Is(default(InvalidSessionEventMetric)), Is(cancellationToken)); }
public async Task ShouldThrowIfCanceled( bool resumable, [Frozen, Substitute] IGatewayService gateway, [Target] InvalidSessionEventController controller ) { var cancellationToken = new CancellationToken(true); var @event = new InvalidSessionEvent(resumable); Func <Task> func = () => controller.Handle(@event, cancellationToken); await func.Should().ThrowAsync <OperationCanceledException>(); await gateway.DidNotReceive().Restart(); }