Example #1
0
        [Test] public void Test_Construct()
        {
            TestGetOpt t = new TestGetOpt(new string[] { "/f", "/bar", "baz" });

            Assert.AreEqual(true, t.foo);
            Assert.AreEqual("baz", t.bar);
        }
Example #2
0
        [Test] 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);
        }
Example #3
0
 [Test] 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);
 }
Example #4
0
 [Test] 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);
 }
Example #5
0
        [Test] 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);
        }
Example #6
0
        [Test] 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);
        }
Example #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]);
 }
Example #8
0
        [Test] 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);
        }
Example #9
0
        [Test] 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]);
        }
Example #10
0
        [Test] 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]);
        }
Example #11
0
 [Test] 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]);
 }
Example #12
0
        [Test] 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]);
        }
Example #13
0
 public void Test_Construct()
 {
     TestGetOpt t = new TestGetOpt(new string[] {"/f", "/bar", "baz"});
     Assert.AreEqual(true, t.foo);
     Assert.AreEqual("baz", t.bar);
 }
Example #14
0
 [Test] public void Test_DashInsufficientError()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-some"});
 }
Example #15
0
 [Test] public void Test_MethodNotEnoughParams()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-methodparams", "2" });
 }
Example #16
0
        [Test] public void Test_Usage()
        {
            TestGetOpt t = new TestGetOpt();

            Console.WriteLine(t.Usage);
        }
Example #17
0
 public void Test_Enum()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-fb:bar"});
     Assert.AreEqual(TestOptEnum.BAR, go.fb);
 }
Example #18
0
 [Test] public void Test_DashError()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-broncos" });
 }
Example #19
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);
 }
Example #20
0
        [Test] public void Test_Enum()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-fb:bar" });

            Assert.AreEqual(TestOptEnum.BAR, go.fb);
        }
Example #21
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);
 }
Example #22
0
 public void Test_NunitProblem()
 {
     TestGetOpt go = new TestGetOpt(new string[] {@"/assembly:test.dll"});
     Assert.AreEqual(@"test.dll", go.assembly);
 }
Example #23
0
 public void Test_MethodNotEnoughParams()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-methodparams", "2"});
 }
Example #24
0
 public void Test_Method()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-method"});
     Assert.AreEqual("after", go.m);
 }
Example #25
0
 public void Test_InsufficientError()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"/some"});
 }
Example #26
0
 public void Test_Error()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"/broncos"});
 }
Example #27
0
 public void Test_Usage()
 {
     TestGetOpt t = new TestGetOpt();
     Console.WriteLine(t.Usage);
 }
Example #28
0
        [Test] public void Test_NunitProblem()
        {
            TestGetOpt go = new TestGetOpt(new string[] { @"/assembly:test.dll" });

            Assert.AreEqual(@"test.dll", go.assembly);
        }
Example #29
0
 [Test] public void Test_DashError()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-broncos"});
 }
Example #30
0
        [Test] public void Test_Method()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-method" });

            Assert.AreEqual("after", go.m);
        }
Example #31
0
 public void Test_BadInt()
 {
     TestGetOpt t = new TestGetOpt(new string[] {"/some", "one"});
 }
Example #32
0
 [Test] public void Test_BadInt()
 {
     TestGetOpt t = new TestGetOpt(new string[] { "/some", "one" });
 }
Example #33
0
        public void Test_Env()
        {
            TestGetOpt go = new TestGetOpt(null);

            Assert.IsTrue(go.Args[0].StartsWith("test"));
        }
Example #34
0
 [Test] public void Test_DashInsufficientError()
 {
     TestGetOpt go = new TestGetOpt(new string[] { "-some" });
 }
Example #35
0
        [Test] public void Test_Env()
        {
            TestGetOpt go = new TestGetOpt(null);

            Assert.IsTrue(go.Args[0].StartsWith("test"));
        }
Example #36
0
 public void Test_DoubleSlash()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"/baz:boo/bar"});
     Assert.AreEqual("boo/bar", go.baz);
 }
Example #37
0
        [Test] public void Test_CaseInsensitive()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-BaZ:boo" });

            Assert.AreEqual("boo", go.baz);
        }
Example #38
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]);
 }
Example #39
0
        [Test] public void Test_Equals()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "-baz=boo" });

            Assert.AreEqual("boo", go.baz);
        }
Example #40
0
 public void Test_CaseInsensitive()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-BaZ:boo"});
     Assert.AreEqual("boo", go.baz);
 }
Example #41
0
        [Test] public void Test_DoubleSlash()
        {
            TestGetOpt go = new TestGetOpt(new string[] { "/baz:boo/bar" });

            Assert.AreEqual("boo/bar", go.baz);
        }
Example #42
0
 [Test] public void Test_DoubleColon()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"/baz:boo:bar"});
     Assert.AreEqual("boo:bar", go.baz);
 }
Example #43
0
 public void Test_Equals()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-baz=boo"});
     Assert.AreEqual("boo", go.baz);
 }