Esempio n. 1
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);
 }
Esempio n. 2
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);
 }
Esempio n. 3
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]);
 }
Esempio n. 4
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]);
 }
Esempio n. 5
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]);
 }
Esempio n. 6
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);
 }
Esempio n. 7
0
 [Test] public void Test_NunitProblem()
 {
     TestGetOpt go = new TestGetOpt(new string[] {@"/assembly:test.dll"});
     Assert.AreEqual(@"test.dll", go.assembly);
 }
Esempio n. 8
0
 [Test] public void Test_CaseInsensitive()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-BaZ:boo"});
     Assert.AreEqual("boo", go.baz);
 }
Esempio n. 9
0
 [Test] public void Test_DashInsufficientError()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-some"});
 }
Esempio n. 10
0
 [Test] public void Test_DashError()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-broncos"});
 }
Esempio n. 11
0
 [Test] public void Test_BadInt()
 {
     TestGetOpt t = new TestGetOpt(new string[] {"/some", "one"});
 }
Esempio n. 12
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);
 }
Esempio n. 13
0
 [Test] public void Test_Method()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-method"});
     Assert.AreEqual("after", go.m);
 }
Esempio n. 14
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);
 }
Esempio n. 15
0
 [Test] public void Test_Enum()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-fb:bar"});
     Assert.AreEqual(TestOptEnum.BAR, go.fb);
 }
Esempio n. 16
0
 [Test] public void Test_Usage()
 {
     TestGetOpt t = new TestGetOpt();
     Console.WriteLine(t.Usage);
 }
Esempio n. 17
0
        [Test] public void Test_Env()
        {
            TestGetOpt go = new TestGetOpt(null);

            Assert.IsTrue(go.Args[0].StartsWith("test"));
        }
Esempio n. 18
0
 [Test] public void Test_MethodNotEnoughParams()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-methodparams", "2"});
 }
Esempio n. 19
0
 [Test] public void Test_Equals()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"-baz=boo"});
     Assert.AreEqual("boo", go.baz);
 }
Esempio n. 20
0
 [Test] public void Test_DoubleSlash()
 {
     TestGetOpt go = new TestGetOpt(new string[] {"/baz:boo/bar"});
     Assert.AreEqual("boo/bar", go.baz);
 }