public void GivenAMessageHandledByMultipleHandlers_WhenAskedToProcess_ShouldInvokeAllCommandHandlersInCorrectSequence() { var processor = new CommandProcessorTestDataBuilder().Build(); var command = new CommandHandledByMultipleHandlers(); processor.Process(command); var expected = new[] { typeof(ObjectCommandHandler), typeof(CommandHandlerA), typeof(CommandHandlerB) }; CollectionAssert.AreEqual( expected, command.HandlersThatHandledThisMessage .Select(x => x.GetType()) .ToArray()); }
public void GivenAMessageHandledByMultipleHandlers_WhenAskedToProcessWithDifferentHandlerOrdering_ShouldInvokeAllCommandHandlersInCorrectSequence() { Conventions.SetHandlerSortingMethod((x, y) => string.Compare(y.GetType().FullName, x.GetType().FullName, StringComparison.InvariantCultureIgnoreCase)); var processor = new CommandProcessorTestDataBuilder().Build(); var command = new CommandHandledByMultipleHandlers(); processor.Process(command); var expected = new[] { typeof(ObjectCommandHandler), typeof(CommandHandlerB), typeof(CommandHandlerA) }; CollectionAssert.AreEqual( expected, command.HandlersThatHandledThisMessage .Select(x => x.GetType()) .ToArray()); }