コード例 #1
0
        public void DoesArrayContentExists_Test(int position, bool expected, string[] testArray)
        {
            var folderUtility = new FolderUtility();
            var actual        = folderUtility.DoesArrayContentExists(testArray, position);

            Assert.Equal(expected, actual);
        }
コード例 #2
0
        /// <summary>
        /// Reads and processes the command line arguments passed to this application.
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        static CommandLineSettings ProcessCommandLineArguments(string[] arguments)
        {
            var            settings       = new CommandLineSettings();
            IFolderUtility _folderUtility = new FolderUtility();

            //Where only single arguments will be catered to
            for (var index = 0; index < arguments.Length; index++)
            {
                var currentArgument = arguments[index];

                if (_folderUtility.IsHelpCommand(currentArgument))
                {
                    CommandLineHelper.PrintHelp();
                    settings.VanityCommandRequested = true;
                    return(settings);
                }

                if (_folderUtility.IsVersionCommand(currentArgument))
                {
                    CommandLineHelper.PrintVersion();
                    settings.VanityCommandRequested = true;
                    return(settings);
                }
            }

            //Where multiple arguments are allowed
            for (var index = 0; index < arguments.Length; index++)
            {
                var currentArgument = arguments[index];

                if (_folderUtility.IsConfigCommand(currentArgument))
                {
                    settings.ConfigFilePath = _folderUtility.DoesArrayContentExists(arguments, index + 1) ? arguments[index + 1] : null;
                    settings.ConfigSupplied = true;
                }
            }

            return(settings);
        }