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

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

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

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

            Assert.IsNull(result);
        }
Exemplo n.º 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"));
        }
Exemplo n.º 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 "));
        }
Exemplo n.º 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"));
        }
Exemplo n.º 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"));
        }
Exemplo n.º 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"));
        }
Exemplo n.º 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"));
        }