示例#1
0
        public void Delete_Product_ShouldRemoveProduct()
        {
            //arrange
            //act
            bool deleted = sut.Delete("p1");

            //assert
            Assert.True(deleted);
            Assert.Null(sut.SelectById("p1"));
            Assert.Equal(productCount - 1, sut.Products.Count);
        }
示例#2
0
 // DELETE: api/productService/5
 public IHttpActionResult Delete(string id)
 {
     try
     {
         if (productModel.Delete(id))
         {
             return(Ok());   //200
         }
         return(NotFound()); //404
     }
     catch (Exception)
     {
         return(InternalServerError()); //500
     }
 }