public ActionResult DeletePetition(int petitionId, string test) { PetitionService service = new PetitionService(); service.DeletePetition(petitionId); return(RedirectToAction("ManagePetitions")); }
public void DeletePetition_New_Deleted() { var user = Helpers.CreateNewUser(); Models.PetitionModel model = null; Models.PetitionModel savedModel = null; try { var service = new PetitionService(); model = new Models.PetitionModel { Title = "Some Title", Description = "Some Description", SubmitterName = "Some user", SubmitterUserID = user.Id, TargetInstitution = "Test institution", Verified = false }; var id = service.CreateNewPetition(model); Assert.AreNotEqual(0, id, "ID not created"); savedModel = service.GetPetition(id, user.Id); Assert.IsNotNull(savedModel); service.DeletePetition(id); savedModel = service.GetPetition(id, user.Id); Assert.IsNull(savedModel); } finally { Helpers.DeleteUser(user); if (model != null) { new PetitionService().DeletePetition(model.PetitionID); } } }
public void VerifyPetition_NewPetition_Verified() { var user = Helpers.CreateNewUser(); var service = new PetitionService(); var petitionId = service.CreateNewPetition(new Models.PetitionModel { Title = "Some Title", Description = "Some description", SubmitterName = "I am Submitter", TargetInstitution = "Some institution", }); try { service.VerifyPetition(petitionId, user.Id); } finally { service.DeletePetition(petitionId); Helpers.DeleteUser(user); } }