コード例 #1
0
        public void FindAssemblies_Exclude()
        {
            var specification1 = new FilePatternSpecification("*.1", FilePatternSpecificationKind.IncludeFollowReferences);
            var specification2 = new FilePatternSpecification("*.2", FilePatternSpecificationKind.Exclude);

            StubSearchService("*.1", "1.dll", "2.dll"); // included
            StubSearchService("*.2", "2.dll", "3.dll"); // excluded

            var finder = CreateRootAssemblyFinder(specification1, specification2);

            finder.FindRootAssemblies().ForceEnumeration();

            _loaderMock.AssertWasCalled(mock => mock.TryLoadAssembly("1.dll"));
            _loaderMock.AssertWasNotCalled(mock => mock.TryLoadAssembly("2.dll"));
            _loaderMock.AssertWasNotCalled(mock => mock.TryLoadAssembly("3.dll"));
        }
コード例 #2
0
        public void FindAssemblies()
        {
            var specification1 = new FilePatternSpecification("*.dll", FilePatternSpecificationKind.IncludeFollowReferences);
            var specification2 = new FilePatternSpecification("*.exe", FilePatternSpecificationKind.IncludeFollowReferences);

            StubSearchService("*.dll", "1.dll", "2.dll");
            StubSearchService("*.exe", "1.exe");

            _loaderMock.Expect(mock => mock.TryLoadAssembly("1.dll")).Return(_assembly1);
            _loaderMock.Expect(mock => mock.TryLoadAssembly("2.dll")).Return(_assembly2);
            _loaderMock.Expect(mock => mock.TryLoadAssembly("1.exe")).Return(_assembly3);
            _loaderMock.Replay();

            var finder = CreateRootAssemblyFinder(specification1, specification2);

            var rootAssemblies = finder.FindRootAssemblies().Select(ra => ra.Assembly).ToArray();

            _loaderMock.VerifyAllExpectations();
            Assert.That(rootAssemblies, Is.EquivalentTo(new[] { _assembly1, _assembly2, _assembly3 }));
        }
コード例 #3
0
        public void FindAssemblies_FollowReferences()
        {
            var specification1 = new FilePatternSpecification("*.dll", FilePatternSpecificationKind.IncludeFollowReferences);
            var specification2 = new FilePatternSpecification("*.exe", FilePatternSpecificationKind.IncludeNoFollow);

            StubSearchService("*.dll", "1.dll");
            StubSearchService("*.exe", "1.exe");

            _loaderMock.Expect(mock => mock.TryLoadAssembly("1.dll")).Return(_assembly1);
            _loaderMock.Expect(mock => mock.TryLoadAssembly("1.exe")).Return(_assembly2);
            _loaderMock.Replay();

            var finder = CreateRootAssemblyFinder(specification1, specification2);

            var rootAssemblies = finder.FindRootAssemblies().ToDictionary(ra => ra.Assembly);

            _loaderMock.VerifyAllExpectations();
            Assert.That(rootAssemblies[_assembly1].FollowReferences, Is.True);
            Assert.That(rootAssemblies[_assembly2].FollowReferences, Is.False);
        }