Ejemplo n.º 1
0
        public CommandSimplePipelineShould()
        {
            _command = Fixture.Create <Command>();

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

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

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

            Assert.Throws <ArgumentNullException>(() => GetSut(pipeline));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 6
0
        public CommandSequentialPipelineShould()
        {
            _command = Fixture.Create <Command>();

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

            _pipeline = BuildPipeline(new[] { _preProcessor }, _processor, new[] { _postProcessor });
        }
Ejemplo n.º 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 });
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 9
0
 protected DefaultCommandController(ICommandPipeline commandPipeline, ICommandLocator commandLocator)
 {
     _commandPipeline = commandPipeline;
     _commandLocator  = commandLocator;
 }
Ejemplo n.º 10
0
 public CommandController(ICommandPipeline commandPipeline, ICommandLocator commandLocator) : base(commandPipeline, commandLocator)
 {
 }
Ejemplo n.º 11
0
        public InMemoryCommandBus GetSut(ICommandPipeline pipeline)
        {
            var sut = new InMemoryCommandBus(pipeline);

            return(sut);
        }
Ejemplo n.º 12
0
        public InMemoryCommandBus GetSut(ICommandPipeline pipeline)
        {
            var sut = new InMemoryCommandBus(pipeline, new NoopLoggerFactory());

            return(sut);
        }