diff --git a/src/Appeaser.Tests/PipelineTests.cs b/src/Appeaser.Tests/PipelineTests.cs index 84a3cfb..894b6c2 100644 --- a/src/Appeaser.Tests/PipelineTests.cs +++ b/src/Appeaser.Tests/PipelineTests.cs @@ -72,6 +72,20 @@ public void TestInterception() Assert.True(interceptor.ResponseWasIntercepted); } + [Fact] + public void TestInterceptionAsync() + { + var interceptor = new Interceptor(); + var settings = new MediatorSettings().AddInterceptor(); + A.CallTo(() => _handler.GetHandler(A.That.IsEqualTo(typeof(Interceptor)))).Returns(interceptor); + var mediator = new Mediator(_handler, settings); + + mediator.Send(new CommandFeature.AsyncCommand()); + + Assert.True(interceptor.RequestWasIntercepted); + Assert.True(interceptor.ResponseWasIntercepted); + } + [Fact] public void TestReponseExceptionInterception() { diff --git a/src/Appeaser/Appeaser.csproj b/src/Appeaser/Appeaser.csproj index 681b5f8..3072ddf 100644 --- a/src/Appeaser/Appeaser.csproj +++ b/src/Appeaser/Appeaser.csproj @@ -3,7 +3,7 @@ netstandard2.0;netstandard1.0;net45 Carl Berg Copyright (c) $([System.DateTime]::Now.Year) Carl Berg - 2.3.3 + 2.3.4 true Appeaser, the appeasing mediator MIT diff --git a/src/Appeaser/Interception/MediatorInterceptor.cs b/src/Appeaser/Interception/MediatorInterceptor.cs index 4082b0a..b856a62 100644 --- a/src/Appeaser/Interception/MediatorInterceptor.cs +++ b/src/Appeaser/Interception/MediatorInterceptor.cs @@ -60,7 +60,7 @@ public async Task InvokeHandlerAsync(object handler, objec var result = await invocation(scope); - foreach (var interceptor in ResolveInterceptors(x => x.ResponseInterceptors).Reverse()) + foreach (var interceptor in ResolveInterceptors(x => x.ResponseInterceptors).Reverse()) { await interceptor.InterceptAsync(scope.CreateResponseInterceptionContext(result)); } @@ -70,7 +70,7 @@ public async Task InvokeHandlerAsync(object handler, objec catch (Exception ex) { var exception = ex is TargetInvocationException ? ex.InnerException : ex; - foreach (var interceptor in ResolveInterceptors(x => x.ResponseInterceptors).Reverse()) + foreach (var interceptor in ResolveInterceptors(x => x.ResponseInterceptors).Reverse()) { await interceptor.InterceptAsync(scope.CreateExceptionInterceptionContext(exception)); }