public void ItDispatchesTohandler() { CommandHandler.Setup(commandHandler => commandHandler.Handles(It.IsAny<object>())).Returns(true); var commandBus = new SubscriptionCommandBus(); commandBus.Subscribe(CommandHandler.Object); commandBus.Dispatch(new Command()); }
public void ItFailsIfNotAccepted() { CommandHandler.Setup(commandHandler => commandHandler.Handles(It.IsAny<object>())).Returns(false); var commandBus = new SubscriptionCommandBus(); commandBus.Subscribe(CommandHandler.Object); Action a = () => commandBus.Dispatch(new Command()); a.ShouldThrow<UnhandledCommandException>(); }
public void ItFailsIfNoSubscriptions() { var commandBus = new SubscriptionCommandBus(); Action a = () => commandBus.Dispatch(new Command()); a.ShouldThrow<UnhandledCommandException>(); }