예제 #1
0
 public async Task CannotCallOnOperationExecutedAsyncWithNullContext()
 {
     var         testClass = new ConventionBasedOperationFilter(typeof(EmptyApi));
     Func <Task> act       = () => testClass.OnOperationExecutedAsync(
         default(OperationContext),
         CancellationToken.None);
     await act.Should().ThrowAsync <ArgumentNullException>();
 }
예제 #2
0
 public async Task CanCallOnOperationExecutedAsync()
 {
     var api       = new EmptyApi(serviceProvider);
     var testClass = new ConventionBasedOperationFilter(typeof(EmptyApi));
     var context   = new OperationContext(
         api,
         s => new object(),
         "Test",
         true,
         null);
     var cancellationToken = CancellationToken.None;
     await testClass.OnOperationExecutedAsync(context, cancellationToken);
 }
예제 #3
0
        public async Task OnOperationExecutedAsyncInvokesConventionMethod()
        {
            var api       = new ExecuteApi(serviceProvider);
            var testClass = new ConventionBasedOperationFilter(typeof(ExecuteApi));
            var context   = new OperationContext(
                api,
                s => new object(),
                "Test",
                true,
                null);
            var cancellationToken = CancellationToken.None;
            await testClass.OnOperationExecutedAsync(context, cancellationToken);

            api.InvocationCount.Should().Be(1);
        }