Exemplo n.º 1
0
        public void CommandBus_Should_Throw_NotImplementedException_If_Handler_Not_Found()
        {
            // Arrange
            var resolver = new Mock <IResolver>();

            var command = this.random.Create <SampleCommand>();
            var bus     = new CommandBus(resolver.Object);

            void action(CommandBus c) => c.Send(command);

            // Action && Assert
            bus.Invoking(action).Should()
            .Throw <NotImplementedException>()
            .WithMessage($"Handler not found for command '{command.GetType().Name}'");
        }