Пример #1
0
        private void dispatchCommandLine()
        {
            RunMultipleCompressionToolsUseCase useCase      = new RunMultipleCompressionToolsUseCase(processOperator);
            IEnumerable <CliTemplate>          cliTemplates = readTemplatedFromAppConfig();
            IEnumerable <string>      cutProps   = readCutPropertiesFromConfig();
            CompressionToolProperties properties = readPropertiesFromArguments();

            useCase.execute(cliTemplates, cutProps, properties);
        }
        public void TemplatesAreInstantiated()
        {
            IEnumerable <CliTemplate> cliTemplates = new List <CliTemplate> {
                new CliTemplate(executable: "program 1", parameter: "-T=%key%"),
                new CliTemplate(executable: "program %key%", parameter: "-T=%key2%%cut%to be removed%cut% %no_cut%K=1234%no_cut%"),
            };
            CompressionToolProperties properties = CompressionToolProperties.of("key=value", "key2=value2", "no_cut=true");

            ProcessExececutorSpy processExecutor  = new ProcessExececutorSpy();
            RunMultipleCompressionToolsUseCase uc = new RunMultipleCompressionToolsUseCase(processExecutor);
            IEnumerable <string> cutProps         = new List <string>()
            {
                "cut", "no_cut"
            };

            uc.execute(cliTemplates, cutProps, properties);

            IEnumerable <CliRunCmd> expectedInfos = new List <CliRunCmd> {
                new CliRunCmd(executable: "program 1", parameters: "-T=value"),
                new CliRunCmd(executable: "program value", parameters: "-T=value2 K=1234")
            };

            Assert.Equal(expectedInfos, processExecutor.startInfos, new CliRunCmdEqualityComparer());
        }