public void SingleAspect_SwallowException_SetResult_ShoultNotThrow() { // Arrange var aspect = new ReturnValueAspect(BoundaryType.Exception, "hello world"); var pipeline = CreatePipeline <IService>( new Service(), nameof(IService.ShouldNotThrow), Args.Pack(aspect)); // Act _executor.ExecutePipeline(pipeline, pipeline.Invocation); // Assert Assert.Equal(new[] { new BoundaryState(BoundaryType.Exception), new BoundaryState(BoundaryType.Entry), }, aspect.ExecutionStack); Assert.Equal("hello world", pipeline.Invocation.ReturnValue); Assert.Equal("hello world", pipeline.CurrentReturnValue); InvocationAssert.ProceedCalled(pipeline.Invocation); }
public async Task SingleAspect_ReturnOnEntry_ShouldNotCallBoundaries() { // Arrange var aspect = new ReturnValueAspect(BoundaryType.Entry, valueToReturn: 25); var pipeline = CreatePipeline <IService>( new Service(), nameof(IService.IdentityAsync), Args.Pack(aspect), Args.Box(10)); // Act _executor.ExecutePipeline(pipeline, pipeline.Invocation); var result = await Await <int>(pipeline.Invocation); // Assert Assert.Equal(25, result); Assert.Equal(new [] { new BoundaryState(BoundaryType.Entry), }, aspect.ExecutionStack); Assert.Equal(25, pipeline.CurrentReturnValue); InvocationAssert.ProceedNotCalled(pipeline.Invocation); }