public void CanParseManyArgumentsWithValue()
        {
            // arrange

            // act
            var parser = new CommandLineParserStub(new[] { "-arg:value", "-arg1:value1" });

            // assert
            Assert.AreEqual(2, parser.ArgumentCount);
            Assert.IsTrue(parser.HasArgument("arg"));
            Assert.AreEqual("value", parser.GetArgumentValue("arg"));
            Assert.IsTrue(parser.HasArgument("arg1"));
            Assert.AreEqual("value1", parser.GetArgumentValue("arg1"));
        }
Example #2
0
        public void CanParseManyArgumentsWithValue()
        {
            // arrange

            // act
            var parser = new CommandLineParserStub(new[] { "-arg:value", "-arg1:value1" });

            // assert
            Assert.AreEqual(2, parser.ArgumentCount);
            Assert.IsTrue(parser.HasArgument("arg"));
            Assert.AreEqual("value", parser.GetArgumentValue("arg"));
            Assert.IsTrue(parser.HasArgument("arg1"));
            Assert.AreEqual("value1", parser.GetArgumentValue("arg1"));
        }
Example #3
0
        public void CanParseMultipleArgumentsWithValuesWithSamekey()
        {
            // arrange

            // act
            var parser = new CommandLineParserStub(new[] { "-arg:value", "-arg1", "-arg2:", "-arg:value1", "-arg1", "-arg2:" });

            // assert
            Assert.AreEqual(3, parser.ArgumentCount);
            Assert.IsTrue(parser.HasArgument("arg"));
            Assert.AreEqual("value value1", parser.GetArgumentValue("arg"));
            Assert.IsTrue(parser.HasArgument("arg1"));
            Assert.AreEqual(string.Empty, parser.GetArgumentValue("arg1"));
            Assert.IsTrue(parser.HasArgument("arg2"));
            Assert.AreEqual(string.Empty, parser.GetArgumentValue("arg2"));
        }
        public void CanParseMultipleArgumentsWithValues()
        {
            // arrange

            // act
            var parser = new CommandLineParserStub(new[] { "-arg:value", "-arg1", "-arg2:" });

            // assert
            Assert.AreEqual(3, parser.ArgumentCount);
            Assert.IsTrue(parser.HasArgument("arg"));
            Assert.AreEqual("value", parser.GetArgumentValue("arg"));
            Assert.IsTrue(parser.HasArgument("arg1"));
            Assert.AreEqual(string.Empty, parser.GetArgumentValue("arg1"));
            Assert.IsTrue(parser.HasArgument("arg2"));
            Assert.AreEqual(string.Empty, parser.GetArgumentValue("arg2"));
        }
Example #5
0
        public void GetArgumentValue_ReturnsEmpty_WhenArgumentUnknown()
        {
            // arrange

            // act
            var parser = new CommandLineParserStub(new[] { "-arg1" });

            // assert
            Assert.AreEqual(String.Empty, parser.GetArgumentValue("xxxx"));
        }
Example #6
0
        public void CanParseOneArgumentWithEmptyValueWithSamekey()
        {
            // arrange

            // act
            var parser = new CommandLineParserStub(new[] { "-arg:", "-arg:" });

            // assert
            Assert.AreEqual(1, parser.ArgumentCount);
            Assert.IsTrue(parser.HasArgument("arg"));
            Assert.AreEqual(String.Empty, parser.GetArgumentValue("arg"));
        }
Example #7
0
        public void CanParseOneArgumentWithValueWithSamekey()
        {
            // arrange

            // act
            var parser = new CommandLineParserStub(new[] { "-arg:value", "-arg:value1" });

            // assert
            Assert.AreEqual(1, parser.ArgumentCount);
            Assert.IsTrue(parser.HasArgument("arg"));
            Assert.AreEqual("value value1", parser.GetArgumentValue("arg"));
            //Result will be space appended values.
        }
        public void CanParseOneArgumentWithEmptyValueWithSamekey()
        {
            // arrange

            // act
            var parser = new CommandLineParserStub(new[] { "-arg:", "-arg:" });

            // assert
            Assert.AreEqual(1, parser.ArgumentCount);
            Assert.IsTrue(parser.HasArgument("arg"));
            Assert.AreEqual(String.Empty, parser.GetArgumentValue("arg"));
        }
        public void CanParseOneArgumentWithValueWithSamekey()
        {
            // arrange

            // act
            var parser = new CommandLineParserStub(new[] { "-arg:value", "-arg:value1" });

            // assert
            Assert.AreEqual(1, parser.ArgumentCount);
            Assert.IsTrue(parser.HasArgument("arg"));
            Assert.AreEqual("value value1", parser.GetArgumentValue("arg"));
            //Result will be space appended values.
        }
        public void GetArgumentValue_ReturnsEmpty_WhenArgumentUnknown()
        {
            // arrange

            // act
            var parser = new CommandLineParserStub(new[] { "-arg1" });

            // assert
            Assert.AreEqual(String.Empty, parser.GetArgumentValue("xxxx"));
        }