public JsonResult DeleteCandidate(int candidateId) { using (var candidateRepository = new CandidateRepository()) { var result = candidateRepository.DeleteCandidate(candidateId, ElectionConductor.ElectionId((int)Session["UserId"])); return new JsonResult { Data = new { isOk = result } }; } }
public void CandidateRepository_DeleteCandidate_ShouldDeleteCandidate() { //-- arrange var languages = new List <string>() { "c#", "lua" }; var candidate = new Candidate() { FirstName = "Jim J", LastName = "Poggers", YearsCoding = 3, Languages = languages, ExpectedSalary = 65000 }; //-- act _repo.CreateCandidate(candidate); _repo.DeleteCandidate(0); //-- assert Assert.IsTrue(_repo.Getlist().Count == 0); }