Ejemplo n.º 1
0
        public void ImportAttribute_ResolvedAutomatically()
        {
            var imp = new Importeur();

            IOC.ResolveImports(imp);
            Assert.IsNotNull(imp.importedFnord);
            Assert.IsTrue(imp.importedFnord is FnordImpl);
            Assert.IsNull(imp.notImportedFnord);
        }
Ejemplo n.º 2
0
        public void Compose_Export_und_Import() {
            var importeur = new Importeur();
            Assert.That(importeur.Name, Is.Null);

            var catalog = new AggregateCatalog();
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(Exporteur).Assembly));

            var compositionContainer = new CompositionContainer(catalog);
            compositionContainer.ComposeParts(importeur);
            Assert.That(importeur.Name, Is.EqualTo("Hello world"));
        }