From bf95564ebb67ae474f809623a22647e2305bdfde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Fri, 20 Aug 2021 10:41:27 +0200 Subject: [PATCH] Make tests run on .NET Framework 4.8 Since Spectre.Console targets .NET Standard 2.0 it makes sense to also run tests on .NET Framework (Windows only) This makes two tests fail: `Should_Write_Exception_With_Inner_Exception` and `Should_Write_Exceptions_With_Generic_Type_Parameters_In_Callsite_As_Expected`. Received (inner exception not handled): ``` System.InvalidOperationException: Something threw!System.InvalidOperationException: Throwing! at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn at Spectre.Console.Tests.Data.TestExceptions.ThrowWithInnerException() in /xyz/Exceptions.cs:nn ``` Verified: ``` System.InvalidOperationException: Something threw! System.InvalidOperationException: Throwing! at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn at Spectre.Console.Tests.Data.TestExceptions.ThrowWithInnerException() in /xyz/Exceptions.cs:nn at Spectre.Console.Tests.Data.TestExceptions.ThrowWithInnerException() in /xyz/Exceptions.cs:nn at Spectre.Console.Tests.Unit.ExceptionTests.<>c.b__3_0() in /xyz/ExceptionTests.cs:nn at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn ``` --- .../Spectre.Console.Tests.csproj | 6 +++++- test/Spectre.Console.Tests/VerifyConfiguration.cs | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/test/Spectre.Console.Tests/Spectre.Console.Tests.csproj b/test/Spectre.Console.Tests/Spectre.Console.Tests.csproj index 7b8edd7..a7f7d21 100644 --- a/test/Spectre.Console.Tests/Spectre.Console.Tests.csproj +++ b/test/Spectre.Console.Tests/Spectre.Console.Tests.csproj @@ -1,7 +1,9 @@ - net5.0 + net5.0;net48 + net5.0 + 9.0 @@ -17,10 +19,12 @@ + + diff --git a/test/Spectre.Console.Tests/VerifyConfiguration.cs b/test/Spectre.Console.Tests/VerifyConfiguration.cs index 93c0d03..cda1898 100644 --- a/test/Spectre.Console.Tests/VerifyConfiguration.cs +++ b/test/Spectre.Console.Tests/VerifyConfiguration.cs @@ -12,4 +12,14 @@ namespace Spectre.Console.Tests VerifierSettings.DerivePathInfo(Expectations.Initialize); } } -} \ No newline at end of file +} + +#if !NET5_0_OR_GREATER +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Method, Inherited = false)] + public sealed class ModuleInitializerAttribute : Attribute + { + } +} +#endif