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); }
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); }
/// <summary> /// Maps the specified from. /// </summary> /// <typeparam name="TFrom">The type of from.</typeparam> /// <typeparam name="TTo">The type of to.</typeparam> /// <param name="from">The object from.</param> /// <returns> /// The mapped object. /// </returns> public static TTo Map <TFrom, TTo>(TFrom from) { return(_MapperInstance.Map <TFrom, TTo>(from)); }