Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
 private void CallTestMethod(TestFixture testFixture, MethodInfo methodInfo)
 {
     testFixture.SetClassName(testFixture.GetType().Name);
     testFixture.SetMethodName(methodInfo.Name);
     methodInfo.Invoke(testFixture, null);
 }