<PackageReference Include="NUnit" Version="4.4.0-beta.2.1" />

OSPlatformConverter

static class OSPlatformConverter
Converts .NET6+ OSPlatformAttribute to NetPlatformAttribute which can be applied to tests.
using NUnit.Framework.Interfaces; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; namespace NUnit.Framework { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] internal static class OSPlatformConverter { public static IEnumerable<IApplyToTest> RetrieveAndConvert(this ICustomAttributeProvider provider) { IApplyToTest[] attributes = provider.GetAttributes<IApplyToTest>(true); OSPlatformAttribute[] attributes2 = provider.GetAttributes<OSPlatformAttribute>(true); return Convert(attributes2, attributes); } [IteratorStateMachine(typeof(<Convert>d__1))] internal static IEnumerable<IApplyToTest> Convert(OSPlatformAttribute[] osPlatformAttributes, IApplyToTest[] applyToTestAttributes) { <Convert>d__1 <Convert>d__ = new <Convert>d__1(-2); <Convert>d__.<>3__osPlatformAttributes = osPlatformAttributes; <Convert>d__.<>3__applyToTestAttributes = applyToTestAttributes; return <Convert>d__; } } }