public void BootstrappingUsingAssemblyParamListShouldContainTypesInParamList()
 {
     var sut = new ContainerBootstrapper();
     sut.Should().NotBeNull();
     var result = sut.Bootstrap(null, typeof(Samples.Business.BusinessDependencyRegistrar).Assembly, typeof(Samples.Data.DataDependencyRegistrar).Assembly);
     result.Should().NotBeNull();
     result.Catalog.Should().NotBeNull();
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Heliar.Composition.Core.Tests.TestApplicationDependencyRegistrar");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Business.BusinessDependencyRegistrar");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Data.DataDependencyRegistrar");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Heliar.Composition.Core.Tests.Foo");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Business.CustomerService");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Data.CustomerRepository");
 }
 public void BootstrappingUsingCatalogAndConventionShouldIncludeTestAndSampleParts()
 {
     // Build pre-wired assembly catalog
     RegistrationBuilder conventions = new RegistrationBuilder();
     conventions.ForTypesDerivedFrom<IApplicationDependencyRegistrar>()
         .SetCreationPolicy(CreationPolicy.Shared)
         .ExportInterfaces()
         .Export();
     var catalog = new AssemblyCatalog(typeof(ContainerBootstrapperTest).Assembly, conventions);
     var sut = new ContainerBootstrapper("Samples*.dll", catalog);
     sut.Should().NotBeNull();
     var result = sut.Bootstrap();
     result.Should().NotBeNull();
     result.Catalog.Should().NotBeNull();
     // Registrars
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Heliar.Composition.Core.Tests.TestApplicationDependencyRegistrar");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Business.BusinessDependencyRegistrar");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Data.DataDependencyRegistrar");
     // Test/Sample types
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Heliar.Composition.Core.Tests.Foo");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Business.CustomerService");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Data.CustomerRepository");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Data.SampleConnectionFactory");
 }
 public void UsingEmptyCtorShouldSetUseAssemblyNamingConventionToFalse()
 {
     var sut = new ContainerBootstrapper();
     sut.Should().NotBeNull();
     sut.UseAssemblyNamingConvention.Should().Be(false);
 }
 public void PassingOnlyCatalogToCtorShouldSetUseAssemblyNamingConventionToFalse()
 {
     var catalog = new AssemblyCatalog(typeof(CatalogBootstrapperTest).Assembly);
     var sut = new ContainerBootstrapper(null, catalog);
     sut.Should().NotBeNull();
     sut.AssemblyNamingConvention.Should().BeNull();
     sut.UseAssemblyNamingConvention.Should().Be(false);
 }
 public void TypesRegisteredInExternalAssemblyShouldBeCreateable()
 {
     var sut = new ContainerBootstrapper();
     sut.Should().NotBeNull();
     var container = sut.Bootstrap();
     container.Should().NotBeNull();
     var client = container.GetExportedValue<HttpClient>();
     client.Should().NotBeNull();
 }
 public void PassingOnlyAConventionToCtorShouldSetUseAssemblyNamingConventionToTrue()
 {
     var sut = new ContainerBootstrapper(assemblyExpression);
     sut.Should().NotBeNull();
     sut.AssemblyNamingConvention.Should().Be(assemblyExpression);
     sut.UseAssemblyNamingConvention.Should().Be(true);
 }
 public void ExpressionPassedToConventionCtorShouldMatchAssemblyNamingConvention()
 {
     var sut = new ContainerBootstrapper(assemblyExpression);
     sut.Should().NotBeNull();
     sut.AssemblyNamingConvention.Should().Be(assemblyExpression);
 }
 public void BootstrappingWithoutApplicationDependencyRegistrarShouldThrowException()
 {
     var sut = new ContainerBootstrapper("Foo*.dll");
     sut.Should().NotBeNull();
     var result = sut.Bootstrap();
 }
 public void BootstrappingUsingOnlyConventionShouldOnlyIncludeTestAssemblyTypes()
 {
     var sut = new ContainerBootstrapper(assemblyExpression);
     sut.Should().NotBeNull();
     var result = sut.Bootstrap();
     result.Should().NotBeNull();
     result.Catalog.Parts.Should().HaveCount(c => c > 0);
     // Registrar types
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Heliar.Composition.Core.Tests.TestApplicationDependencyRegistrar");
     result.Catalog.Parts.Should().NotContain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Business.BusinessDependencyRegistrar");
     result.Catalog.Parts.Should().NotContain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Data.DataDependencyRegistrar");
     // Test POCO type
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Heliar.Composition.Core.Tests.Foo");
 }
 public void BootstrappingUsingOnlyCatalogShouldIncludeTestAndSampleTypes()
 {
     var catalog = new AssemblyCatalog(typeof(CatalogBootstrapperTest).Assembly);
     var sut = new ContainerBootstrapper(null, catalog);
     sut.Should().NotBeNull();
     var result = sut.Bootstrap();
     result.Should().NotBeNull();
     result.Catalog.Should().NotBeNull();
     // Registrars
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Heliar.Composition.Core.Tests.TestApplicationDependencyRegistrar");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Business.BusinessDependencyRegistrar");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Data.DataDependencyRegistrar");
     // Test/Sample types
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Heliar.Composition.Core.Tests.Foo");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Business.CustomerService");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Data.CustomerRepository");
     result.Catalog.Parts.Should().Contain(p => (p as System.ComponentModel.Composition.Primitives.ICompositionElement).DisplayName == "Samples.Data.SampleConnectionFactory");
 }