[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); }
[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); }
[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]); }
[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]); }
[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]); }
[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); }
[Test] public void Test_NunitProblem() { TestGetOpt go = new TestGetOpt(new string[] {@"/assembly:test.dll"}); Assert.AreEqual(@"test.dll", go.assembly); }
[Test] public void Test_CaseInsensitive() { TestGetOpt go = new TestGetOpt(new string[] {"-BaZ:boo"}); Assert.AreEqual("boo", go.baz); }
[Test] public void Test_DashInsufficientError() { TestGetOpt go = new TestGetOpt(new string[] {"-some"}); }
[Test] public void Test_DashError() { TestGetOpt go = new TestGetOpt(new string[] {"-broncos"}); }
[Test] public void Test_BadInt() { TestGetOpt t = new TestGetOpt(new string[] {"/some", "one"}); }
[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); }
[Test] public void Test_Method() { TestGetOpt go = new TestGetOpt(new string[] {"-method"}); Assert.AreEqual("after", go.m); }
[Test] public void Test_Construct() { TestGetOpt t = new TestGetOpt(new string[] {"/f", "/bar", "baz"}); Assert.AreEqual(true, t.foo); Assert.AreEqual("baz", t.bar); }
[Test] public void Test_Enum() { TestGetOpt go = new TestGetOpt(new string[] {"-fb:bar"}); Assert.AreEqual(TestOptEnum.BAR, go.fb); }
[Test] public void Test_Usage() { TestGetOpt t = new TestGetOpt(); Console.WriteLine(t.Usage); }
[Test] public void Test_Env() { TestGetOpt go = new TestGetOpt(null); Assert.IsTrue(go.Args[0].StartsWith("test")); }
[Test] public void Test_MethodNotEnoughParams() { TestGetOpt go = new TestGetOpt(new string[] {"-methodparams", "2"}); }
[Test] public void Test_Equals() { TestGetOpt go = new TestGetOpt(new string[] {"-baz=boo"}); Assert.AreEqual("boo", go.baz); }
[Test] public void Test_DoubleSlash() { TestGetOpt go = new TestGetOpt(new string[] {"/baz:boo/bar"}); Assert.AreEqual("boo/bar", go.baz); }