예제 #1
0
            public void HandlesHelpAsShortName()
            {
                string[] args = new string[1];
                args[0] = "/?";

                IDictionary<string, string> result = new CommandArgsParser().ParseArgs(args);
                Assert.IsTrue(result.Keys.Contains("--help"));
                Assert.AreEqual(true.ToString(), result["--help"]);
            }
예제 #2
0
파일: Program.cs 프로젝트: CumpsD/AzureJobs
        private static void StartAsConsole(string[] args)
        {
            System.Diagnostics.Trace.TraceInformation("TextMin:StartAsConsole");
            CommandLineOptions cmdLineOptions = new CommandArgsParser().BuildCommandLineOptions(args);
            cmdLineOptions.FileExtensionsToCompress = _fileExtentionsToCompress;

            if (cmdLineOptions.DisplayHelp || string.IsNullOrEmpty(cmdLineOptions.ItemsToProcessDirectory)) {
                CompressorBase.ShowUsage();
                Console.ReadLine();
                return;
            }
            RunMinifier(cmdLineOptions);
        }
예제 #3
0
            public void BuildsTheCommandLineOptions()
            {
                string[] args = new[]{
                 "--cache",
                 "one.txt",
                 "--name",
                 "Azure",
                 "Image",
                 "Optimizer",
                 "--color",
                 "Green",
                 "--force"};
                var options = new CommandArgsParser().BuildCommandLineOptions(args);

                Assert.AreEqual("one.txt", options.OptimizerCacheFile);
                Assert.AreEqual("Azure Image Optimizer", options.Name);
                Assert.AreEqual("Green", options.Color);
                Assert.IsTrue(options.ShouldForceOptimize);
            }
예제 #4
0
            public void ReturnsTheValues()
            {
                string[] args = new[]{
                "--cache"
                ,"one.txt"
                ,"--name"
                ,"Azure"
                ,"Image"
                ,"Optimizer"
                ,"--color"
                ,"Green"
                ,"--force"};

                IDictionary<string, string> result = new CommandArgsParser().ParseArgs(args);
                Assert.AreEqual(4, result.Count);
                Assert.IsTrue(result.Keys.Contains("--cache"));
                Assert.IsTrue(result.Keys.Contains("--name"));
                Assert.IsTrue(result.Keys.Contains("--color"));
                Assert.AreEqual("one.txt", result["--cache"]);
                Assert.AreEqual("Azure Image Optimizer", result["--name"]);
                Assert.AreEqual("Green", result["--color"]);
                Assert.IsTrue(result.Keys.Contains("--force"));
            }