private void RunContextTest(MachineContextTest description, ITestCommand testCommand, ITestStep parentTestStep)
    {
      ITestContext testContext = testCommand.StartPrimaryChildStep(parentTestStep);

      testContext.LifecyclePhase = LifecyclePhases.SetUp;
      description.SetupContext();
      bool passed = true;

      foreach (ITestCommand child in testCommand.Children)
      {
        MachineSpecificationTest specification = child.Test as MachineSpecificationTest;

        if (specification != null)
        {
          passed &= RunSpecificationTest(specification, child, testContext.TestStep);
        }
      }

      testContext.LifecyclePhase = LifecyclePhases.TearDown;
      description.TeardownContext();

      testContext.FinishStep(passed ? TestOutcome.Passed : TestOutcome.Failed, null);
    }
    MachineContextTest GetContextTest(Context context)
    {
      MachineContextTest contextTest = new MachineContextTest(context);

      context.Specifications
        .Select( spec => GetSpecificationTest( context, spec))
        .Each( test => contextTest.AddChild(test));

      if (context.Subject != null)
        contextTest.Metadata.Add(MetadataKeys.Category, context.Subject.FullConcern);

      if (context.Tags != null && context.Tags.Any())
        contextTest.Metadata.Add(SpecificationMetadataKeys.Tags, context.Tags.Select(t => t.Name).ToList());

      if (context.IsIgnored)
        contextTest.Metadata.Add(MetadataKeys.IgnoreReason, "The context has the IgnoreAttribute");

      AddXmlComment(contextTest, Reflector.Wrap(context.Type));
      return contextTest;
    }
    TestResult RunContextTest(MachineAssemblyTest assemblyTest, MachineContextTest contextTest, ITestCommand command, TestStep parentTestStep)
    {
      ITestContext testContext = command.StartPrimaryChildStep(parentTestStep);

      GallioRunListener listener = new GallioRunListener(_listener, _progressMonitor, testContext, command.Children);

      IContextRunner runner = ContextRunnerFactory.GetContextRunnerFor(contextTest.Context);
      runner.Run(contextTest.Context, listener, _options, assemblyTest.GlobalCleanup, assemblyTest.SpecificationSupplements);

      return testContext.FinishStep(listener.Outcome, null);
    }