ConstructFixtureCommand
ConstructFixtureCommand constructs the user test object if necessary.
using NUnit.Framework.Interfaces;
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Internal.Commands
{
public class ConstructFixtureCommand : BeforeTestCommand
{
[NullableContext(1)]
public ConstructFixtureCommand(TestCommand innerCommand)
: base(innerCommand)
{
Guard.ArgumentValid(base.Test is TestSuite, "ConstructFixtureCommand must reference a TestSuite", "innerCommand");
BeforeTest = delegate(TestExecutionContext context) {
ITypeInfo typeInfo = base.Test.TypeInfo;
if (typeInfo != null && !typeInfo.IsStaticClass) {
Test test = base.Test;
object obj = test.Fixture;
if (obj == null) {
object obj3 = test.Fixture = typeInfo.Construct(((TestSuite)base.Test).Arguments);
obj = obj3;
}
context.TestObject = obj;
}
};
}
}
}