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

FixtureLifeCycleAttribute

Specify the life cycle of a Fixture
using NUnit.Framework.Interfaces; using NUnit.Framework.Internal; using System; using System.Runtime.CompilerServices; namespace NUnit.Framework { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public sealed class FixtureLifeCycleAttribute : NUnitAttribute, IApplyToTest { public LifeCycle LifeCycle { get; } public FixtureLifeCycleAttribute(LifeCycle lifeCycle) { LifeCycle = lifeCycle; } [System.Runtime.CompilerServices.NullableContext(1)] public void ApplyToTest(Test test) { TestFixture testFixture = test as TestFixture; if (testFixture != null) testFixture.LifeCycle = LifeCycle; } } }