예제 #1
0
        public void NoCommandUsageErrorTest()
        {
            var commandTestClass = new CommandTestClass();
            var dictionary       = new Dictionary <string, string>();
            var argumentMapper   = new ArgumentMapper <CommandTestClass>();

            argumentMapper.Invoking(x => x.Map(commandTestClass, dictionary)).ShouldThrow <CommandLineArgumentException>().WithMessage(
                "The command 'Backup|Init|Restore' must be used.");
        }
예제 #2
0
        public void SingleCommandUsageTest()
        {
            var commandTestClass = new CommandTestClass();
            var dictionary       = new Dictionary <string, string> {
                { "Backup", "true" }
            };
            var argumentMapper = new ArgumentMapper <CommandTestClass>();
            var result         = argumentMapper.Map(commandTestClass, dictionary);

            Assert.AreEqual(result.TheCommand, TestCommandType.Backup);
        }
예제 #3
0
        public void MultipleSameCommandUsageErrorTest()
        {
            var commandTestClass = new CommandTestClass();
            var dictionary       = new Dictionary <string, string> {
                { "Backup", "true" }, { "B", "true" }
            };
            var argumentMapper = new ArgumentMapper <CommandTestClass>();

            argumentMapper.Invoking(x => x.Map(commandTestClass, dictionary)).ShouldThrow <CommandLineArgumentException>().WithMessage(
                "Multiple aruments for 'Backup'-command is not allowed.");
        }