public void Delete() { //Arrange int ID = -1; unitWorkMoq.Setup(x => x.Checkpoint.Delete(It.IsAny <int>())).Callback(() => { ID = itemsSimple[0].ID; }); //Act serviceMock.Delete(itemsSimple[0]); //Assert Assert.AreNotEqual(-1, ID); Assert.AreEqual(id, ID); }
public IHttpActionResult Delete(int id) { Checkpoint item = service.GetSimple(id); if (item != null) { service.DeleteAllAdmission(id); service.Delete(item); return(Ok(item)); } return(BadRequest()); }
public ActionResult Delete(CheckpointDTO model) { try { checkpointService.DeleteAllAdmission(model.ID); checkpointService.Delete(checkpointService.GetSimple(model.ID)); return(RedirectToAction("Index", "Checkpoint")); } catch { return(View(model)); } }