public void ValidateProductManagementService_CreateProduct()
        {
            var testDbContext = CreateInMemoryDBContext();
            var mapper        = CreateAutoMapper();
            var testProduct   = new ProductDTO()
            {
                Id    = 0,
                Code  = "test1",
                Name  = "Prod 1",
                Price = 120
            };
            var mockValidationService    = new Mock <IProductValidationService>();
            var productManagementService = new ProductManagementService(testDbContext, mapper, mockValidationService.Object);

            Assert.Equal(1, productManagementService.CreateProduct(testProduct));
        }
 public override async Task <ProductDto> Create(Product entity)
 {
     try
     {
         return(await Task.Run(() =>
         {
             ProductManagementService.CreateProduct(entity);
             if (ProductManagementService.HasErrors())
             {
                 throw new BusinessException(ProductManagementService.ServiceErrorMessage());
             }
             return WrapItem(entity);
         }));
     }
     catch (Exception ex)
     {
         throw new InternalException("Error retrieving item", ex);
     }
 }