private void SetFixtureToFailed(string methodName, TestFixture testFixture, Exception exception) { testFixture.SetClassName(testFixture.GetType().Name); testFixture.SetMethodName(methodName); testFixture.Failed("An exception occured during " + methodName + "..." + exception.Message); }
private void CallTestSetup(TestFixture testFixture, MethodInfo methodInfo) { try { testFixture.Setup(); } catch (Exception exception) { testFixture.SetClassName(testFixture.GetType().Name); testFixture.SetMethodName(methodInfo.Name); SetFixtureToFailed("Setup", testFixture, exception); } }
private IEnumerable<MethodInfo> GetTestMethods(TestFixture testFixture) { Type t = testFixture.GetType(); List<MethodInfo> _testMethods = new List<MethodInfo>(); foreach (MethodInfo methodInfo in t.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { object[] testMethodAttributes = methodInfo.GetCustomAttributes(typeof(TestMethodAttribute), true); if (testMethodAttributes.Count() > 0) { _testMethods.Add(methodInfo); } } return _testMethods; }
private void CallTestMethod(TestFixture testFixture, MethodInfo methodInfo) { testFixture.SetClassName(testFixture.GetType().Name); testFixture.SetMethodName(methodInfo.Name); methodInfo.Invoke(testFixture, null); }