public static void RegisterExecutorsInAssembly(this CommandService target, Assembly asm) { var mapper = new AttributeBasedCommandMapper(); foreach (var mappedCommand in asm.GetTypes().Where(mapper.CanMapCommand)) { var executor = new UoWMappedCommandExecutor(mapper); target.RegisterExecutor(mappedCommand, executor); } }
public static void RegisterExecutorsInAssembly(this CommandService target, Assembly asm) { var mapper = new AttributeBasedCommandMapper(); foreach (var mappedCommand in asm.GetTypes().Where(mapper.CanMapCommand)) { var executor = new UoWMappedCommandExecutor(mapper); target.RegisterExecutor(mappedCommand, executor); } }
public void Creating_executor_with_runtime_determed_type_should_create_working_executor() { var mapper = new AttributeBasedCommandMapper(); var executor = new UoWMappedCommandExecutor(mapper); 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 mapper = new AttributeBasedCommandMapper(); var executor = new UoWMappedCommandExecutor(mapper); var command = new CorrectlyMappedCommand { Bar = 25, Foo = "Hello world" }; executor.Execute(command); TargetAggRoot.FooValue.Should().Be(command.Foo); TargetAggRoot.BarValue.Should().Be(command.Bar); }