コード例 #1
0
            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));
            }
コード例 #2
0
            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;
            }
コード例 #3
0
            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;
            }
コード例 #4
0
 public void OnResumed(object sender, string message) => ResumedEvent?.Invoke(sender, message);