internal void Run(ITestResultHandler resultHandler, int testClassIndex) {
      this.State = TestState.Running;

      resultHandler.OnTestClassTestStarted(this, testClassIndex);

      object testClassInstance;
      try {
        testClassInstance = Activator.CreateInstance(this.Class);
      }
      catch (Exception e) {
        if (e is TargetInvocationException && e.InnerException != null) {
          e = e.InnerException;
        }

        this.State = TestState.Failed;
        this.TestClassError = e;
        this.ErrorType = TestClassErrorType.ConstructorError;

        resultHandler.OnTestClassError(this, testClassIndex);
        return;
      }

      if (this.ClassSetupMethod != null) {
        var e = TestMethod.InvokeTestMethod(testClassInstance, this.ClassSetupMethod);
        if (e != null) {
          this.State = TestState.Failed;
          this.TestClassError = e;
          this.ErrorType = TestClassErrorType.ClassInitializerError;

          resultHandler.OnTestClassError(this, testClassIndex);
          return;
        }
      }

      int testMethodIndex = 1;
      this.m_stateCount[TestState.Running] = 1;
      foreach (TestMethod testMethod in this.TestMethods) {
        testMethod.Run(testClassInstance, testMethodIndex, resultHandler);

        this.m_stateCount[testMethod.State] = this.m_stateCount[testMethod.State] + 1;
        this.m_stateCount[TestState.NotYetRun] = this.m_stateCount[TestState.NotYetRun] - 1;

        testMethodIndex++;
      }
      this.m_stateCount[TestState.Running] = 0;

      if (this.ClassTeardownMethod != null) {
        var e = TestMethod.InvokeTestMethod(testClassInstance, this.ClassTeardownMethod);
        if (e != null) {
          this.State = TestState.Failed;
          this.TestClassError = e;
          this.ErrorType = TestClassErrorType.ClassCleanupError;

          resultHandler.OnTestClassError(this, testClassIndex);
          return;
        }
      }

      if (GetStateCount(TestState.Failed) != 0) {
        this.State = TestState.Failed;
      }
      else if (GetStateCount(TestState.Inconclusive) != 0) {
        this.State = TestState.Inconclusive;
      }
      else {
        this.State = TestState.Passed;
      }

      resultHandler.OnTestClassTestEnded(this, testClassIndex);
    }