예제 #1
0
        public void StopsParsingAfterVersions()
        {
            string output;
            var    result = TestHelper.ParseArguments <SimpleArgs>("-Value test --version -name", out output);

            Assert.IsNull(result);
        }
예제 #2
0
        public void ParamDetailsUsed()
        {
            string output;
            var    result = TestHelper.ParseArguments <ClassWithHelp>("--help", out output);

            Assert.IsTrue(output.Contains("A name to use"));
        }
예제 #3
0
        public void HelpDefaultsToProgramName()
        {
            string output;
            var    result = TestHelper.ParseArguments <NormalNoHelp>("--help", out output);

            Assert.IsTrue(output.Contains("UnitTests"));
        }
예제 #4
0
        public void ParsesVersion()
        {
            string output;
            var    result = TestHelper.ParseArguments <SimpleArgs>("--version", out output);

            Assert.IsNull(result);
        }
예제 #5
0
        public void SynopsisIsUsed()
        {
            string output;
            var    result = TestHelper.ParseArguments <ClassWithHelp>("--help", out output);

            Assert.IsTrue(output.Contains("Sample usage of help attributes"));
            Assert.IsFalse(output.Contains("UnitTests"));
        }
예제 #6
0
        public void HelpDetected()
        {
            string output;
            var    result = TestHelper.ParseArguments <NormalNoHelp>("--help", out output);

            Assert.IsNull(result);
            Assert.IsFalse(output.Contains("No switch named "));
        }
예제 #7
0
        public void ShowsDetailedDescription()
        {
            string output;
            var    result = TestHelper.ParseArguments <ClassWithHelp>("--help", out output);

            Assert.IsTrue(output.Contains("Detailed class information"));
            Assert.IsTrue(output.Contains("Detailed information"));
        }
예제 #8
0
        public void DoesntParseArguments()
        {
            string output;
            var    result = TestHelper.ParseArguments <NormalNoHelp>("-Value one --help -NameSpeltWrong", out output);

            Assert.IsNull(result);
            Assert.IsFalse(output.Contains("No switch named "));
            Assert.IsFalse(output.Contains("The value specified for"));
        }
예제 #9
0
        public void ShowsVersion()
        {
            string output;
            var    result = TestHelper.ParseArguments <SimpleArgs>("-Value test --version -name", out output);

            Assert.IsTrue(output.Contains("1.0.0.0"));
            Assert.IsFalse(output.Contains("1.2.0.0"));
            Assert.IsTrue(output.Contains("UnitTests"));
        }
예제 #10
0
        public void SyntaxIsShown()
        {
            string output;
            var    result = TestHelper.ParseArguments <ClassWithHelp>("--help", out output);

            Assert.IsTrue(output.Contains("[Name System.String]"));
            Assert.IsTrue(output.Contains("[Value System.Int32]"));
            Assert.IsTrue(output.Contains("Required System.String"));
            Assert.IsFalse(output.Contains("[Required System.String]"));
            Assert.IsTrue(output.Contains("[[Positional] System.Int32]"));
            Assert.IsTrue(output.Contains("[PositionalAndRequired] System.Single"));
            Assert.IsFalse(output.Contains("[[PositionalAndRequired] System.Single]"));
            Assert.IsTrue(output.IndexOf("[[Positional] System.Int32]") < output.IndexOf("[PositionalAndRequired] System.Single"));
        }