Пример #1
0
        public void Can_run_command_handler_with_public_properties_resolve()
        {
            // Arrange
            pipelineService.ServiceProvider = new FuncServiceProvider(Ns01_InterfacesResolver);
            var builder = pipelineService.PipelineContainer.AddCommandPipeline();

            builder
            .AddMiddleware(new Commands.PipelineMiddlewares.CommandHandlerLocatorMiddleware(
                               typeof(CommandsTests).GetTypeInfo().Assembly))
            .AddMiddleware(new Commands.PipelineMiddlewares.CommandHandlerResolverMiddleware
            {
                UsePropertiesResolving = true
            })
            .AddMiddleware(new Commands.PipelineMiddlewares.CommandHandlerExecutorMiddleware
            {
                UseParametersResolve = true
            });
            var cmd = new Ns06_TestCommand();

            // Act
            pipelineService.HandleCommand(cmd);

            // Assert
            Assert.Equal(1, cmd.Param);
        }
Пример #2
0
 public void HandleTestCommand(Ns06_TestCommand command)
 {
     command.Param = DependencyA.GetTestValue() == "A" &&
                     DependencyB == null &&
                     DependencyC != null ? 1 : 0;
 }