Ejemplo n.º 1
0
        public void FilteredCatalog_ScopeA()
        {
            var cat = GetCatalog();
            var contA = new CompositionContainer(ScopeCatalog(cat, "A"));

            Assert.IsTrue(contA.IsPresent<ScopeAComponent1>());
            Assert.IsTrue(contA.IsPresent<ScopeAComponent2>());
            Assert.IsFalse(contA.IsPresent<ScopeBComponent>());
            Assert.IsFalse(contA.IsPresent<ScopeCComponent>());
        }
Ejemplo n.º 2
0
        public void AddAndRemoveDirectory()
        {
            using (var directory = CreateTemporaryDirectory())
            {
                var cat = new AggregateCatalog();
                var container = new CompositionContainer(cat);

                Assert.IsFalse(container.IsPresent<MyExport>());

                var dir1 = new DirectoryCatalog(directory.DirectoryPath);
                cat.Catalogs.Add(dir1);
                Assert.IsTrue(container.IsPresent<MyExport>());

                cat.Catalogs.Remove(dir1);

                Assert.IsFalse(container.IsPresent<MyExport>());
            }
        }