public ActionResult Delete(int id, opportunity opportunity) { if (ModelState.IsValid) { opportunity = op.GetById(id); op.Delete(opportunity); op.Commit(); } return(RedirectToAction("Index")); }
public void TestDelete() { this.TestAdd(); ConfigurationHelper.Ensure(); var service = new OpportunityService(); var countBefore = service.GetAll().Count(); var maxId = service.GetAll().Max(i => i.Id); service.Delete(maxId); var countAfter = service.GetAll().Count(); Assert.Equal(countBefore, countAfter + 1); }