public void EditPatientActionResult_ValidData_ModelIsTransferedToView() { //Arrange PatientModel nullModel = null; patientRepo.Setup(repo => repo.GetById(It.IsAny <int>())).Returns(nullModel); var controller = new PatientController(logger.Object, patientRepo.Object, validator.Object); var result = controller.EditPatient(It.IsAny <int>()); // Assert Assert.IsInstanceOf(typeof(NotFoundResult), result); }
public void EditPatient_CorrectView_Ajax_Test() { //Arrange EmulateControllerContext(controller, true); int patientNumber = 88; repository.Setup(r => r.GetPatientByUniqueNumber(patientNumber)).Returns(new Patient() { Id = 117, PatientNumber = patientNumber, IsCompleted = true }); //Act var result = controller.EditPatient(patientNumber); //Assert Assert.That(result, Is.Not.Null); Assert.That(result is PartialViewResult); var viewResultBase = result as ViewResultBase; Assert.That(viewResultBase.Model, Is.Not.Null); Assert.That(viewResultBase.ViewName, Is.EqualTo("_EditPatient")); }