public void CreateTextUI() { _reportBuilder = new StringBuilder(); var writer = new ExtendedTextWrapper(new StringWriter(_reportBuilder)); var options = new NUnitLiteOptions(); _textUI = new TextUI(writer, null, options); }
public static void Main(string[] args) { var writter = new ExtendedTextWrapper(Console.Out); new AutoRun(typeof(Program).GetTypeInfo().Assembly).Execute(args, writter, Console.In); Console.WriteLine("Testing Completed."); Console.Read(); }
public static int Main(string[] args) { #if NET451 return new AutoRun().Execute(args); #else var writer = new ExtendedTextWrapper(Console.Out); return new AutoRun(typeof(Program).GetTypeInfo().Assembly).Execute(args, writer, Console.In); #endif }
public void CreateReporter() { _report = new StringBuilder(); var writer = new ExtendedTextWrapper(new StringWriter(_report)); var options = new ConsoleOptions(); options.Parse(new string[] { "MockTestResult.xml" }); _reporter = new ResultReporter(_result, writer, options); }
public void CreateTextUI() { _reportBuilder = new StringBuilder(); var writer = new ExtendedTextWrapper(new StringWriter(_reportBuilder)); #if !SILVERLIGHT var options = new ConsoleOptions(); _textUI = new TextUI(writer, options); #else _textUI = new TextUI(writer); #endif }
/// <summary> /// The main program executes the tests. Output may be routed to /// various locations, depending on the arguments passed. /// </summary> /// <remarks>Run with --help for a full list of arguments supported</remarks> /// <param name="args"></param> public static int Main(string[] args) { var licenseKey = Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE"); if (licenseKey.IsNullOrEmpty()) throw new ArgumentNullException("SERVICESTACK_LICENSE", "Add Environment variable for SERVICESTACK_LICENSE"); Licensing.RegisterLicense(licenseKey); //"ActivatedLicenseFeatures: ".Print(LicenseUtils.ActivatedLicenseFeatures()); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); JsConfig.InitStatics(); //JsonServiceClient client = new JsonServiceClient(); var writer = new ExtendedTextWrapper(Console.Out); return new AutoRun(((IReflectableType)typeof(NetCoreTestsRunner)).GetTypeInfo().Assembly).Execute(args, writer, Console.In); }
/// <summary> /// The main program executes the tests. Output may be routed to /// various locations, depending on the arguments passed. /// </summary> /// <remarks>Run with --help for a full list of arguments supported</remarks> /// <param name="args"></param> public static int Main(string[] args) { var licenseKey = Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE"); if (licenseKey.IsNullOrEmpty()) throw new ArgumentNullException("SERVICESTACK_LICENSE", "Add Environment variable for SERVICESTACK_LICENSE"); Licensing.RegisterLicense(licenseKey); //"ActivatedLicenseFeatures: ".Print(LicenseUtils.ActivatedLicenseFeatures()); var sqlServerBuildDb = Environment.GetEnvironmentVariable("SQL_SERVER_BUILD_DB"); if (!String.IsNullOrEmpty(sqlServerBuildDb)) { Config.SqlServerBuildDb = sqlServerBuildDb; Config.DefaultConnection = Config.SqlServerBuildDb; } var postgreSqlDb = Environment.GetEnvironmentVariable("POSTGRESQL_DB"); if (!String.IsNullOrEmpty(postgreSqlDb)) { Config.PostgreSqlDb = postgreSqlDb; } var dialect = Environment.GetEnvironmentVariable("ORMLITE_DIALECT"); if (!String.IsNullOrEmpty(dialect)) { Dialect defaultDialect; if (Enum.TryParse(dialect, out defaultDialect)) Config.DefaultDialect = defaultDialect; } Console.WriteLine($"Dialect: {Config.DefaultDialect}"); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); JsConfig.InitStatics(); //JsonServiceClient client = new JsonServiceClient(); var writer = new ExtendedTextWrapper(Console.Out); return new AutoRun(((IReflectableType)typeof(NetCoreTestsRunner)).GetTypeInfo().Assembly).Execute(args, writer, Console.In); }
public int Execute(string[] args) { var options = new NUnitLiteOptions(args); InitializeInternalTrace(options); ExtendedTextWriter outWriter = null; if (options.OutFile != null) { outWriter = new ExtendedTextWrapper(new StreamWriter(Path.Combine(options.WorkDirectory, options.OutFile))); Console.SetOut(outWriter); } else { outWriter = new ColorConsoleWriter(); } TextWriter errWriter = null; if (options.ErrFile != null) { errWriter = new StreamWriter(Path.Combine(options.WorkDirectory, options.ErrFile)); Console.SetError(errWriter); } try { return Execute(outWriter, Console.In, options); } finally { if (options.OutFile != null && outWriter != null) outWriter.Close(); if (options.ErrFile != null && errWriter != null) errWriter.Close(); } }
public void CreateReporter() { _report = new StringBuilder(); var writer = new ExtendedTextWrapper(new StringWriter(_report)); _reporter = new ResultReporter(_result, writer, new ConsoleOptions()); }
/// <summary> /// Execute the tests in the assembly, passing in /// a list of arguments. /// </summary> /// <param name="args">Execution options</param> public int Execute(string[] args) { var options = new ConsoleOptions(args); var callingAssembly = Assembly.GetCallingAssembly(); var level = (InternalTraceLevel)Enum.Parse(typeof(InternalTraceLevel), options.InternalTraceLevel ?? "Off", true); #if NETCF // NETCF: Try to unify InitializeInternalTrace(callingAssembly.GetName().CodeBase, level); #else InitializeInternalTrace(callingAssembly.Location, level); #endif ExtendedTextWriter outWriter = null; if (options.OutFile != null) { outWriter = new ExtendedTextWrapper(new StreamWriter(Path.Combine(options.WorkDirectory, options.OutFile))); Console.SetOut(outWriter); } TextWriter errWriter = null; if (options.ErrFile != null) { errWriter = new StreamWriter(Path.Combine(options.WorkDirectory, options.ErrFile)); Console.SetError(errWriter); } var _textUI = new TextUI(outWriter, options); if (!options.NoHeader) _textUI.DisplayHeader(); if (options.ShowHelp) { _textUI.DisplayHelp(); return TextRunner.OK; } if (options.ErrorMessages.Count > 0) { _textUI.DisplayErrors(options.ErrorMessages); _textUI.DisplayHelp(); return TextRunner.INVALID_ARG; } #if !PORTABLE if (options.InputFiles.Count > 0) { _textUI.DisplayError("Input assemblies may not be specified when using the NUnitLite AutoRunner"); return TextRunner.INVALID_ARG; } #endif _textUI.DisplayTestFiles(new string[] { callingAssembly.GetName().Name }); _textUI.DisplayRuntimeEnvironment(); _textUI.DisplayRequestedOptions(); if (options.WaitBeforeExit && options.OutFile != null) _textUI.DisplayWarning("Ignoring /wait option - only valid for Console"); try { return new TextRunner(_textUI, options).Execute(callingAssembly); } finally { if (options.WaitBeforeExit) _textUI.WaitForUser("Press Enter key to continue . . ."); if (outWriter != null) outWriter.Close(); if (errWriter != null) errWriter.Close(); } }