public void ExtractProperty()
        {
            IEnumerable <string> arguments = new List <string> {
                "key=value"
            };

            CompressionToolProperties properties = CompressionToolProperties.of(arguments);

            IEnumerable <KeyValuePair <string, string> > expected = new Dictionary <string, string>
            {
                { "key", "value" }
            };

            Assert.Equal(expected, properties);
        }
        public void ExtractMultipleProperties()
        {
            IEnumerable <string> arguments = new List <string> {
                "key=value", "key2=value2"
            };

            CompressionToolProperties properties = CompressionToolProperties.of(arguments);

            var expected = new Dictionary <string, string>
            {
                { "key", "value" },
                { "key2", "value2" }
            };

            Assert.Equal(expected, 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());
        }
Beispiel #4
0
 private CompressionToolProperties readPropertiesFromArguments()
 {
     return(CompressionToolProperties.of(arguments));
 }