diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 932b9c21..3f64877d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: dotnet-version: '8.0.x' - name: Build & test (Release) - run: dotnet test src -c Release + run: dotnet test src -c Release --logger "console;verbosity=normal" - name: Should Deploy? if: github.event_name == 'push' diff --git a/src/UnityNuGet.Tests/NativeTests.cs b/src/UnityNuGet.Tests/NativeTests.cs index 60419540..6718fc0b 100644 --- a/src/UnityNuGet.Tests/NativeTests.cs +++ b/src/UnityNuGet.Tests/NativeTests.cs @@ -26,7 +26,7 @@ public async Task TestBuild() new() { Name = "netstandard2.1", DefineConstraints = ["UNITY_2021_2_OR_NEWER"] }, new() { Name = "netstandard2.0", DefineConstraints = ["!UNITY_2021_2_OR_NEWER"] }, ], - new NuGetConsoleLogger()) + new NuGetConsoleTestLogger()) { Filter = "rhino3dm", OnError = message => diff --git a/src/UnityNuGet.Tests/NuGetConsoleTestLogger.cs b/src/UnityNuGet.Tests/NuGetConsoleTestLogger.cs new file mode 100644 index 00000000..f5cf3c4a --- /dev/null +++ b/src/UnityNuGet.Tests/NuGetConsoleTestLogger.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using NuGet.Common; +using NUnit.Framework; + +namespace UnityNuGet.Tests +{ + public class NuGetConsoleTestLogger : LoggerBase + { + public override void Log(ILogMessage message) + { + if (message.Level == LogLevel.Error) + { + TestContext.Error.WriteLine(message); + } + else + { + TestContext.Progress.WriteLine(message); + } + } + + public override Task LogAsync(ILogMessage message) + { + Log(message); + return Task.CompletedTask; + } + } +} diff --git a/src/UnityNuGet.Tests/RegistryCacheTests.cs b/src/UnityNuGet.Tests/RegistryCacheTests.cs index e13c464f..212aea31 100644 --- a/src/UnityNuGet.Tests/RegistryCacheTests.cs +++ b/src/UnityNuGet.Tests/RegistryCacheTests.cs @@ -23,7 +23,7 @@ public async Task TestBuild() new() { Name = "netstandard2.1", DefineConstraints = ["UNITY_2021_2_OR_NEWER"] }, new() { Name = "netstandard2.0", DefineConstraints = ["!UNITY_2021_2_OR_NEWER"] }, ], - new NuGetConsoleLogger()) + new NuGetConsoleTestLogger()) { OnError = message => { diff --git a/src/UnityNuGet.Tests/RegistryTests.cs b/src/UnityNuGet.Tests/RegistryTests.cs index 0816bd88..643034ea 100644 --- a/src/UnityNuGet.Tests/RegistryTests.cs +++ b/src/UnityNuGet.Tests/RegistryTests.cs @@ -5,7 +5,6 @@ using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; -using NuGet.Common; using NuGet.Configuration; using NuGet.PackageManagement; using NuGet.Packaging.Core; @@ -40,7 +39,7 @@ public void Ensure_That_Packages_Already_Included_In_Net_Standard_Are_not_Includ [Test] public async Task CanParse_PackageWithRuntimes() { - var logger = NullLogger.Instance; + var logger = new NuGetConsoleTestLogger(); var cancellationToken = CancellationToken.None; var cache = new SourceCacheContext(); @@ -98,7 +97,7 @@ public async Task Ensure_Min_Version_Is_Correct_Ignoring_Analyzers_And_Native_Li { var registry = Registry.GetInstance(); - var logger = NullLogger.Instance; + var logger = new NuGetConsoleTestLogger(); var cancellationToken = CancellationToken.None; var cache = new SourceCacheContext(); @@ -196,7 +195,7 @@ public async Task Ensure_Do_Not_Exceed_The_Maximum_Number_Of_Allowed_Versions() var registry = Registry.GetInstance(); - var logger = NullLogger.Instance; + var logger = new NuGetConsoleTestLogger(); var cancellationToken = CancellationToken.None; var cache = new SourceCacheContext();