/// <summary> /// Construct a OneTimeTearDownCommand /// </summary> /// <param name="suite">The test suite to which the command applies</param> /// <param name="setUpTearDown">A SetUpTearDownList for use by the command</param> public OneTimeTearDownCommand(TestSuite suite, SetUpTearDownList setUpTearDown) : base(suite) { if (suite.FixtureType != null) _tearDownMethods = Reflect.GetMethodsWithAttribute(suite.FixtureType, typeof(OneTimeTearDownAttribute), true); _setUpTearDown = setUpTearDown; }
/// <summary> /// Constructs a OneTimeSetUpComand for a suite /// </summary> /// <param name="suite">The suite to which the command applies</param> /// <param name="setUpTearDown">A SetUpTearDownList for use by the command</param> public OneTimeSetUpCommand(TestSuite suite, SetUpTearDownList setUpTearDown) : base(suite) { _suite = suite; _fixtureType = suite.FixtureType; _arguments = suite.Arguments; _setUpTearDown = setUpTearDown; }
/// <summary> /// Initializes a new instance of the <see cref="SetUpTearDownCommand"/> class. /// </summary> /// <param name="innerCommand">The inner command.</param> public SetUpTearDownCommand(TestCommand innerCommand) : base(innerCommand) { if (Test.FixtureType != null) { _methods = new SetUpTearDownList(Test.FixtureType, typeof(SetUpAttribute), typeof(TearDownAttribute)); } }
/// <summary> /// Construct a OneTimeTearDownCommand /// </summary> /// <param name="suite">The test suite to which the command applies</param> /// <param name="setUpTearDown">A SetUpTearDownList for use by the command</param> public OneTimeTearDownCommand(TestSuite suite, SetUpTearDownList setUpTearDown) : base(suite) { if (suite.FixtureType != null) { _tearDownMethods = Reflect.GetMethodsWithAttribute(suite.FixtureType, typeof(OneTimeTearDownAttribute), true); } _setUpTearDown = setUpTearDown; }
/// <summary> /// Constructs a OneTimeSetUpComand for a suite /// </summary> /// <param name="suite">The suite to which the command applies</param> /// <param name="setUpTearDown">A SetUpTearDownList for use by the command</param> public OneTimeSetUpCommand(TestSuite suite, SetUpTearDownList setUpTearDown) : base(suite) { _suite = suite; _fixtureType = suite.FixtureType; _arguments = suite.Arguments; if (_fixtureType != null) _setUpMethods = Reflect.GetMethodsWithAttribute(_fixtureType, typeof(OneTimeSetUpAttribute), true); _setUpTearDown = setUpTearDown; }
/// <summary> /// Constructs a OneTimeSetUpComand for a suite /// </summary> /// <param name="suite">The suite to which the command applies</param> /// <param name="setUpTearDown">A SetUpTearDownList for use by the command</param> public OneTimeSetUpCommand(TestSuite suite, SetUpTearDownList setUpTearDown) : base(suite) { _suite = suite; _fixtureType = suite.FixtureType; _arguments = suite.Arguments; if (_fixtureType != null) { _setUpMethods = Reflect.GetMethodsWithAttribute(_fixtureType, typeof(OneTimeSetUpAttribute), true); } _setUpTearDown = setUpTearDown; }
/// <summary> /// Construct a CompositeWorkItem for executing a test suite /// using a filter to select child tests. /// </summary> /// <param name="suite">The TestSuite to be executed</param> /// <param name="context">The execution context to be used</param> /// <param name="childFilter">A filter used to select child tests</param> public CompositeWorkItem(TestSuite suite, TestExecutionContext context, ITestFilter childFilter) : base(suite, context) { _suite = suite; SetUpTearDownList setUpTearDown = null; if (suite.FixtureType != null) setUpTearDown = new SetUpTearDownList( suite.FixtureType, typeof(OneTimeSetUpAttribute), typeof(OneTimeTearDownAttribute)); _setupCommand = MakeSetUpCommand(suite, setUpTearDown); _teardownCommand = MakeTearDownCommand(suite, setUpTearDown); _childFilter = childFilter; }
/// <summary> /// Gets the command to be executed after all of the /// child tests are run. /// </summary> /// <returns>A TestCommand</returns> private static TestCommand MakeTearDownCommand(TestSuite suite, SetUpTearDownList setUpTearDown) { TestCommand command = new OneTimeTearDownCommand(suite, setUpTearDown); if (suite.TestType == "Theory") command = new TheoryResultCommand(command); return command; }
/// <summary> /// Gets the command to be executed before any of /// the child tests are run. /// </summary> /// <returns>A TestCommand</returns> private static TestCommand MakeSetUpCommand(TestSuite suite, SetUpTearDownList setUpTearDown) { if (suite.RunState != RunState.Runnable && suite.RunState != RunState.Explicit) return new SkipCommand(suite); TestCommand command = new OneTimeSetUpCommand(suite, setUpTearDown); if (suite.FixtureType != null) { IApplyToContext[] changes = (IApplyToContext[])suite.FixtureType.GetCustomAttributes(typeof(IApplyToContext), true); if (changes.Length > 0) command = new ApplyChangesToContextCommand(command, changes); } return command; }
/// <summary> /// Initializes a new instance of the <see cref="SetUpTearDownCommand"/> class. /// </summary> /// <param name="innerCommand">The inner command.</param> public SetUpTearDownCommand(TestCommand innerCommand) : base(innerCommand) { if (Test.FixtureType != null) _methods = new SetUpTearDownList(Test.FixtureType, typeof(SetUpAttribute), typeof(TearDownAttribute)); }
/// <summary> /// Construct a OneTimeTearDownCommand /// </summary> /// <param name="suite">The test suite to which the command applies</param> /// <param name="setUpTearDown">A SetUpTearDownList for use by the command</param> public OneTimeTearDownCommand(TestSuite suite, SetUpTearDownList setUpTearDown) : base(suite) { _setUpTearDown = setUpTearDown; }