コード例 #1
0
        private ITypeDiscoveryService CreateServiceWithAssemblyFinder(IRootAssemblyFinder customRootAssemblyFinder)
        {
            var filteringAssemblyLoader = CreateApplicationAssemblyLoader();
            var assemblyFinder          = new CachingAssemblyFinderDecorator(new AssemblyFinder(customRootAssemblyFinder, filteringAssemblyLoader));

            return(new AssemblyFinderTypeDiscoveryService(assemblyFinder));
        }
コード例 #2
0
        /// <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;
        }
コード例 #3
0
        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 }));
        }
コード例 #4
0
        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 }));
        }
コード例 #5
0
        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 }));
        }