public void MultipleInstantiationOfStaticCatalogItem() { var container = ContainerFactory.CreateWithDefaultAttributedCatalog(); var unnamedVI = container.GetExport <StaticExport, object>(); StaticExport first = unnamedVI.Value; StaticExport second = unnamedVI.Value; Assert.IsNotNull(first, "Should have created an instance"); Assert.IsNotNull(second, "Should have created a second instance"); Assert.IsTrue(object.ReferenceEquals(first, second), "Instances should be the same"); var exports = container.GetExports <StaticExport, object>(); Assert.AreEqual(1, exports.Count(), "There should still only be one exported value"); }
[ActiveIssue("https://github.com/dotnet/corefx/issues/25498", TestPlatforms.AnyUnix)] // System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. public void MultipleInstantiationOfStaticCatalogItem() { var container = ContainerFactory.CreateWithDefaultAttributedCatalog(); var unnamedVI = container.GetExport <StaticExport, object>(); StaticExport first = unnamedVI.Value; StaticExport second = unnamedVI.Value; Assert.NotNull(first); Assert.NotNull(second); Assert.True(object.ReferenceEquals(first, second), "Instances should be the same"); var exports = container.GetExports <StaticExport, object>(); Assert.Equal(1, exports.Count()); }