public async Task ShouldNotCallTargetForTaskMethod() { Mock <IInterceptor> targetInterceptor = new Mock <IInterceptor>(); var sampleInterceptor = new SampleAsyncInterceptor(targetInterceptor.Object); var targetMock = new Mock <IMethodWithTaskReturnValue>(); var proxy = CreateProxy(targetMock.Object, sampleInterceptor); await proxy.Execute(); targetInterceptor.Verify(m => m.Invoke(It.IsAny <IInvocationInfo>()), Times.Never); }
public async Task ShouldInterceptAsyncTaskOfTMethod() { Mock <IInterceptor> targetInterceptor = new Mock <IInterceptor>(); var sampleInterceptor = new SampleAsyncInterceptor(targetInterceptor.Object); var targetMock = new Mock <IMethodWithTaskOfTReturnValue>(); var proxy = CreateProxy(targetMock.Object, sampleInterceptor); await proxy.Execute(); Assert.True(sampleInterceptor.InterceptedTaskOfTMethod); }