Ejemplo n.º 1
0
        public void InsertPatientActionResult_NullPatientModel_ReturnBadRequest()
        {
            //Arrange
            var controller = new PatientNoteController(userRepo.Object, patientNoteRepo.Object, patientRepo.Object, validatorRepo.Object);

            //Act
            var result = controller.InsertPatientNote(null);

            // Assert
            Assert.IsInstanceOf(typeof(BadRequestObjectResult), result);
        }
Ejemplo n.º 2
0
        public void InsertPatientActionResult_ValidPatientModel_RedirectToIndexView()
        {
            //Arrange
            PatientNoteModel validModel = new PatientNoteModel {
                PatientId = 1, PractitionerId = 1, NoteId = 1, NoteDescription = "Description", CreationDate = DateTime.Now
            };
            var controller = new PatientNoteController(userRepo.Object, patientNoteRepo.Object, patientRepo.Object, validatorRepo.Object);

            validatorRepo.Setup(repo => repo.Validate(It.IsAny <PatientNoteModel>())).Returns(true);

            //Act
            var result = controller.InsertPatientNote(validModel) as RedirectToActionResult;

            // Assert
            Assert.That(result.ActionName, Is.EqualTo("ViewPatientNotes"));
        }