public async Task ShouldSetTheGatewayIsReadyPropToTrue( string sessionId, [Frozen, Substitute] IGatewayService gateway, [Target] ResumedEventController controller ) { var cancellationToken = new CancellationToken(false); var @event = new ResumedEvent { }; await controller.Handle(@event, cancellationToken); gateway.Received().IsReady = true; }
public async Task ShouldReportAResumedMetric( string sessionId, [Frozen, Substitute] IMetricReporter reporter, [Target] ResumedEventController controller ) { var cancellationToken = new CancellationToken(false); var @event = new ResumedEvent { }; await controller.Handle(@event, cancellationToken); await reporter.Received().Report(Is(default(ResumedEventMetric)), Is(cancellationToken)); }
public async Task ShouldThrowIfCanceled( string sessionId, [Frozen, Substitute] IGatewayService gateway, [Target] ResumedEventController controller ) { var cancellationToken = new CancellationToken(true); var @event = new ResumedEvent { }; Func <Task> func = () => controller.Handle(@event, cancellationToken); await func.Should().ThrowAsync <OperationCanceledException>(); gateway.DidNotReceive().IsReady = true; }