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")); }
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")); }
public void GetArgumentValue_ReturnsEmpty_WhenArgumentUnknown() { // arrange // act var parser = new CommandLineParserStub(new[] { "-arg1" }); // assert Assert.AreEqual(String.Empty, parser.GetArgumentValue("xxxx")); }
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. }