Check if assembly was loaded by NUnit

With this snippet you can check if your test assembly was loaded by the nunit-console (domain name starts with "test-domain-") or by the TeamCity JetBrains.BuildServer.NUnitLauncher (domain name is "NUnit Domain"):

private static bool IsStartedFromNunit()
{
	string currentDomainName = AppDomain.CurrentDomain.FriendlyName;
	return currentDomainName.StartsWith("test-domain-") || currentDomainName == "NUnit Domain";
}