public void AddTaskResultDisplayCandidateIfCandidateExists() { //Arrange Candidate candidate = new Candidate { CandidateID = 1, FirstName = "Foo", LastName = "Bar", PhoneNumber = 11111111, Test = null }; _context.Candidates.Add(candidate); _context.SaveChanges(); AddTaskResultLimits(_context); //Act IActionResult result = _sut.AddTaskResult(1); //Act ViewResult viewResult = Assert.IsType <ViewResult>(result); var candidateExists = _context.Candidates.FirstOrDefault(x => x.CandidateID == 1); Assert.NotNull(candidateExists); }