示例#1
0
            public async Task ShouldThrowIfCanceled(
                IMetric <double> metric,
                [Frozen, Substitute] IAmazonCloudWatch cloudwatch,
                [Target] CloudWatchMetricReporter reporter
                )
            {
                var         cancellationToken = new CancellationToken(true);
                Func <Task> func = () => reporter.Report(metric, cancellationToken);

                await func.Should().ThrowAsync <OperationCanceledException>();

                await cloudwatch.DidNotReceive().PutMetricDataAsync(Any <PutMetricDataRequest>(), Any <CancellationToken>());
            }