public void NotUsedRequiredArgumentErrorTest() { var commandTestClass = new ArgumentTestClass(); var dictionary = new Dictionary <string, string>(); var argumentMapper = new ArgumentMapper <ArgumentTestClass>(); argumentMapper.Invoking(x => x.Map(commandTestClass, dictionary)).ShouldThrow <MissingCommandLineArgumentException>(); }
public void TrimmedArgumentTest() { var commandTestClass = new ArgumentTestClass(); var dictionary = new Dictionary <string, string> { { "TrimmedArgument", "\"UntrimmedValue\"" }, { "RequiredArgument", "RequiredArgumentValue" } }; var argumentMapper = new ArgumentMapper <ArgumentTestClass>(); var result = argumentMapper.Map(commandTestClass, dictionary); Assert.AreEqual(result.TrimmedArgument, "UntrimmedValue"); }
public void NamedArgumentAliasTest() { var commandTestClass = new ArgumentTestClass(); var dictionary = new Dictionary <string, string> { { "AliasName1", "TheNameValue" }, { "RequiredArgument", "RequiredArgumentValue" } }; var argumentMapper = new ArgumentMapper <ArgumentTestClass>(); var result = argumentMapper.Map(commandTestClass, dictionary); Assert.AreEqual(result.NamedArgument, "TheNameValue"); }
public void RegularUsageTest() { var commandTestClass = new ArgumentTestClass(); var dictionary = new Dictionary <string, string> { { "SimpleArgument", "\"SimpleArgumentValue\"" }, { "TheName", "TheNameValue" }, { "TrimmedArgument", "TrimmedArgumentValue" }, { "RequiredArgument", "RequiredArgumentValue" } }; var argumentMapper = new ArgumentMapper <ArgumentTestClass>(); var result = argumentMapper.Map(commandTestClass, dictionary); Assert.AreEqual(result.SimpleArgument, "\"SimpleArgumentValue\""); Assert.AreEqual(result.NamedArgument, "TheNameValue"); Assert.AreEqual(result.TrimmedArgument, "TrimmedArgumentValue"); Assert.AreEqual(result.RequiredArgument, "RequiredArgumentValue"); }