<PackageReference Include="NUnit" Version="4.3.1" />

PlatformAttribute

Marks an assembly, test fixture or test method as applying to a specific platform.
using NUnit.Framework.Interfaces; using NUnit.Framework.Internal; using System; using System.Runtime.CompilerServices; namespace NUnit.Framework { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = false)] public class PlatformAttribute : IncludeExcludeAttribute, IApplyToTest { [System.Runtime.CompilerServices.Nullable(1)] private readonly PlatformHelper _platformHelper = new PlatformHelper(); public PlatformAttribute() { } [System.Runtime.CompilerServices.NullableContext(2)] public PlatformAttribute(string platforms) : base(platforms) { } [System.Runtime.CompilerServices.NullableContext(1)] public void ApplyToTest(Test test) { if (test.RunState != 0 && test.RunState != RunState.Ignored) { bool flag = false; try { flag = _platformHelper.IsPlatformSupported(this); } catch (InvalidPlatformException ex) { test.RunState = RunState.NotRunnable; test.Properties.Add("_SKIPREASON", ex.Message); return; } if (!flag) { test.RunState = RunState.Skipped; test.Properties.Add("_SKIPREASON", _platformHelper.Reason); } } } } }