quantum-space-buddies/QSB/Utility/UnitTestDetector.cs

17 lines
389 B
C#
Raw Normal View History

2021-02-12 13:29:01 +00:00
using System;
using System.Linq;
namespace QSB.Utility
{
2021-02-16 12:15:43 +00:00
public static class UnitTestDetector
{
public static readonly bool IsInUnitTest;
2021-02-16 12:45:46 +00:00
2021-02-16 12:15:43 +00:00
static UnitTestDetector()
{
const string testAssemblyName = "Microsoft.VisualStudio.TestPlatform.TestFramework";
2021-02-16 12:15:43 +00:00
IsInUnitTest = AppDomain.CurrentDomain.GetAssemblies()
.Any(a => a.FullName.StartsWith(testAssemblyName));
}
}
2021-02-13 09:07:39 +00:00
}