public void DeleteData_ValidOrInvalidData_Successful() { const string Message = "Data doesnt exsist in the topicinformation db."; //Arrange ManageData manageDataTest = new ManageData(); TopicInformation topicinformation = new TopicInformation { WeekNumber = 13, LastUpdatedBy = "*****@*****.**", Topic = "Revision" }; //Act bool isDataDeleted = manageDataTest.DeleData(topicinformation); //Assert try { //Returns true if the data passed as parameter to DeteData( data ) function exsists in the database Assert.IsTrue(isDataDeleted, "Data exsists to be editted."); } catch { ////Returns false if the data passed as parameter to DeteData( data ) function exsist in the database Assert.IsFalse(isDataDeleted, Message); } }
public ActionResult DeleteConfirmed(int id) { TopicInformation topicInformation = manageData.FindDataRowById((int)id); bool dataDelete = manageData.DeleData(topicInformation); if (dataDelete) { return(RedirectToAction("Index")); } else { ViewBag.Error = "Rule Cannot be deleted !"; return(View(topicInformation)); } }