private ITypeDiscoveryService CreateServiceWithAssemblyFinder(IRootAssemblyFinder customRootAssemblyFinder) { var filteringAssemblyLoader = CreateApplicationAssemblyLoader(); var assemblyFinder = new CachingAssemblyFinderDecorator(new AssemblyFinder(customRootAssemblyFinder, filteringAssemblyLoader)); return(new AssemblyFinderTypeDiscoveryService(assemblyFinder)); }
/// <summary> /// Initializes a new instance of the <see cref="AssemblyFinder"/> class. /// </summary> /// <param name="rootAssemblyFinder">The <see cref="IRootAssemblyFinder"/> to use for finding the root assemblies.</param> /// <param name="assemblyLoader">The <see cref="IAssemblyLoader"/> to use for loading the assemblies found.</param> public AssemblyFinder(IRootAssemblyFinder rootAssemblyFinder, IAssemblyLoader assemblyLoader) { ArgumentUtility.CheckNotNull("rootAssemblyFinder", rootAssemblyFinder); ArgumentUtility.CheckNotNull("assemblyLoader", assemblyLoader); _rootAssemblyFinder = rootAssemblyFinder; _assemblyLoader = assemblyLoader; }
public void FindRootAssemblies_InnerFinder() { IRootAssemblyFinder innerFinderStub = CreateInnerFinderStub(_root1, _root2); var finder = new CompositeRootAssemblyFinder(new[] { innerFinderStub }); var rootAssemblies = finder.FindRootAssemblies(); Assert.That(rootAssemblies, Is.EquivalentTo(new[] { _root1, _root2 })); }
public void FindRootAssemblies_MultipleInnerFinders() { IRootAssemblyFinder innerFinderStub1 = CreateInnerFinderStub(_root1, _root2); IRootAssemblyFinder innerFinderStub2 = CreateInnerFinderStub(_root3); var finder = new CompositeRootAssemblyFinder(new[] { innerFinderStub1, innerFinderStub2 }); var rootAssemblies = finder.FindRootAssemblies(); Assert.That(rootAssemblies, Is.EquivalentTo(new[] { _root1, _root2, _root3 })); }
public void FindRootAssemblies_RemovesAreNotDuplicates() { IRootAssemblyFinder innerFinderStub1 = CreateInnerFinderStub(_root1, _root2, _root2); IRootAssemblyFinder innerFinderStub2 = CreateInnerFinderStub(_root3, _root2, _root1); var finder = new CompositeRootAssemblyFinder(new[] { innerFinderStub1, innerFinderStub2 }); var rootAssemblies = finder.FindRootAssemblies().ToArray(); Assert.That(rootAssemblies.Length, Is.EqualTo(6)); Assert.That(rootAssemblies.Distinct(), Is.EquivalentTo(new[] { _root1, _root2, _root3 })); }