SetUpFixture
SetUpFixture extends TestSuite and supports
Setup and TearDown methods.
using NUnit.Framework.Interfaces;
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Internal
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class SetUpFixture : TestSuite, IDisposableFixture
{
public new ITypeInfo TypeInfo => base.TypeInfo;
public SetUpFixture(ITypeInfo type)
: base(type, null)
{
base.Name = GetName(type);
base.OneTimeSetUpMethods = TypeInfo.GetMethodsWithAttribute<OneTimeSetUpAttribute>(true);
base.OneTimeTearDownMethods = TypeInfo.GetMethodsWithAttribute<OneTimeTearDownAttribute>(true);
CheckSetUpTearDownMethods(base.OneTimeSetUpMethods);
CheckSetUpTearDownMethods(base.OneTimeTearDownMethods);
}
private static string GetName(ITypeInfo type)
{
string text = type.Namespace ?? "[default namespace]";
int num = text.LastIndexOf('.');
if (num > 0)
text = text.Substring(num + 1);
return text;
}
public SetUpFixture(SetUpFixture setUpFixture, ITestFilter filter)
: base(setUpFixture, filter)
{
}
public override TestSuite Copy(ITestFilter filter)
{
return new SetUpFixture(this, filter);
}
}
}