TestExtensions
using NUnit.Framework.Interfaces;
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Internal.Extensions
{
internal static class TestExtensions
{
[System.Runtime.CompilerServices.NullableContext(2)]
public static bool HasLifeCycle(this ITest test, LifeCycle lifeCycle)
{
while (test != null) {
TestFixture testFixture = test as TestFixture;
if (testFixture != null)
return testFixture.LifeCycle == lifeCycle;
test = test.Parent;
}
return lifeCycle != LifeCycle.InstancePerTestCase;
}
}
}