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); }
// 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 } }