public void CommandLineArgumentType_ToArgument_When_BlogUrl_Argument_ReturnsArgument_Test()
        {
            const string arg = "-blogurl";
            //given
            CommandLineArgumentType type = CommandLineArgumentType.BlogUrl;
            //when
            string value = type.ToArgument();

            //then
            value.Should().Be(arg);
        }
        public void CommandLineArgumentType_ToArgument_When_OutputDir_Argument_ReturnsArgument_Test()
        {
            const string arg = "-outputdir";
            //given
            CommandLineArgumentType type = CommandLineArgumentType.OutputDir;
            //when
            string value = type.ToArgument();

            //then
            value.Should().Be(arg);
        }
예제 #3
0
        public CommandLineArgument Parse(string[] args, CommandLineArgumentType type)
        {
            string arg   = type.ToArgument();
            int    index = Array.IndexOf(args, arg);

            if (index == -1)
            {
                return(null);
            }

            if (index + 1 > args.Length - 1)
            {
                return(null);
            }

            return(new CommandLineArgument(type, args[index + 1]));
        }