Пример #1
0
        public void ConvertToDto_ProductCategoryNotNull_ReturnSameName()
        {
            ProductCategory category = MockProductCategory();

            ProductCategoryDto categoryDto = category.ConvertToDto(5);

            Assert.Equal(category.Name, categoryDto.Name);
        }
Пример #2
0
        public void ConvertToDto_ProductCategoryNotNull_ReturnSameSubCategories()
        {
            ProductCategory category = MockProductCategory();

            ProductCategoryDto categoryDto = category.ConvertToDto(5);

            Assert.Equal(category.SubCategories, categoryDto.SubCategories);
        }
Пример #3
0
        public void ConvertToDto_ProductCategoryNotNull_ReturnSameProductCount()
        {
            ProductCategory category = MockProductCategory();

            ProductCategoryDto categoryDto = category.ConvertToDto(5);

            Assert.Equal(5, categoryDto.ProductCount);
        }
Пример #4
0
 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));
 }