public async Task CannotCallOnOperationExecutedAsyncWithNullContext() { var testClass = new ConventionBasedOperationFilter(typeof(EmptyApi)); Func <Task> act = () => testClass.OnOperationExecutedAsync( default(OperationContext), CancellationToken.None); await act.Should().ThrowAsync <ArgumentNullException>(); }
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); }
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); }