예제 #1
0
        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>();
        }
예제 #2
0
        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");
        }
예제 #3
0
        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");
        }
예제 #4
0
        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");
        }