public void Should_receive_AggregateException_with_both_exceptions() { var context = new Context(); Scenario.Define(context) .WithEndpoint <Endpoint>(b => b.Given(bus => bus.SendLocal(new Message()))) .AllowExceptions() .Done(c => c.ExceptionReceived) .Run(); Assert.AreEqual(typeof(BeginException), context.InnerExceptionOneType); Assert.AreEqual(typeof(EndException), context.InnerExceptionTwoType); StackTraceAssert.StartsWith( @"at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context) at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message) at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message)", context.StackTrace); StackTraceAssert.StartsWith( string.Format(@"at NServiceBus.AcceptanceTests.Exceptions.When_Uow_Begin_and_different_End_throws.Endpoint.{0}.End(Exception ex) at NServiceBus.UnitOfWorkBehavior.AppendEndExceptionsAndRethrow(Exception initialException)", context.TypeName), context.InnerExceptionTwoStackTrace); }
public void Should_receive_exception_from_handler() { var context = new Context(); Scenario.Define(context) .WithEndpoint <Endpoint>(b => b.Given(bus => bus.SendLocal(new Message()))) .AllowExceptions() .Done(c => c.ExceptionReceived) .Run(); Assert.AreEqual(typeof(HandlerException), context.ExceptionType); StackTraceAssert.StartsWith( @"at NServiceBus.AcceptanceTests.Exceptions.When_handler_throws.Endpoint.Handler.Handle(Message message) at NServiceBus.Unicast.MessageHandlerRegistry.Invoke(Object handler, Object message, Dictionary`2 dictionary) at NServiceBus.InvokeHandlersBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.SetCurrentMessageBeingHandledBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.LoadHandlersBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ApplyIncomingMessageMutatorsBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ExecuteLogicalMessagesBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.CallbackInvocationBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.DeserializeLogicalMessagesBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ApplyIncomingTransportMessageMutatorsBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.SubscriptionReceiverBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context) at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message) at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message) at NServiceBus.Transports.Msmq.MsmqDequeueStrategy.Action()", context.StackTrace); }
public void Should_receive_AggregateException_with_both_exceptions() { var context = new Context(); Scenario.Define(context) .WithEndpoint <Endpoint>(b => b.Given(bus => bus.SendLocal(new Message()))) .AllowExceptions() .Done(c => c.ExceptionReceived) .Run(); Assert.AreEqual(typeof(HandlerException), context.InnerExceptionOneType); Assert.AreEqual(typeof(EndException), context.InnerExceptionTwoType); #if (!DEBUG) StackTraceAssert.StartsWith( @"at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context) at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message) at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message)", context.StackTrace); StackTraceAssert.StartsWith( @"at NServiceBus.AcceptanceTests.Exceptions.When_handler_and_Uow_End_throws.Endpoint.Handler.Handle(Message message) at NServiceBus.Unicast.MessageHandlerRegistry.Invoke(Object handler, Object message, Dictionary`2 dictionary) at NServiceBus.InvokeHandlersBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.SetCurrentMessageBeingHandledBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.LoadHandlersBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.Transports.SQLServer.ReadIncomingCallbackAddressBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ApplyIncomingMessageMutatorsBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ExecuteLogicalMessagesBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.DeserializeLogicalMessagesBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.CallbackInvocationBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ApplyIncomingTransportMessageMutatorsBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.SubscriptionReceiverBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next)", context.InnerExceptionOneStackTrace); StackTraceAssert.StartsWith( string.Format(@"at NServiceBus.AcceptanceTests.Exceptions.When_handler_and_Uow_End_throws.Endpoint.{0}.End(Exception ex) at NServiceBus.UnitOfWorkBehavior.AppendEndExceptionsAndRethrow(Exception initialException)", context.TypeName), context.InnerExceptionTwoStackTrace); #endif }
public void Should_receive_exception_thrown_from_end() { var context = new Context(); Scenario.Define(context) .WithEndpoint <Endpoint>(b => b.Given(bus => bus.SendLocal(new Message()))) .AllowExceptions() .Done(c => c.ExceptionReceived) .Run(); Assert.AreEqual(typeof(EndException), context.ExceptionType); StackTraceAssert.StartsWith( @"at NServiceBus.AcceptanceTests.Exceptions.When_Uow_End_throws.Endpoint.UnitOfWorkThatThrowsInEnd.End(Exception ex) at NServiceBus.UnitOfWorkBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ChildContainerBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.ProcessingStatisticsBehavior.Invoke(IncomingContext context, Action next) at NServiceBus.Pipeline.PipelineExecutor.Execute[T](BehaviorChain`1 pipelineAction, T context) at NServiceBus.Unicast.Transport.TransportReceiver.ProcessMessage(TransportMessage message) at NServiceBus.Unicast.Transport.TransportReceiver.TryProcess(TransportMessage message)", context.StackTrace); }