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

ThreadUtility

public static class ThreadUtility
ThreadUtility provides a set of static methods convenient for working with threads.
using System; using System.Runtime.CompilerServices; using System.Security.Principal; using System.Threading; namespace NUnit.Framework.Internal { [NullableContext(2)] [Nullable(0)] public static class ThreadUtility { internal static void BlockingDelay(int milliseconds) { Thread.Sleep(milliseconds); } public static IPrincipal GetCurrentThreadPrincipal() { try { return Thread.CurrentPrincipal; } catch (PlatformNotSupportedException) { return null; } } public static void SetCurrentThreadPrincipal(IPrincipal principal) { try { Thread.CurrentPrincipal = principal; } catch (PlatformNotSupportedException) when (principal == null) { } } } }