public CommandSimplePipelineShould()
        {
            _command = Fixture.Create <Command>();

            _processor = MockCommandProcessor(_command);
            _pipeline  = new CommandSimplePipeline <Command>(_processor.Object);
        }
示例#2
0
        public InMemoryCommandBus(ICommandPipeline handler)
        {
            Precondition.For(() => handler).NotNull();
            this.handler = handler;

            subject.Subscribe(async msg => await HandleCommand(msg));
        }
        private async Task <CommandBusResult> Execute(ICommandPipeline pipeline, ICommand cmd)
        {
            InMemoryCommandBus sut    = GetSut(pipeline);
            CommandBusResult   result = await sut.EnqueueAsync(cmd);

            return(result);
        }
示例#4
0
        public void ItThrowsWhenHandlerIsNull()
        {
            var repo = A.Fake <IDomainObjectRepository>();
            ICommandPipeline pipeline = null;

            Assert.Throws <ArgumentNullException>(() => GetSut(pipeline));
        }
示例#5
0
        public InMemoryCommandBus(ICommandPipeline handler, ILoggerFactory loggerFactory) : base(loggerFactory)
        {
            Precondition.For(() => handler).NotNull();
            logger       = loggerFactory.CreateLogger <InMemoryCommandBus>();
            this.handler = handler;

            subject.Subscribe(async msg => await HandleCommand(msg));
        }
示例#6
0
        public CommandSequentialPipelineShould()
        {
            _command = Fixture.Create <Command>();

            _preProcessor  = MockCommandPreProcessor(_command);
            _processor     = MockCommandProcessor(_command);
            _postProcessor = MockCommandPostProcessor(_command);

            _pipeline = BuildPipeline(new[] { _preProcessor }, _processor, new[] { _postProcessor });
        }
示例#7
0
        public CommandFullPipelineShould()
        {
            _command = Fixture.Create <Command>();

            _behaviour     = MockCommandBehaviour(_command);
            _preProcessor  = MockCommandPreProcessor(_command);
            _processor     = MockCommandProcessor(_command);
            _postProcessor = MockCommandPostProcessor(_command);

            _pipeline = BuildPipeline(new[] { _behaviour }, new[] { _preProcessor }, _processor, new[] { _postProcessor });
        }
示例#8
0
        private Task <CommandBusResult> Execute(ICommandPipeline pipeline, ICommand command)
        {
            InMemoryCommandBus bus = GetSut(pipeline);

            bus.WithCondition(i =>
            {
                var temp = i as SampleCommand;
                return(temp.Value == 42);
            });

            return(bus.EnqueueAsync(command));
        }
示例#9
0
 protected DefaultCommandController(ICommandPipeline commandPipeline, ICommandLocator commandLocator)
 {
     _commandPipeline = commandPipeline;
     _commandLocator  = commandLocator;
 }
示例#10
0
 public CommandController(ICommandPipeline commandPipeline, ICommandLocator commandLocator) : base(commandPipeline, commandLocator)
 {
 }
示例#11
0
        public InMemoryCommandBus GetSut(ICommandPipeline pipeline)
        {
            var sut = new InMemoryCommandBus(pipeline);

            return(sut);
        }
示例#12
0
        public InMemoryCommandBus GetSut(ICommandPipeline pipeline)
        {
            var sut = new InMemoryCommandBus(pipeline, new NoopLoggerFactory());

            return(sut);
        }