コード例 #1
0
        public void ShouldApplyAGivenMapperConfiguration()
        {
            using (var mapper = Mapper.CreateNew())
            {
                mapper.WhenMapping
                .UseConfigurations.From <PfiToPfsMapperConfiguration>();

                PfiToPfsMapperConfiguration.VerifyConfigured(mapper);
            }
        }
コード例 #2
0
        public void ShouldApplyMapperConfigurationsInAGivenTypeAssembly()
        {
            using (var mapper = Mapper.CreateNew())
            {
                mapper.WhenMapping
                .UseServiceProvider(t => null)
                .UseConfigurations.FromAssemblyOf <WhenApplyingMapperConfigurations>();

                PfiToPfsMapperConfiguration.VerifyConfigured(mapper);
                PfsToPfiMapperConfiguration.VerifyConfigured(mapper);
            }
        }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
        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);
            }
        }