public async Task Then_execute_throws_exception_from_aggregate_with_stack_trace() { var syncCommand = new AsyncFaultWithOneEventCommand(42, Guid.NewGuid(), Guid.NewGuid(), TimeSpan.FromMilliseconds(500)); var expectedMessage = Expect.Message <SampleAggregateChangedEvent>(e => e.SourceId, syncCommand.AggregateId); await GridNode.Execute(CommandPlan.New(syncCommand, Timeout, expectedMessage)) .ShouldThrow <SampleAggregateException>(ex => ex.StackTrace.Contains(typeof(SampleAggregate).Name)); }
public async Task When_fault_is_produced_when_publish_command_with_base_type() { var syncCommand = new AsyncFaultWithOneEventCommand(101, Guid.NewGuid()); await GridNode.NewCommandWaiter() .Expect <AggregateChangedEventNotification>(e => e.AggregateId == syncCommand.AggregateId) .Create() .Execute((ICommand)syncCommand) .ShouldThrow <SampleAggregateException>(); }
public async Task When_fault_was_received_and_failOnFaults_is_set_results_raised_an_error() { var syncCommand = new AsyncFaultWithOneEventCommand(100, Guid.NewGuid()); await GridNode.NewCommandWaiter() .Expect <AggregateChangedEventNotification>() .Create() .Execute(syncCommand) .ShouldThrow <SampleAggregateException>(); }
public async Task When_aggregate_throws_fault_it_is_handled_without_implicit_registration() { //will throw exception in aggregate and in message handler var syncCommand = new AsyncFaultWithOneEventCommand(500, Guid.NewGuid()); var expectedFault = Expect.Fault <SampleAggregateChangedEvent>(e => e.SourceId, syncCommand.AggregateId, typeof(OddFaultyMessageHandler)); var expectedMessage = Expect.Message <AggregateChangedEventNotification>(e => e.AggregateId, syncCommand.AggregateId); await GridNode.Execute <AggregateChangedEventNotification>(syncCommand, expectedFault, expectedMessage) .ShouldThrow <SampleAggregateException>(); }
public async Task When_aggregate_throws_fault_it_is_handled_without_implicit_registration() { //will throw exception in aggregate and in message handler var syncCommand = new AsyncFaultWithOneEventCommand(50, Guid.NewGuid()); var res = await GridNode.NewCommandWaiter(TimeSpan.FromMinutes(10), false) .Expect <AggregateChangedEventNotification>() .Or <IFault <SampleAggregateChangedEvent> >() .Create() .Execute(syncCommand); Assert.NotNull(res.Message <IFault <AsyncFaultWithOneEventCommand> >()); }