Esempio n. 1
0
        public LaunchOptions Parse(string[] args)
        {
            var dotNetArgumentParser = new DotNetArgumentParser();

            DotNetCommandLineOptions dotNetOptions = dotNetArgumentParser.Parse(args);

            var nspecArgumentParser = new NSpecArgumentParser();

            NSpecCommandLineOptions nspecOptions = nspecArgumentParser.Parse(dotNetOptions.NSpecArgs);

            var allUnknownArgs = dotNetOptions.UnknownArgs
                                 .Concat(nspecOptions.UnknownArgs);

            var options = new LaunchOptions(dotNetOptions, nspecOptions, allUnknownArgs);

            return(options);
        }
Esempio n. 2
0
        public DotNetCommandLineOptions Parse(IEnumerable <string> args)
        {
            IEnumerable <string> dotNetTestArgs = args.TakeWhile(arg => arg != nspecArgDivider);
            IEnumerable <string> nspecArgs      = args.Skip(dotNetTestArgs.Count() + 1);

            var options = new DotNetCommandLineOptions();

            // look for first argument (the project), before remaining dotnet-test options

            string firstArg = dotNetTestArgs.FirstOrDefault();

            if (IsUnknownArgument(firstArg))
            {
                options.Project = firstArg;

                dotNetTestArgs = dotNetTestArgs.Skip(1);
            }

            // look for remaining dotnet-test options

            IEnumerable <string> remainingArgs;

            remainingArgs = ParsingUtils.SetIntForOptionalArg(dotNetTestArgs,
                                                              parentProcessArgKey, value => options.ParentProcessId = value);

            remainingArgs = ParsingUtils.SetIntForOptionalArg(remainingArgs,
                                                              portArgKey, value => options.Port = value);

            remainingArgs = ParsingUtils.SetBoolForSwitchArg(remainingArgs,
                                                             designTimeArgKey, value => options.DesignTime = value);

            remainingArgs = ParsingUtils.SetBoolForSwitchArg(remainingArgs,
                                                             listArgKey, value => options.List = value);

            remainingArgs = ParsingUtils.SetBoolForSwitchArg(remainingArgs,
                                                             waitCommandArgKey, value => options.WaitCommand = value);

            options.NSpecArgs = nspecArgs.ToArray();

            options.UnknownArgs = remainingArgs.ToArray();

            return(options);
        }
Esempio n. 3
0
 public DotNetCommandLineOptions(DotNetCommandLineOptions source)
     : base(source)
 {
     NSpecArgs   = source.NSpecArgs;
     UnknownArgs = source.UnknownArgs;
 }