/// <summary>
 /// Configures the mapper.
 /// </summary>
 /// <param name="mapperCore">The mapper core.</param>
 public void ConfigureMapper(MapperCore mapperCore)
 {
     // mapperCore.AddConfiguration<DataContainer, object>(new DataContainerToEntityPropertyMappingConfigurator());
     // mapperCore.AddConfiguration<object, DataContainer>(new EntityToDataContainerPropertyMappingConfigurator());
     mapperCore.AddConfiguration<DataContainer, object>(new DataContainerToObjectConfigurator());
     mapperCore.AddConfiguration<object, DataContainer>(new ObjectToDataContainerConfigurator());
 }
Ejemplo n.º 2
0
        public void ShouldMapSavedProductRequestToProduct()
        {
            SaveProductRequest saveProductRequest = new SaveProductRequest()
            {
                Brand       = "Chevrolet",
                Code        = "ut51Gjqi351",
                Description = "Cabeçote chev opala 77",
                ImageUrl    = "https://www.google.com.br/search?q=cabeçote+opala.jpg",
                Name        = "Cabeçote",
                Price       = 700,
                Type        = "Autopeças"
            };
            MapperCore sut = new MapperCore();

            var product = sut.Map <SaveProductRequest, Product>(saveProductRequest);

            Mapper.Reset();

            Assert.True(product.Brand != null &&
                        product.Code != null &&
                        product.Description != null &&
                        product.ImageUrl != null &&
                        product.Name != null &&
                        product.Price != 0 &&
                        product.Type != null);
        }
Ejemplo n.º 3
0
        public void ShouldMapProductToSaveProductResponse()
        {
            Product product = new Product()
            {
                Id = "12345678"
            };
            MapperCore sut = new MapperCore();

            var productSaved = sut.Map <Product, SavedProductResponse>(product);

            Mapper.Reset();

            Assert.Equal(productSaved.Id, product.Id);
        }
Ejemplo n.º 4
0
 /// <summary>
 ///   Initializes static members of the <see cref="LightMapper" /> class.
 /// </summary>
 static LightMapper()
 {
     _MapperInstance = new MapperCore();
 }