public void TestDischargePatientSuccessfully() { PatientDataController controller = new PatientDataController(operations); var actualResponse = controller.DischargePatient(1); var okResult = actualResponse as OkResult; // Assert Assert.NotNull(okResult); Assert.Equal(200, okResult.StatusCode); }
public void TestDischargePatientUnSuccessful() { PatientDataController controller = new PatientDataController(operations); var actualResponse = controller.DischargePatient(2); var respone = actualResponse as StatusCodeResult; // Assert Assert.NotNull(respone); Assert.Equal(500, respone.StatusCode); }
public void TestAllotPatientUnSuccessful() { PatientDataController controller = new PatientDataController(operations); BedAllotmentModel bedAllotment = new BedAllotmentModel { PatientId = 2, Department = "Cancer" }; var actualResponse = controller.AllotBedToPatient(bedAllotment); var actualResponseObject = actualResponse as StatusCodeResult; Assert.NotNull(actualResponseObject); Assert.Equal(500, actualResponseObject.StatusCode); }
public void TestInsertPatientThrowsException() { PatientDataController controller = new PatientDataController(operations); var patient = new PatientDataModel { PatientName = "Hari", Address = "address", Mobile = "9898933898", Email = "*****@*****.**" }; var actualResponse = controller.InsertPatient(patient); var actualResponseObject = actualResponse.Result as ObjectResult; Assert.NotNull(actualResponse); Assert.Equal(500, actualResponseObject.StatusCode); }
public void TestInsertPatientValidationFalure() { PatientDataController controller = new PatientDataController(operations); var patient = new PatientDataModel { PatientName = "p1", Address = "address", Mobile = "98989898", Email = "*****@*****.**" }; var actualResponse = controller.InsertPatient(patient); var actualResponseObject = actualResponse.Result as BadRequestObjectResult; Assert.NotNull(actualResponseObject); Assert.Equal(400, actualResponseObject.StatusCode); }
public void GetClosedDiseaseInfo() { // Arrange var fake_info = GetFakeClosedDiseases(); mock.Setup(repo => repo.GetClosedDiseaseInfo(168)).Returns(fake_info); var controller = new PatientDataController(mock.Object); // Act var response = (controller.GetClosedDiseaseInfo(168) as OkNegotiatedContentResult <List <DiseaseInfo> >).Content; // Assert Assert.AreEqual(response, fake_info); }