public void PartCreator_ImportRequiredMetadata_MissingMetadataShouldCauseImportToBeExcluded() { var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Foo)); var part = new PartCreatorImportRequiredMetadata(); container.SatisfyImportsOnce(part); Assert.AreEqual(1, part.FooCreator.Length, "Should contain the one Foo"); Assert.AreEqual(0, part.FooCreatorWithMetadata.Length, "Should NOT contain Foo because it is missing the required Id metadata property"); }
public void PartCreator_ImportShouldNotImportSharedPart() { var container = ContainerFactory.CreateWithAttributedCatalog(typeof(SharedFoo)); var foo = container.GetExportedValue <Foo>(); Assert.IsNotNull(foo, "Ensure that a Foo actually exists in the container"); var part = new PartCreatorImportRequiredMetadata(); container.SatisfyImportsOnce(part); Assert.AreEqual(0, part.FooCreator.Length, "Should not contain the SharedFoo because the PartCreator should only wrap Any/NonShared parts"); }