public void ConvertToDto_ProductCategoryNotNull_ReturnSameName() { ProductCategory category = MockProductCategory(); ProductCategoryDto categoryDto = category.ConvertToDto(5); Assert.Equal(category.Name, categoryDto.Name); }
public void ConvertToDto_ProductCategoryNotNull_ReturnSameSubCategories() { ProductCategory category = MockProductCategory(); ProductCategoryDto categoryDto = category.ConvertToDto(5); Assert.Equal(category.SubCategories, categoryDto.SubCategories); }
public void ConvertToDto_ProductCategoryNotNull_ReturnSameProductCount() { ProductCategory category = MockProductCategory(); ProductCategoryDto categoryDto = category.ConvertToDto(5); Assert.Equal(5, categoryDto.ProductCount); }
public static ProductCategoryViewModel Map(this ProductCategoryDto productCategory) { Mapper.Initialize( m => m.CreateMap <ProductCategoryDto, ProductCategoryViewModel>() .ForMember(s => s.ProductCategoryName, opts => opts.MapFrom(src => src.CategoryName)) .ForMember(s => s.ProductCategoryGuid, opts => opts.MapFrom(src => src.ProductCategoryGuid))); return(Mapper.Map <ProductCategoryViewModel>(productCategory)); }