public void Creating_executor_with_runtime_determed_type_should_not_return_null()
        {
            var factory     = new AttributeBasedMappingFactory();
            var commandType = typeof(CorrectlyMappedCommand);

            var result = factory.CreateExecutorForCommand(commandType);

            result.Should().NotBeNull();
        }
        public void Creating_executor_with_runtime_determed_type_should_not_return_null()
        {
            var factory = new AttributeBasedMappingFactory();
            var commandType = typeof (CorrectlyMappedCommand);

            var result = factory.CreateExecutorForCommand(commandType);

            result.Should().NotBeNull();
        }
Ejemplo n.º 3
0
        public static void RegisterExecutorsInAssembly(this CommandService target, Assembly asm)
        {
            var factory = new AttributeBasedMappingFactory();

            foreach(var mappedCommand in asm.GetTypes().Where(t=>factory.IsCommandMapped(t)))
            {
                var executor = factory.CreateExecutorForCommand(mappedCommand);
                target.RegisterExecutor(mappedCommand, executor);
            }
        }
        public void Creating_executor_with_runtime_determed_type_should_create_working_executor()
        {
            var factory = new AttributeBasedMappingFactory();
            var commandType = typeof(CorrectlyMappedCommand);
            var executor = factory.CreateExecutorForCommand(commandType);

            var command = new CorrectlyMappedCommand { Bar = 25, Foo = "Hello world" };
            executor.Execute(command);

            TargetAggRoot.FooValue.Should().Be(command.Foo);
            TargetAggRoot.BarValue.Should().Be(command.Bar);
        }
        public void Creating_executor_with_runtime_determed_type_should_create_working_executor()
        {
            var factory     = new AttributeBasedMappingFactory();
            var commandType = typeof(CorrectlyMappedCommand);
            var executor    = factory.CreateExecutorForCommand(commandType);

            var command = new CorrectlyMappedCommand {
                Bar = 25, Foo = "Hello world"
            };

            executor.Execute(command);

            TargetAggRoot.FooValue.Should().Be(command.Foo);
            TargetAggRoot.BarValue.Should().Be(command.Bar);
        }
Ejemplo n.º 6
0
            public MappedCommandExecutorProxy()
            {
                var factory = new AttributeBasedMappingFactory();

                _executor = factory.CreateExecutorForCommand <T>();
            }
 protected override ICommandExecutor <TCommand> BuildCommandExecutor()
 {
     return(_factory.CreateExecutorForCommand <TCommand>());
 }