Esempio n. 1
0
 public void Test_Int()
 {
     TestGetOpt t = new TestGetOpt(new string[] { "/some", "1", "/other", "2", "blah" });
     Assert.AreEqual(1, t.iSome);
     Assert.AreEqual(2, t.other);
     Assert.AreEqual("one", t.bar);
 }
        public void Test_Private()
        {
            // hrmph.  This should probably throw an error, if I don't have the right permissions.
            TestGetOpt t = new TestGetOpt(new string[] { "/private", "one" });

            Assert.AreEqual("one", t.baz);
        }
        public void Test_Construct()
        {
            TestGetOpt t = new TestGetOpt(new string[] { "/f", "/bar", "baz" });

            Assert.AreEqual(true, t.foo);
            Assert.AreEqual("baz", t.bar);
        }
Esempio n. 4
0
 public void Test_Colon()
 {
     TestGetOpt t = new TestGetOpt(new string[] { "/some:1", "/other:2", "blah", "bloo", "boo" });
     Assert.AreEqual(1, t.iSome);
     Assert.AreEqual(2, t.other);
     Assert.AreEqual(3, t.Args.Length);
 }
        public void Test_Int()
        {
            TestGetOpt t = new TestGetOpt(new string[] { "/some", "1", "/other", "2", "blah" });

            Assert.AreEqual(1, t.iSome);
            Assert.AreEqual(2, t.other);
            Assert.AreEqual("one", t.bar);
        }
        public void Test_Colon()
        {
            TestGetOpt t = new TestGetOpt(new string[] { "/some:1", "/other:2", "blah", "bloo", "boo" });

            Assert.AreEqual(1, t.iSome);
            Assert.AreEqual(2, t.other);
            Assert.AreEqual(3, t.Args.Length);
        }
Esempio n. 7
0
 public void Test_Args()
 {
     TestGetOpt t = new TestGetOpt(new string[] { "/some", "1", "/other", "2", "blah", "bloo", "boo" });
     Assert.AreEqual(3, t.Args.Length);
     Assert.AreEqual("blah", t.Args[0]);
     Assert.AreEqual("bloo", t.Args[1]);
     Assert.AreEqual("boo", t.Args[2]);
 }
        public void Test_MethodParam()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-methodparam", "2" });

            Assert.AreEqual(2, go.mp);
            go = new TestGetOpt(new string[] { "-methodparams", "2", "after" });
            Assert.AreEqual(2, go.m2);
            Assert.AreEqual("after", go.mp2);
        }
        public void Test_Args()
        {
            TestGetOpt t = new TestGetOpt(new string[] { "/some", "1", "/other", "2", "blah", "bloo", "boo" });

            Assert.AreEqual(3, t.Args.Length);
            Assert.AreEqual("blah", t.Args[0]);
            Assert.AreEqual("bloo", t.Args[1]);
            Assert.AreEqual("boo", t.Args[2]);
        }
Esempio n. 10
0
        public void Test_DashArgs()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-bar", "four", "-baz:one", "more" });

            Assert.AreEqual("four", go.bar);
            Assert.AreEqual("one", go.baz);
            Assert.AreEqual(null, go.e);
            Assert.AreEqual(1, go.Args.Length);
            Assert.AreEqual("more", go.Args[0]);
        }
Esempio n. 11
0
 public void Test_Bool()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "/a", "/b", "four", "one", "more" });
     Assert.AreEqual(true, go.a);
     Assert.AreEqual(false, go.b);
     Assert.AreEqual(false, go.c);
     Assert.AreEqual(true, go.d);
     Assert.AreEqual(3, go.Args.Length);
     Assert.AreEqual("four", go.Args[0]);
     Assert.AreEqual("one", go.Args[1]);
     Assert.AreEqual("more", go.Args[2]);
 }
Esempio n. 12
0
        public void Test_DashBool()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-a", "-b", "four", "one", "more" });

            Assert.AreEqual(true, go.a);
            Assert.AreEqual(false, go.b);
            Assert.AreEqual(false, go.c);
            Assert.AreEqual(true, go.d);
            Assert.AreEqual(3, go.Args.Length);
            Assert.AreEqual("four", go.Args[0]);
            Assert.AreEqual("one", go.Args[1]);
            Assert.AreEqual("more", go.Args[2]);
        }
Esempio n. 13
0
 public void Test_MethodParam()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-methodparam", "2" });
     Assert.AreEqual(2, go.mp);
     go = new TestGetOpt(new string[] { "-methodparams", "2", "after" });
     Assert.AreEqual(2, go.m2);
     Assert.AreEqual("after", go.mp2);
 }
Esempio n. 14
0
 public void Test_Enum()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-fb:bar" });
     Assert.AreEqual(TestOptEnum.BAR, go.fb);
 }
Esempio n. 15
0
 public void Test_Method()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-method" });
     Assert.AreEqual("after", go.m);
 }
Esempio n. 16
0
        public void Test_CaseInsensitive()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-BaZ:boo" });

            Assert.AreEqual("boo", go.baz);
        }
Esempio n. 17
0
 public void Test_DashInsufficientError()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-some" });
 }
Esempio n. 18
0
 public void Test_Construct()
 {
     TestGetOpt t = new TestGetOpt(new string[] { "/f", "/bar", "baz" });
     Assert.AreEqual(true, t.foo);
     Assert.AreEqual("baz", t.bar);
 }
Esempio n. 19
0
        public void Test_Equals()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-baz=boo" });

            Assert.AreEqual("boo", go.baz);
        }
Esempio n. 20
0
 public void Test_BadInt()
 {
     TestGetOpt t = new TestGetOpt(new string[] { "/some", "one" });
 }
Esempio n. 21
0
 public void Test_DashInsufficientError()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-some" });
 }
Esempio n. 22
0
        public void Test_NunitProblem()
        {
            TestGetOpt go = new TestGetOpt(new string[] { @"/assembly:test.dll" });

            Assert.AreEqual(@"test.dll", go.assembly);
        }
Esempio n. 23
0
        public void Test_DoubleSlash()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "/baz:boo/bar" });

            Assert.AreEqual("boo/bar", go.baz);
        }
Esempio n. 24
0
        public void Test_Enum()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-fb:bar" });

            Assert.AreEqual(TestOptEnum.BAR, go.fb);
        }
Esempio n. 25
0
        public void Test_Method()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-method" });

            Assert.AreEqual("after", go.m);
        }
Esempio n. 26
0
        public void Test_Usage()
        {
            TestGetOpt t = new TestGetOpt();

            Console.WriteLine(t.Usage);
        }
Esempio n. 27
0
 public void Test_MethodNotEnoughParams()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-methodparams", "2" });
 }
Esempio n. 28
0
 public void Test_BadInt()
 {
     TestGetOpt t = new TestGetOpt(new string[] { "/some", "one" });
 }
Esempio n. 29
0
 public void Test_DashError()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-broncos" });
 }
Esempio n. 30
0
        public void Test_Env()
        {
            TestGetOpt go = new TestGetOpt(null);

            Assert.IsTrue(go.Args[0].StartsWith("test"));
        }
Esempio n. 31
0
 public void Test_MethodNotEnoughParams()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-methodparams", "2" });
 }
Esempio n. 32
0
 public void Test_CaseInsensitive()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-BaZ:boo" });
     Assert.AreEqual("boo", go.baz);
 }
Esempio n. 33
0
 public void Test_Usage()
 {
     TestGetOpt t = new TestGetOpt();
     Console.WriteLine(t.Usage);
 }
Esempio n. 34
0
 public void Test_Equals()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-baz=boo" });
     Assert.AreEqual("boo", go.baz);
 }
Esempio n. 35
0
 public void Test_Private()
 {
     // hrmph.  This should probably throw an error, if I don't have the right permissions.
     TestGetOpt t = new TestGetOpt(new string[] { "/private", "one" });
     Assert.AreEqual("one", t.baz);
 }
Esempio n. 36
0
 public void Test_DoubleSlash()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "/baz:boo/bar" });
     Assert.AreEqual("boo/bar", go.baz);
 }
Esempio n. 37
0
 public void Test_NunitProblem()
 {
     TestGetOpt go = new TestGetOpt(new string[] { @"/assembly:test.dll" });
     Assert.AreEqual(@"test.dll", go.assembly);
 }
Esempio n. 38
0
 public void Test_DashError()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-broncos" });
 }
Esempio n. 39
0
 public void Test_DashArgs()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-bar", "four", "-baz:one", "more" });
     Assert.AreEqual("four", go.bar);
     Assert.AreEqual("one", go.baz);
     Assert.AreEqual(null, go.e);
     Assert.AreEqual(1, go.Args.Length);
     Assert.AreEqual("more", go.Args[0]);
 }
Esempio n. 40
0
        public void Test_Env()
        {
            TestGetOpt go = new TestGetOpt(null);

            Assert.IsTrue(go.Args[0].StartsWith("test"));
        }