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