Esempio n. 1
0
        public async Task Delete_ProductServiceReturnsTrueWhenDeletingProductOption_ReturnsNoContent()
        {
            //Arrange
            var productId       = Guid.NewGuid();
            var productOptionId = Guid.NewGuid();

            _mockProductService
            .Setup(x => x.DeleteProductOptionAsync(productId, productOptionId))
            .ReturnsAsync(true)
            .Verifiable();

            //Act
            var result = await _sut.Delete(productId, productOptionId);

            //Assert
            _mockProductService.Verify();
            Assert.IsType <NoContentResult>(result);
        }
Esempio n. 2
0
 public ActionResult DeleteProductOption(int id, int optionId)
 {
     try
     {
         var response = _ProductOptionsController.Delete(id, optionId);
         if (response)
         {
             return(StatusCode(StatusCodes.Status204NoContent));
         }
         else
         {
             return(NotFound("The Product option resource doesn't exist"));
         }
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
     }
 }