protected CommandResult RunSelfContainedTest( TestApp app, TestSettings settings) { if (settings.RuntimeConfigCustomizer != null) { settings.RuntimeConfigCustomizer(RuntimeConfig.Path(app.RuntimeConfigJson)).Save(); } settings.WithCommandLine(app.AppDll); Command command = Command.Create(app.AppExe, settings.CommandLine); if (settings.WorkingDirectory != null) { command = command.WorkingDirectory(settings.WorkingDirectory); } CommandResult result = command .EnableTracingAndCaptureOutputs() .Environment(settings.Environment) .Execute(); return(result); }
public TestApp CreateFrameworkReferenceApp(string fxName, string fxVersion) { // Prepare the app mock - we're not going to run anything really, so we just need the basic files TestApp testApp = CreateTestApp(Location, "FrameworkReferenceApp"); RuntimeConfig.Path(testApp.RuntimeConfigJson) .WithFramework(fxName, fxVersion) .Save(); return(testApp); }
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 (app is not null) { 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); } }
protected void RunTest( DotNetCli dotnet, TestApp app, TestSettings settings, Action <CommandResult> resultAction, bool multiLevelLookup = false) { if (settings.RuntimeConfigCustomizer != null) { settings.RuntimeConfigCustomizer(RuntimeConfig.Path(app.RuntimeConfigJson)).Save(); } settings.WithCommandLine(app.AppDll); CommandResult result = dotnet.Exec(settings.CommandLine.First(), settings.CommandLine.Skip(1).ToArray()) .EnvironmentVariable("COREHOST_TRACE", "1") .EnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", multiLevelLookup ? "1" : "0") .Environment(settings.Environment) .CaptureStdOut() .CaptureStdErr() .Execute(); resultAction(result); }