예제 #1
0
        public void Posix_WithParam_Alternative3()
        {
            var posixParser = new POSIXParser();

            var result = posixParser.Parse <TestClass_WitParams>("-a", "590");

            Assert.IsNotNull(result);
            Assert.AreEqual(590, result.OptionA);
        }
예제 #2
0
        public void Posix_SingleDouble()
        {
            var posixParser = new POSIXParser();

            // c:\>program_name.exe -x 44.89
            var result = posixParser.Parse <TestClass_SingleDouble>("-x", "44.89");

            Assert.IsNotNull(result);
            Assert.AreEqual(44.89, result.ValueX);
        }
예제 #3
0
        public void Posix_MultipleProperties_NoMatches()
        {
            var posixParser = new POSIXParser();

            var result = posixParser.Parse <TestClass_MultipleOptions>("-x");

            Assert.IsNotNull(result);
            Assert.IsFalse(result.OptionA);
            Assert.IsFalse(result.OptionB);
            Assert.IsFalse(result.OptionC);
        }
예제 #4
0
        public void Posix_InputAndParam()
        {
            var posixParser = new POSIXParser();

            posixParser.RegisterCustomConverter <FileInfo>(f => new FileInfo(f));
            var result = posixParser.Parse <TestClass_InputAndParam>(@"C:\SomePath\SomeOther Path\File.txt", "-a5990");

            Assert.IsNotNull(result);
            Assert.AreEqual(5990, result.OptionA);
            Assert.IsNotNull(result.Path);
        }
예제 #5
0
        public void Posix_MultipleProperties_AlternativeSyntax2()
        {
            var posixParser = new POSIXParser();

            var result = posixParser.Parse <TestClass_MultipleOptions>("-a");

            Assert.IsNotNull(result);
            Assert.IsTrue(result.OptionA);
            Assert.IsFalse(result.OptionB);
            Assert.IsFalse(result.OptionC);
        }
예제 #6
0
        public void Posix_MultiplePropertiesAndMainOption()
        {
            var posixParser = new POSIXParser();

            var result = posixParser.Parse <TestClass_MultipleOptionsWithMainArg>("ThisIsMainParameter", "-ab", "-c");

            Assert.IsNotNull(result);
            Assert.IsTrue(result.OptionA);
            Assert.IsTrue(result.OptionB);
            Assert.IsTrue(result.OptionC);
            Assert.AreEqual("ThisIsMainParameter", result.MainOption);
        }
예제 #7
0
        public void Posix_MultiplePropertiesWithTypes_Alternative2()
        {
            var posixParser = new POSIXParser();

            // C:\>program_name.exe -a 5 -b100 -csomeother

            var result = posixParser.Parse <TestClass_MultipleOptionsWithTypes>("-a", "5", "-b100", "-csomeother");

            Assert.IsNotNull(result);
            Assert.AreEqual(5, result.OptionA);
            Assert.AreEqual(100, result.OptionB);
            Assert.AreEqual("someother", result.OptionC);
        }
예제 #8
0
        public void Posix_MultipleProperties_AlternativeSyntax()
        {
            var posixParser = new POSIXParser();

            // command -a -b -c
            // is the same as
            // command -abc
            var result = posixParser.Parse <TestClass_MultipleOptions>("-a", "-b", "-c");

            Assert.IsNotNull(result);
            Assert.IsTrue(result.OptionA);
            Assert.IsTrue(result.OptionB);
            Assert.IsTrue(result.OptionC);
        }