Exemplo n.º 1
0
 /// <summary>
 /// Dry run all configured type maps and throw <see cref="AutoMapperConfigurationException"/> for each problem.
 /// </summary>
 public static void Assert(IConfigurationProvider cfg, string profileName = null)
 {
     WithExceptionHelper(() =>
     {
         if (profileName == null)
         {
             cfg.AssertConfigurationIsValid();
         }
         else
         {
             cfg.AssertConfigurationIsValid(profileName);
         }
     });
 }
        public void Execute()
        {
            foreach (IMapCreator mapCreator in _mapCreators)
            {
                mapCreator.CreateMap(_profileExpression);
            }

            _configurationProvider.AssertConfigurationIsValid();
        }
        public void HaveValidConfiguration()
        {
            // Arrange

            // Act
            _configuration.AssertConfigurationIsValid();

            // Assert
        }
Exemplo n.º 4
0
        public void Configure(IApplicationBuilder app, IConfigurationProvider mapper)
        {
            mapper.AssertConfigurationIsValid();

            app.UseLykkeConfiguration(options =>
            {
                options.SwaggerOptions = _swaggerOptions;
            });
        }
Exemplo n.º 5
0
        public MapperFactory(IEnumerable <MappingProfileBase> mappingProfiles)
        {
            _mapperConfiguration = new MapperConfiguration(configuration =>
            {
                foreach (var profile in mappingProfiles)
                {
                    configuration.AddProfile(profile);
                }
            });

            _mapperConfiguration.CompileMappings();
            _mapperConfiguration.AssertConfigurationIsValid();
        }
Exemplo n.º 6
0
        public virtual A BuildResponse <R, A>(R response, IConfigurationProvider mapperConfiguration) where R : class, new() where A : class, new()
        {
            A answer = new A();

            try
            {
                var executionPlan = mapperConfiguration.BuildExecutionPlan(typeof(R), typeof(A));
                mapperConfiguration.AssertConfigurationIsValid();
                //Mapper mapper = new Mapper(ProcessShipmentConfiguration);
                var iMapper = mapperConfiguration.CreateMapper();
                answer = iMapper.Map <A>(response);
            }
            catch (Exception ex) { }
            return(answer);
        }
Exemplo n.º 7
0
        public virtual U BuildRequest <R, U>(R request, IConfigurationProvider mapperConfiguration) where R : class, new() where U : class, new()
        {
            U upsRequest = new U();

            try
            {
                var executionPlan = mapperConfiguration.BuildExecutionPlan(typeof(R), typeof(U));
                mapperConfiguration.AssertConfigurationIsValid();
                //Mapper mapper = new Mapper(ProcessShipmentConfiguration);
                var iMapper = mapperConfiguration.CreateMapper();
                upsRequest = iMapper.Map <U>(request);
            }
            catch (Exception ex) { }
            return(upsRequest);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Dry run all configured type maps and throw <see cref="AutoMapperConfigurationException"/> for each problem.
 /// </summary>
 public static void Assert(IConfigurationProvider cfg, TypeMap typeMap)
 {
     WithExceptionHelper(() => cfg.AssertConfigurationIsValid(typeMap));
 }
Exemplo n.º 9
0
 public void Mapping_Always_ShouldHaveValidConfiguration()
 {
     configuration.AssertConfigurationIsValid();
 }
 public void AssertConfigurationIsValid(IConfigurationProvider mapperConfiguration)
 {
     mapperConfiguration.AssertConfigurationIsValid();
 }
 public IMapper InitializeMapper()
 {
     _autoMapperConfiguration.AssertConfigurationIsValid();
     return(_autoMapperConfiguration.CreateMapper());
 }
Exemplo n.º 12
0
 public void ValidConfiguration()
 {
     _configuration.AssertConfigurationIsValid();
 }
 public void DevraitAvoirUneConfigurationValide()
 {
     _configuration.AssertConfigurationIsValid();
 }
Exemplo n.º 14
0
 public void Should_Have_Valid_Configuration()
 {
     _configurationProvider.AssertConfigurationIsValid();
 }
Exemplo n.º 15
0
        public void AssertConfigurationIsValid()
        {
            IConfigurationProvider provider = GetConfigurationProvider();

            provider.AssertConfigurationIsValid();
        }
Exemplo n.º 16
0
 public void Mapping_Configuration_Should_Be_Valid_Test() => _configuration.AssertConfigurationIsValid();         //to make sure we have covered all mappings
Exemplo n.º 17
0
 public void ShouldHaveValidConfiguration()
 {
     _configuration.AssertConfigurationIsValid <MappingProfile>();
 }
Exemplo n.º 18
0
 /// <summary>
 /// Dry run all configured type maps and throw <see cref="AutoMapperConfigurationException"/> for each problem.
 /// </summary>
 public static void Assert <TProfile>(IConfigurationProvider cfg) where TProfile : Profile, new()
 {
     WithExceptionHelper(() => cfg.AssertConfigurationIsValid <TProfile>());
 }
Exemplo n.º 19
0
 private static void AssertConfigurationInDebug(IConfigurationProvider config)
 {
     config.AssertConfigurationIsValid();
 }
Exemplo n.º 20
0
 public void ShouldHaveValidConfiguration()
 {
     _configuration.AssertConfigurationIsValid();
 }
Exemplo n.º 21
0
 public void ValidateAllMappingProfiles()
 {
     _configuration.AssertConfigurationIsValid();
 }