public void HasArgument_ShouldReturnFalseIfArgumentWithMismatchValueIsPresentInCtorArgument()
        {
            var dict = new Dictionary<string, string> { { "foo", "bar" } };
            var args = new CommandLineArguments(dict);

            Assert.That(args.HasArgument("foo", "foo"), Is.False);
        }
        public void HasSingleArgument_ShouldReturnTrueIfArgumentIsSingleInCtorArgument()
        {
            var dict = new Dictionary<string, string> { { "foo", "bar" } };
            var args = new CommandLineArguments(dict);

            Assert.That(args.HasSingleArgument("foo"), Is.True);
        }
Esempio n. 3
0
        private bool Run(CommandLineArguments args)
        {
            if (!args.HasSingleArgument("help", "true"))
                return false;

            var message = Translator.Translate("GeneralHelpMessage");
            Console.WriteLine(message);
            return true;
        }
Esempio n. 4
0
        private bool Run(CommandLineArguments args)
        {
            if (!args.HasArgument("clone", "true"))
                return false;

            var sourcePath = GetPath(args, "source");
            var targetPath = GetPath(args, "target");
            solutionCloner.CloneSolution(sourcePath, targetPath);

            return true;
        }
Esempio n. 5
0
        public bool Run(CommandLineArguments args)
        {
            if (!args.HasSingleArgument("settings", "true"))
                return false;

            var settingsMessage = Translator.Translate("SettingsMessage");
            var excludeFolderMessage = string.Join(", ", Default.ExcludeFolderPatterns);
            var excludeFileMessage = string.Join(", ", Default.ExcludeFilePatterns);
            var plainCopyFileMessage = string.Join(", ", Default.PlainCopyFilePatterns);
            var message = string.Format(settingsMessage, excludeFolderMessage, excludeFileMessage, plainCopyFileMessage);

            Console.WriteLine(message);
            return true;
        }
Esempio n. 6
0
        private bool Run(CommandLineArguments args)
        {
            if (!args.HasArgument("modal", "true"))
                return false;

            var source = args.HasArgument("source") ? args.Raw["source"] : null;
            var sourceString = source == null ? null : " --source=" + source;

            var message = Translator.Translate("GuiModalStartMessage");
            Console.WriteLine(message);
            process.Start(WizardApplicationPath, "--modal" + sourceString);

            return true;
        }
        private bool Run(CommandLineArguments args)
        {
            if (!args.HasSingleArgument("uninstall", "true"))
                return false;

            var message = Translator.Translate("UninstallMessage");
            var successMessage = Translator.Translate("UninstallSuccessMessage");
            var errorMessage = Translator.Translate("UninstallErrorMessage");

            try
            {
                Console.WriteLine(message);
                installer.UnregisterContextMenu();
                Console.WriteLine(successMessage);
            }
            catch (Exception e)
            {
                Console.WriteLine(errorMessage);
                Console.WriteLine(e.Message);
            }

            return true;
        }
        private bool Run(CommandLineArguments args)
        {
            if (!args.HasSingleArgument("install", "true"))
                return false;

            var message = Translator.Translate("InstallMessage");
            var successMessage = Translator.Translate("InstallSuccessMessage");
            var errorMessage = Translator.Translate("InstallErrorMessage");
            var contextMenuText = Translator.Translate("ContextMenuText");

            try
            {
                Console.WriteLine(message);
                installer.RegisterContextMenu(WizardApplicationPath, contextMenuText);
                Console.WriteLine(successMessage);
            }
            catch (Exception e)
            {
                Console.WriteLine(errorMessage);
                Console.WriteLine(e.Message);
            }

            return true;
        }
Esempio n. 9
0
 private string GetPath(CommandLineArguments args, string pathType)
 {
     var path = GetPathArg(args, pathType);
     return string.IsNullOrWhiteSpace(path) ? GetPathFromConsole(pathType) : path;
 }
Esempio n. 10
0
 private static string GetPathArg(CommandLineArguments args, string key)
 {
     return (!args.HasArgument(key) || args.Raw[key] == "true")
                ? string.Empty
                : args.Raw[key];
 }
        public void RawCollection_ShouldReturnCtorArgument()
        {
            var dict = new Dictionary<string, string>();
            var args = new CommandLineArguments(dict);

            Assert.That(args.Raw, Is.EqualTo(dict));
        }