public virtual List<ITestClass> GetTestClasses(IAssembly assembly, TestClassInstanceDictionary instances) { List<ITestClass> classes = new List<ITestClass>(assembly.GetTestClasses()); FilterTestClasses(classes, instances); SortTestClasses(classes); return classes; }
/// <summary> /// Gets the unit test provider for an assembly. The framework only /// currently supports a single provider per test assembly, so if more /// than one registered provider can handle the assembly, at runtime an /// InvalidOperationException is thrown. /// </summary> /// <param name="harness">The test harness making the request.</param> /// <param name="testAssembly">Assembly reflection object.</param> /// <returns>The unit test provider for the test assembly. Throws if /// more than one can process the assembly. Returns null if there is /// not a provider for the assembly.</returns> public static IUnitTestProvider GetAssemblyProvider(UnitTestHarness harness, Assembly testAssembly) { List <IAssembly> assemblies = new List <IAssembly>(); foreach (IUnitTestProvider provider in _providers) { IAssembly ia = provider.GetUnitTestAssembly(harness, testAssembly); ICollection <ITestClass> tests = ia.GetTestClasses(); if (tests.Count > 0) { assemblies.Add(ia); } } if (assemblies.Count > 1) { // TODO: Resource string needed for multiple providers in one // assembly throw new InvalidOperationException(); } foreach (IAssembly a in assemblies) { return(a.Provider); } // Count == 0 return(null); }
public virtual List <ITestClass> GetTestClasses(IAssembly assembly, TestClassInstanceDictionary instances) { List <ITestClass> classes = new List <ITestClass>(assembly.GetTestClasses()); FilterTestClasses(classes, instances); SortTestClasses(classes); return(classes); }