public TestRunner(RunTestsOptions options) { Options = options; EnvironmentVariables = new Dictionary <string, string>(); }
public static RunTestsOptions Parse(string[] args) { var command = new RootCommand() { new Option( aliases: new string[] { "--target", "-t" }, description: "The test dll to run") { Argument = new Argument <string>(), Required = true }, new Option( aliases: new string[] { "--sdk" }, description: "The version of the sdk being used") { Argument = new Argument <string>(), Required = true }, new Option( aliases: new string[] { "--runtime" }, description: "The version of the runtime being used") { Argument = new Argument <string>(), Required = true }, new Option( aliases: new string[] { "--queue" }, description: "The name of the Helix queue being run on") { Argument = new Argument <string>(), Required = true }, new Option( aliases: new string[] { "--arch" }, description: "The architecture being run on") { Argument = new Argument <string>(), Required = true }, new Option( aliases: new string[] { "--quarantined" }, description: "Whether quarantined tests should run or not") { Argument = new Argument <bool>(), Required = true }, new Option( aliases: new string[] { "--ef" }, description: "The version of the EF tool to use") { Argument = new Argument <string>(), Required = true }, new Option( aliases: new string[] { "--aspnetruntime" }, description: "The path to the aspnet runtime nupkg to install") { Argument = new Argument <string>(), Required = true }, new Option( aliases: new string[] { "--aspnetref" }, description: "The path to the aspnet ref nupkg to install") { Argument = new Argument <string>(), Required = true }, new Option( aliases: new string[] { "--helixTimeout" }, description: "The timeout duration of the Helix job") { Argument = new Argument <string>(), Required = true }, new Option( aliases: new string[] { "--source" }, description: "The restore sources to use during testing") { Argument = new Argument <string>() { Arity = ArgumentArity.ZeroOrMore }, Required = true } }; var parseResult = command.Parse(args); var options = new RunTestsOptions(); options.Target = parseResult.ValueForOption <string>("--target"); options.SdkVersion = parseResult.ValueForOption <string>("--sdk"); options.RuntimeVersion = parseResult.ValueForOption <string>("--runtime"); options.HelixQueue = parseResult.ValueForOption <string>("--queue"); options.Architecture = parseResult.ValueForOption <string>("--arch"); options.Quarantined = parseResult.ValueForOption <bool>("--quarantined"); options.EfVersion = parseResult.ValueForOption <string>("--ef"); options.AspNetRuntime = parseResult.ValueForOption <string>("--aspnetruntime"); options.AspNetRef = parseResult.ValueForOption <string>("--aspnetref"); options.Timeout = TimeSpan.Parse(parseResult.ValueForOption <string>("--helixTimeout")); options.Source = parseResult.ValueForOption <IEnumerable <string> >("--source"); options.HELIX_WORKITEM_ROOT = Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"); options.Path = Environment.GetEnvironmentVariable("PATH"); options.DotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT"); return(options); }