public void ShouldApplyAGivenMapperConfiguration() { using (var mapper = Mapper.CreateNew()) { mapper.WhenMapping .UseConfigurations.From <PfiToPfsMapperConfiguration>(); PfiToPfsMapperConfiguration.VerifyConfigured(mapper); } }
public void ShouldApplyMapperConfigurationsInAGivenTypeAssembly() { using (var mapper = Mapper.CreateNew()) { mapper.WhenMapping .UseServiceProvider(t => null) .UseConfigurations.FromAssemblyOf <WhenApplyingMapperConfigurations>(); PfiToPfsMapperConfiguration.VerifyConfigured(mapper); PfsToPfiMapperConfiguration.VerifyConfigured(mapper); } }
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 ShouldFilterMapperConfigurationsFromGivenAssemblies() { using (var mapper = Mapper.CreateNew()) { mapper.WhenMapping .UseServiceProvider(t => null) .UseConfigurations.From( new[] { typeof(PfiToPfsMapperConfiguration).GetAssembly(), typeof(ServiceDictionaryMapperConfiguration).GetAssembly() }, assembly => !assembly.FullName.Contains(nameof(MoreTestClasses))); PfiToPfsMapperConfiguration.VerifyConfigured(mapper); PfsToPfiMapperConfiguration.VerifyConfigured(mapper); } }