Ejemplo n.º 1
0
        private static NUnitTestFixtureDescriptor CreateFixture(Type type)
        {
            var fixtureDescriptor = new NUnitTestFixtureDescriptor(type);
              foreach (var method in type.GetMethods())
              {
            var attributes = method.GetCustomAttributes(false);

            foreach (var specialMethod in SpecialMethods)
            {
              if (attributes.Any(o => String.Equals(o.GetType().FullName, specialMethod.Value, StringComparison.Ordinal)))
            fixtureDescriptor.AddSpecialMethod(specialMethod.Key, method);
            }

            if (attributes.Any(o => String.Equals(o.GetType().FullName, "NUnit.Framework.TestAttribute", StringComparison.Ordinal)))
            {
              if (!method.IsPublic || method.IsGenericMethod || method.ReturnType != typeof (void) || method.GetParameters().Length != 0)
            continue;

              fixtureDescriptor.AddTest(new NUnitTestDescriptor(fixtureDescriptor, method));
            }
              }
              return fixtureDescriptor;
        }
Ejemplo n.º 2
0
 public NUnitTestDescriptor(NUnitTestFixtureDescriptor fixtureDescriptor, MethodInfo method)
 {
     myFixtureDescriptor = fixtureDescriptor;
       myMethod = method;
 }