public static int Main(string[] args) { var newArgs = TestCommandLine.HandleCommandLine(args, out bool showHelp); // Help argument needs to be the first one to xunit, so don't insert assembly location in that case if (showHelp) { newArgs.Insert(0, "/?"); } else { newArgs.Insert(0, typeof(Program).Assembly.Location); } if (!showHelp) { BeforeTestRun(newArgs); } int returnCode = Xunit.ConsoleClient.Program.Main(newArgs.ToArray()); if (showHelp) { TestCommandLine.ShowHelp(); } else { AfterTestRun(); } return(returnCode); }
public void Help() { var cmd = new TestCommandLine(); var help = cmd.Help(); Console.WriteLine(help); }
public void ParseCommandLine() { var cmd = new TestCommandLine(); Console.WriteLine($"profile0={cmd.Profile}"); Assert.AreEqual("default", cmd.Profile); cmd.Parse(new List <string> { "-p", "xp", "argument", "--verbose", "arg2", "-t", "00:01:23" }); Console.WriteLine($"profile2={cmd.Profile}, verbose={cmd.Verbose}, timeout={cmd.Timeout}"); Assert.AreEqual("xp", cmd.Profile); Assert.AreEqual(2, cmd.Arguments.Count); }
public static int Main(string[] args) { var testCommandLine = TestCommandLine.HandleCommandLine(args); var newArgs = testCommandLine.RemainingArgs.ToList(); // Help argument needs to be the first one to xunit, so don't insert assembly location in that case if (testCommandLine.ShouldShowHelp) { newArgs.Insert(0, "-?"); } else { newArgs.Insert(0, typeof(Program).Assembly.Location); } if (!testCommandLine.ShouldShowHelp) { newArgs.AddRange(TestCommandLine.GetXunitArgsFromTestConfig(testCommandLine.TestConfigFile)); BeforeTestRun(newArgs); } int returnCode; if (testCommandLine.ShowSdkInfo) { returnCode = ShowSdkInfo(); } else { returnCode = Xunit.ConsoleClient.Program.Main(newArgs.ToArray()); } if (testCommandLine.ShouldShowHelp) { TestCommandLine.ShowHelp(); ShowAdditionalHelp(); } else { AfterTestRun(); } return(returnCode); }