public void DisplayHelp() { _textUI.DisplayHelp(); Assert.That(Report, Does.StartWith("Usage: NUNITLITE")); // TODO: Further assertions? }
// // Entry point called by AutoRun and by the .NET Standard nunitlite.runner // public int Execute(ExtendedTextWriter writer, TextReader reader, string[] args) // { // _options = new NUnitLiteOptions(_testAssembly == null, args); // // _textUI = new TextUI(writer, reader, _options); // // return Execute(); // } // Internal Execute depends on _textUI and _options having been set already. private int Execute() { _runner = new NUnitTestAssemblyRunner(new DefaultTestAssemblyBuilder()); try { if (_options.ErrorMessages.Count > 0) { _textUI.DisplayErrors(_options.ErrorMessages); _textUI.Writer.WriteLine(); _textUI.DisplayHelp(); return(TextRunner.INVALID_ARG); } if (_testAssembly == null && _options.InputFile == null) { _textUI.DisplayError("No test assembly was specified."); _textUI.Writer.WriteLine(); _textUI.DisplayHelp(); return(TextRunner.OK); } var testFile = _testAssembly != null ? AssemblyHelper.GetAssemblyPath(_testAssembly) : _options.InputFile; if (_testAssembly == null) { _testAssembly = AssemblyHelper.Load(testFile); } if (_options.WaitBeforeExit && _options.OutFile != null) { _textUI.DisplayWarning("Ignoring /wait option - only valid for Console"); } var runSettings = NUnitLite.TextRunner.MakeRunSettings(_options); LoadTests(runSettings); // We display the filters at this point so that any exception message // thrown by CreateTestFilter will be understandable. _textUI.DisplayTestFilters(); TestFilter filter = TextRunner.CreateTestFilter(_options); return(RunTests(filter, runSettings)); } catch (FileNotFoundException ex) { _textUI.DisplayError(ex.Message); return(FILE_NOT_FOUND); } catch (Exception ex) { _textUI.DisplayError(ex.ToString()); return(UNEXPECTED_ERROR); } finally { if (_options.WaitBeforeExit) { _textUI.WaitForUser("Press Enter key to continue . . ."); } } }