/// <summary>
        /// Run Test Cases for CMDLineParser
        /// </summary>
        public static void RunTests()
        {
            Console.WriteLine("\nStarting CMDLineParser tests:\n");
            //create parser
            CMDLineParser parser = new CMDLineParser();
            parser.throwInvalidOptionsException = false;

            //add Options
            #region addOptions
            CMDLineParser.Option DebugOption = parser.AddBoolSwitch("-Debug", "Print Command Line Parser Debug information");
            DebugOption.AddAlias("/Debug");
            CMDLineParser.Option OptionOpenfolder = parser.AddBoolSwitch("/openfolder", "Open files in folder if path is a folder");
            OptionOpenfolder.AddAlias("-openfolder");
            CMDLineParser.Option UserNameOpt = parser.AddStringParameter("-User="******"User Name", true);
            UserNameOpt.AddAlias("-U");
            CMDLineParser.NumberOption DoubleOpt = parser.AddDoubleParameter("-DoubleNum", "A Double", false);
            NumberFormatInfo numberformat = (new CultureInfo("de-DE", false)).NumberFormat;
            CMDLineParser.NumberOption FormatedNumOpt = parser.AddDoubleParameter("-NegNum", "A negativ Number", false, numberformat);
            CMDLineParser.Option IntNumOpt = parser.AddIntParameter("-IntNum", "A Integer Number", false);

            //Test creation of an invalid option - Throws exception
            string test = "Test creation of an invalid option";
            string testcomment = " - " + test + " - :";
            try
            {
                CMDLineParser.Option InvalidOpt = parser.AddStringParameter("-Option Nr1", "Invalid Option", false);
                Console.WriteLine("\nTestFailed: " + testcomment);
            }
            catch (CMDLineParser.CMDLineParserException ex)
            {

                Console.WriteLine("\nTestOK: " + testcomment + "Caught Error: " + ex.Message);
            }
            #endregion

            //do tests and write results to the console window
            #region Tests
            //test missing required opt -U
            String[] testmissingreqopt = { "/Debug" }; //missing required opt -U
            TestException("missing required opt -U", parser, testmissingreqopt, typeof(CMDLineParser.MissingRequiredOptionException));

            //test neg. integer
            String[] test1 = { "-UChris", "-NegNum", "-13,56", "-IntNum", "-123", "/Debug" };
            TestOption("test neg. integer", parser, test1, IntNumOpt);

            //test Double Option
            double val = -10113.56;
            String[] testDoubleOptPoint = { "-UChris", "-DoubleNum", "-10113.56" }; //test formated double
            String[] testDoubleOptComma = { "-UChris", "-DoubleNum", "-10113,56" }; //test formated double
            TestOptionValue("testDoubleOpt-dec.point", parser, testDoubleOptPoint, DoubleOpt, val);
            TestOptionValue("testDoubleOpt-dec.comma", parser, testDoubleOptComma, DoubleOpt, val);

            //test formated (globalized) double
            String[] test2 = { "-UChris", "-NegNum", "-10.113,56", "-IntNum", "123", "/Debug" }; //test formated double
            TestOption("test formated double", parser, test2, FormatedNumOpt);

            //test wrong int format
            String[] test3 = { "-UChris", "-IntNum", "123.00", "/Debug" }; //test wrong int format
            TestException("test wrong int format", parser, test3, typeof(CMDLineParser.ParameterConversionException));

            //test InvalidOptionsException
            String[] test4 = { "-UChris", "-Inv", "-IntNum", "-123", "/Debug", "/Inv2" }; //invalid options found
            parser.throwInvalidOptionsException = true;
            TestException("invalid options found", parser, test4, typeof(CMDLineParser.InvalidOptionsException));
            //parser.Debug();

            //test custom (subclassed) option
            String[] testDate = { "-Date", "2001-11-22" }; //test custom (subclassed) option

            // New parser instance
            CMDLineParser parser2 = new CMDLineParser();

            parser2.throwInvalidOptionsException = true;
            PastDateOption DateOpt = new PastDateOption("-Date", "A test Date", false);
            parser2.AddOption(DateOpt);
            TestOption("test custom (subclassed) option", parser2, testDate, DateOpt);
            //parser2.Debug();

            //Test missing parseValue method
            MissingMethodOption missMethOpt = new MissingMethodOption("-missing", "test opt", false);
            parser2.AddOption(missMethOpt);
            string[] testmiss = { "-missing", "123" };
            TestException("Test missing parseValue method", parser2, testmiss, typeof(CMDLineParser.ParameterConversionException));

            //test 'help'
            parser2.AddHelpOption();
            parser2.isConsoleApplication = true;
            parser2.throwInvalidOptionsException = false;
            String[] testh = { "-?" };
            TestOption("test help", parser2, testh, null);

            //test generic DefaultOption ( using Convert.ChangeType..)
            //one of the two methods will fail depend on your system settings
            double dval = -10113.56;
            String[] testDefOpt1 = { "/Debug", "-NegNum", "-10113.56"}; //test formated double
            String[] testDefOpt2 = { "/Debug", "-NegNum", "-10113,56"}; //test formated double

            DefaultOption defnumop = new DefaultOption("-NegNum", "Test default Option", typeof(double), false);
            parser2.AddOption(defnumop);
            TestOptionValue("defnumop - dec.point", parser2, testDefOpt1, defnumop, dval);
            TestOptionValue("defnumop - dec.comma", parser2, testDefOpt2, defnumop, dval);

            #endregion

            parser2.Debug();

            //showCulturinfos();
        }