diff --git a/src/Amusoft.DotnetNew.Tests/CLI/DotnetNew.cs b/src/Amusoft.DotnetNew.Tests/CLI/DotnetNew.cs index 80e2cff..134e038 100644 --- a/src/Amusoft.DotnetNew.Tests/CLI/DotnetNew.cs +++ b/src/Amusoft.DotnetNew.Tests/CLI/DotnetNew.cs @@ -87,13 +87,22 @@ public static async Task BuildAsync(string fullPath, string? arguments, Verbosit CreateNoWindow = true, }; + psi.Environment.Add("DOTNET_CLI_UI_LANGUAGE","en"); + var process = new Process(); process.StartInfo = psi; process.Start(); if (process.WaitForExit(30000)) { - loggingScope.ParentScope?.AddResult(new TextResult($"success: {fullArgs}"));; + if (process.ExitCode == 0) + { + loggingScope.ParentScope?.AddResult(new TextResult($"success: {fullArgs}"));; + } + else + { + throw new BuildFailedException(fullArgs, loggingScope.ToFullString(PrintKind.All)); + } } else { @@ -101,14 +110,14 @@ public static async Task BuildAsync(string fullPath, string? arguments, Verbosit throw new BuildFailedException(fullArgs, loggingScope.ToFullString(PrintKind.All)); } - // if (await LoggedDotnetCli.RunDotnetCommandAsync(fullArgs, cancellationToken, [])) - // { - // loggingScope.ParentScope?.AddResult(new TextResult($"success: {fullArgs}")); - // } - // else - // { - // throw new BuildFailedException(fullArgs, loggingScope.ToFullString(PrintKind.All)); - // } + if (await LoggedDotnetCli.RunDotnetCommandAsync(fullArgs, cancellationToken, [])) + { + loggingScope.ParentScope?.AddResult(new TextResult($"success: {fullArgs}")); + } + else + { + throw new BuildFailedException(fullArgs, loggingScope.ToFullString(PrintKind.All)); + } } } diff --git a/tests/Amusoft.DotnetNew.Tests.UnitTests/Tests/DotnetNewTests.cs b/tests/Amusoft.DotnetNew.Tests.UnitTests/Tests/DotnetNewTests.cs index e79cdfd..289c5da 100644 --- a/tests/Amusoft.DotnetNew.Tests.UnitTests/Tests/DotnetNewTests.cs +++ b/tests/Amusoft.DotnetNew.Tests.UnitTests/Tests/DotnetNewTests.cs @@ -42,6 +42,8 @@ private async Task ScaffoldRepo(string projectName, string gitUser, string autho await scaffold.RestoreAsync($"src/{projectName}.sln", null, CancellationToken.None); await scaffold.BuildAsync($"src/{projectName}.sln", null, CancellationToken.None); + var a = loggingScope.ToFullString(PrintKind.All); + await Verifier.Verify(new { log = loggingScope.ToFullString(PrintKind.All),