protected CommandResult RunTest( DotNetCli dotnet, TestApp app, TestSettings settings, Action <CommandResult> resultAction = null, bool multiLevelLookup = false) { using (DotNetCliExtensions.DotNetCliCustomizer dotnetCustomizer = settings.DotnetCustomizer == null ? null : dotnet.Customize()) { settings.DotnetCustomizer?.Invoke(dotnetCustomizer); if (settings.RuntimeConfigCustomizer != null) { settings.RuntimeConfigCustomizer(RuntimeConfig.Path(app.RuntimeConfigJson)).Save(); } settings.WithCommandLine(app.AppDll); Command command = dotnet.Exec(settings.CommandLine.First(), settings.CommandLine.Skip(1).ToArray()); if (settings.WorkingDirectory != null) { command = command.WorkingDirectory(settings.WorkingDirectory); } CommandResult result = command .EnableTracingAndCaptureOutputs() .MultilevelLookup(multiLevelLookup) .Environment(settings.Environment) .Execute(); resultAction?.Invoke(result); return(result); } }
protected CommandResult RunTest( DotNetCli dotnet, TestApp app, TestSettings settings, Action <CommandResult> resultAction = null, bool multiLevelLookup = false) { using (DotNetCliExtensions.DotNetCliCustomizer dotnetCustomizer = settings.DotnetCustomizer == null ? null : dotnet.Customize()) { settings.DotnetCustomizer?.Invoke(dotnetCustomizer); if (settings.RuntimeConfigCustomizer != null) { settings.RuntimeConfigCustomizer(RuntimeConfig.Path(app.RuntimeConfigJson)).Save(); } settings.WithCommandLine(app.AppDll); Command command = dotnet.Exec(settings.CommandLine.First(), settings.CommandLine.Skip(1).ToArray()); if (settings.WorkingDirectory != null) { command = command.WorkingDirectory(settings.WorkingDirectory); } CommandResult result = command .EnvironmentVariable("COREHOST_TRACE", "1") .EnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", multiLevelLookup ? "1" : "0") .Environment(settings.Environment) .CaptureStdOut() .CaptureStdErr() .Execute(); resultAction?.Invoke(result); return(result); } }