public void Implementation() { var types = new[] { typeof(Implemented) }.AsApplicationParts(); var container = new ContainerConfiguration().WithParts( types.AsEnumerable() ).WithProvider( SingletonExportDescriptorProvider.Default ).CreateContainer(); Assert.Same( Implemented.Default, container.GetExport<ISingleton>() ); Assert.Same( Implemented.Default, container.GetExport<Implemented>() ); }
public void Basic() { var types = new[] { typeof(Singleton) }.AsApplicationParts(); var container = new ContainerConfiguration().WithParts( types.AsEnumerable() ).WithProvider( SingletonExportDescriptorProvider.Default ).CreateContainer(); var export = container.GetExport<Singleton>(); Assert.Same( Singleton.Default, export ); }
public void Many() { var types = new[] { typeof(Implemented), typeof(AnotherImplemented) }.AsApplicationParts(); var container = new ContainerConfiguration().WithParts( types.AsEnumerable() ).WithProvider( SingletonExportDescriptorProvider.Default ).CreateContainer(); var exports = container.GetExports<ISingleton>().Fixed(); Assert.Contains( Implemented.Default, exports ); Assert.Contains( AnotherImplemented.Default, exports ); }