private TestCommand MakeOneTimeTearDownCommand(List <SetUpTearDownItem> setUpTearDownItems, List <TestActionItem> actions)
        {
            TestCommand command = new EmptyTestCommand(Test);

            // For Theories, follow with TheoryResultCommand to adjust result as needed
            if (Test.TestType == "Theory")
            {
                command = new TheoryResultCommand(command);
            }

            // Create the AfterTestAction commands
            int index = actions.Count;

            while (--index >= 0)
            {
                command = new AfterTestActionCommand(command, actions[index]);
            }

            // Create the OneTimeTearDown commands
            foreach (SetUpTearDownItem item in setUpTearDownItems)
            {
                command = new OneTimeTearDownCommand(command, item);
            }

            // Dispose of fixture if necessary
            if (Test is IDisposableFixture && typeof(IDisposable).IsAssignableFrom(Test.TypeInfo.Type))
            {
                command = new DisposeFixtureCommand(command);
            }

            return(command);
        }
Beispiel #2
0
        /// <summary>
        /// Gets the command to be executed after all of the
        /// child tests are run.
        /// </summary>
        /// <returns>A TestCommand</returns>
        public static TestCommand MakeOneTimeTearDownCommand(TestSuite suite, List<SetUpTearDownItem> setUpTearDownItems, List<TestActionItem> actions)
        {
            // Build the OneTimeTearDown command itself
            TestCommand command = new OneTimeTearDownCommand(suite, setUpTearDownItems, actions);

            // For Theories, follow with TheoryResultCommand to adjust result as needed
            if (suite.TestType == "Theory")
                command = new TheoryResultCommand(command);

            return command;
        }
        /// <summary>
        /// Gets the command to be executed after all the child
        /// tests are run. Overridden in ParameterizedMethodSuite
        /// to set the result to failure if all the child tests
        /// were inconclusive.
        /// </summary>
        /// <returns></returns>
        public override TestCommand GetOneTimeTearDownCommand()
        {
            TestCommand command = base.GetOneTimeTearDownCommand();

            if (_isTheory)
            {
                command = new TheoryResultCommand(command);
            }

            return(command);
        }
Beispiel #4
0
        /// <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);
        }
Beispiel #5
0
        /// <summary>
        /// Gets the command to be executed after all of the
        /// child tests are run.
        /// </summary>
        /// <returns>A TestCommand</returns>
        public static TestCommand MakeOneTimeTearDownCommand(TestSuite suite, List <SetUpTearDownItem> setUpTearDownItems, List <TestActionItem> actions)
        {
            // Build the OneTimeTearDown command itself
            TestCommand command = new OneTimeTearDownCommand(suite, setUpTearDownItems, actions);

            // For Theories, follow with TheoryResultCommand to adjust result as needed
            if (suite.TestType == "Theory")
            {
                command = new TheoryResultCommand(command);
            }

            return(command);
        }