TestResult RunAssembly(MachineAssemblyTest assemblyTest, ITestCommand command, TestStep parentTestStep)
        {
            ITestContext assemblyContext = command.StartPrimaryChildStep(parentTestStep);

            AssemblyInfo assemblyInfo = new AssemblyInfo(assemblyTest.Name, assemblyTest.AssemblyFilePath);
            TestOutcome  outcome      = TestOutcome.Passed;

            _listener.OnAssemblyStart(assemblyInfo);
            assemblyTest.AssemblyContexts.Each(context => context.OnAssemblyStart());

            foreach (ITestCommand contextCommand in command.Children)
            {
                MachineContextTest contextTest = contextCommand.Test as MachineContextTest;
                if (contextTest == null)
                {
                    continue;
                }

                var contextResult = RunContextTest(assemblyTest, contextTest, contextCommand, assemblyContext.TestStep);
                outcome = outcome.CombineWith(contextResult.Outcome);
                assemblyContext.SetInterimOutcome(outcome);
            }

            assemblyTest.AssemblyContexts.Reverse().Each(context => context.OnAssemblyComplete());
            _listener.OnAssemblyEnd(assemblyInfo);

            return(assemblyContext.FinishStep(outcome, null));
        }
Exemplo n.º 2
0
        private TestResult RunAssembly(ITestCommand command, TestStep rootStep)
        {
            ITestContext assemblyContext = command.StartPrimaryChildStep(rootStep);

            TestOutcome outcome = TestOutcome.Passed;

            foreach (ITestCommand contextCommand in command.Children)
            {
                NSpecContextTest contextTest = contextCommand.Test as NSpecContextTest;
                if (contextTest == null)
                {
                    continue;
                }

                var contextResult = this.RunContext(contextTest, contextCommand, assemblyContext.TestStep);
                outcome = outcome.CombineWith(contextResult.Outcome);
                assemblyContext.SetInterimOutcome(outcome);
            }

            return(assemblyContext.FinishStep(outcome, null));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Sets the step's interim <see cref="Outcome" />.
 /// </summary>
 /// <remarks>
 /// <para>
 /// The interim outcome is used to communicate the anticipated outcome
 /// of the step to later phases of execution.
 /// </para>
 /// <para>
 /// The value set here will be overridden by whatever final outcome the step
 /// returns.  Consequently the actual outcome may still differ from the anticipated outcome
 /// that was set using this method.
 /// </para>
 /// </remarks>
 /// <exception cref="InvalidOperationException">Thrown if attempting to set the outcome while the test is not running.</exception>
 /// <seealso cref="Outcome"/>
 public void SetInterimOutcome(TestOutcome outcome)
 {
     inner.SetInterimOutcome(outcome);
 }