public TestFixtureClass(string name, System.Type type, object[] parameters) : base(name) { if (type.BaseType == null || type.BaseType.GetConstructor(new System.Type[0]) == null) { baseClass = null; } else { baseClass = new TestFixtureClass(name, type.BaseType, null); } this.parameters = parameters; fullName = type.FullName; HasExplicitAttribute = Reflection.HasAttribute(type, typeof(NUnit.Framework.ExplicitAttribute), false); var ignoreAttribute = Reflection.GetAttribute(type, typeof(NUnit.Framework.IgnoreAttribute), false); HasIgnoreAttribute = ignoreAttribute != null; if (HasIgnoreAttribute) { IgnoreMessage = Reflection.GetProperty(ignoreAttribute, "Reason") as string; } Tests = new System.Collections.Generic.List <Test>(); Categories = CategoryUtils.GetCategories(type); ctorInfo = type.GetConstructor(MethodHelper.GetArgumentTypes(parameters)); if (ctorInfo == null) { throw new System.Exception("No default constructor"); } var methods = type.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly); System.Array.Sort(methods, CompareMethodInfoByName); foreach (var methodInfo in methods) { var hasTestAttribute = Reflection.HasAttribute(methodInfo, typeof(NUnit.Framework.TestAttribute), false); var hasTestCaseAttribute = Reflection.HasAttribute(methodInfo, typeof(NUnit.Framework.TestCaseAttribute), false); var hasTestCaseSourceAttribute = Reflection.HasAttribute(methodInfo, typeof(NUnit.Framework.TestCaseSourceAttribute), false); var hasTestFixtureSetUpAttribute = Reflection.HasAttribute(methodInfo, typeof(NUnit.Framework.TestFixtureSetUpAttribute), false) || Reflection.HasAttribute(methodInfo, typeof(NUnit.Framework.OneTimeSetUpAttribute), false); var hasSetUpAttribute = Reflection.HasAttribute(methodInfo, typeof(NUnit.Framework.SetUpAttribute), false); var hasTearDownAttribute = Reflection.HasAttribute(methodInfo, typeof(NUnit.Framework.TearDownAttribute), false); var hasTestFixtureTearDownAttribute = Reflection.HasAttribute(methodInfo, typeof(NUnit.Framework.TestFixtureTearDownAttribute), false) || Reflection.HasAttribute(methodInfo, typeof(NUnit.Framework.OneTimeTearDownAttribute), false); var hasNUnitAttribute = hasTestAttribute || hasTestFixtureSetUpAttribute || hasSetUpAttribute || hasTearDownAttribute || hasTestFixtureTearDownAttribute; if (hasTestAttribute || hasTestCaseAttribute || hasTestCaseSourceAttribute || !hasNUnitAttribute && methodInfo.Name.Substring(0, 4).ToLower() == "test" && methodInfo.GetParameters().Length == 0) { Tests.Add(new Test(methodInfo)); } if (hasTestFixtureSetUpAttribute) { testFixtureSetUp.Add(methodInfo); } if (hasSetUpAttribute) { setUp.Add(methodInfo); } if (hasTearDownAttribute) { tearDown.Add(methodInfo); } if (hasTestFixtureTearDownAttribute) { testFixtureTearDown.Add(methodInfo); } } }