quantum-space-buddies/QSB/Utility/UnitTestDetector.cs
2021-02-16 12:45:46 +00:00

17 lines
392 B
C#

using System;
using System.Linq;
namespace QSB.Utility
{
public static class UnitTestDetector
{
public static bool IsInUnitTest { get; private set; }
static UnitTestDetector()
{
var testAssemblyName = "Microsoft.VisualStudio.TestPlatform.TestFramework";
IsInUnitTest = AppDomain.CurrentDomain.GetAssemblies()
.Any(a => a.FullName.StartsWith(testAssemblyName));
}
}
}