public void ShouldProvideRegisteredServicesToMapperConfigurationsViaTheStaticApi() { var mappersByName = new Dictionary <string, IMapper>(); TestThenReset(() => { Mapper.WhenMapping .UseServiceProvider(t => mappersByName) .UseConfigurations.From <ServiceDictionaryMapperConfiguration>(); ServiceDictionaryMapperConfiguration .VerifyConfigured(mappersByName) .ShouldBeTrue(); }); }
public void ShouldApplyMapperConfigurationsFromCurrentAppDomain() { using (var mapper = Mapper.CreateNew()) { var mappersByName = new Dictionary <string, IMapper>(); mapper.WhenMapping .UseServiceProvider(new SingletonServiceProvider(mappersByName)) .UseConfigurations.FromCurrentAppDomain(); PfiToPfsMapperConfiguration.VerifyConfigured(mapper); PfsToPfiMapperConfiguration.VerifyConfigured(mapper); ServiceDictionaryMapperConfiguration .VerifyConfigured(mappersByName) .ShouldBeTrue(); } }
public void ShouldProvideRegisteredServicesToMapperConfigurations() { TestThenReset(() => { using (var mapper = Mapper.CreateNew()) { var mappersByName = new Dictionary <string, IMapper>(); mapper.WhenMapping .UseServiceProvider(t => mappersByName) .UseConfigurations.FromAssemblyOf <AnimalBase>(); ServiceDictionaryMapperConfiguration .VerifyConfigured(mappersByName) .ShouldBeTrue(); } }); }
public void ShouldApplyMapperConfigurationsInGivenAssembliesViaTheStaticApi() { TestThenReset(() => { var mappersByName = new Dictionary <string, IMapper>(); var serviceProvider = new UnitTestsMapperConfigurations.SingletonServiceProvider(mappersByName); Mapper.WhenMapping .UseServiceProvider(serviceProvider) .UseConfigurations .FromAssemblyOf <UnitTestsMapperConfigurations>() .FromAssemblyOf <AnimalBase>(); UnitTestsMapperConfigurations.PfiToPfsMapperConfiguration.VerifyConfigured(Mapper.Default); UnitTestsMapperConfigurations.PfsToPfiMapperConfiguration.VerifyConfigured(Mapper.Default); ServiceDictionaryMapperConfiguration .VerifyConfigured(mappersByName) .ShouldBeTrue(); }); }