public void Executing_not_mapped_command_with_no_registered_executors_should_cause_exception()
        {
            var    sut = new NsbCommandService();
            Action act = () => sut.Execute(new NotMappedCommand());

            act.ShouldThrow <ExecutorForCommandNotFoundException>();
        }
        public void Not_mapped_command_with_registered_executors_should_be_executed_using_registered_executor()
        {
            var executor = MockRepository.GenerateMock<ICommandExecutor<NotMappedCommand>>();
            var sut = new NsbCommandService();
            sut.RegisterExecutor(executor);
            var command = new NotMappedCommand();
            sut.Execute(command);

            executor.AssertWasCalled(x => x.Execute(command));
        }
Exemple #3
0
        public void Configure(Configure config)
        {
            Builder    = config.Builder;
            Configurer = config.Configurer;

            NcqrsEnvironment.Configure(new NsbEnvironmentConfiguration(Builder));
            _inProcessEventBus = new InProcessEventBus(false);
            NcqrsEnvironment.SetDefault <IEventBus>(_inProcessEventBus);
            _commandService = new NsbCommandService();
            config.Configurer.RegisterSingleton(typeof(ICommandService), _commandService);
        }
        public void Not_mapped_command_with_registered_executors_should_be_executed_using_registered_executor()
        {
            var executor = MockRepository.GenerateMock <ICommandExecutor <NotMappedCommand> >();
            var sut      = new NsbCommandService();

            sut.RegisterExecutor(executor);
            var command = new NotMappedCommand();

            sut.Execute(command);

            executor.AssertWasCalled(x => x.Execute(command));
        }
 public void Mapped_command_with_no_registered_executors_should_be_executed_using_mapped_executor()
 {
     var sut = new NsbCommandService();
     sut.Execute(new MappedCommand());
 }
 public void Executing_not_mapped_command_with_no_registered_executors_should_cause_exception()
 {
     var sut = new NsbCommandService();
     Action act = () => sut.Execute(new NotMappedCommand());
     act.ShouldThrow<ExecutorForCommandNotFoundException>();
 }
        public void Mapped_command_with_no_registered_executors_should_be_executed_using_mapped_executor()
        {
            var sut = new NsbCommandService();

            sut.Execute(new MappedCommand());
        }