Ejemplo n.º 1
0
        public async Task ValidDeletePatientReturnsOkResponse()
        {
            var response = await _testPatientController.DeletePatient(_testPatients[0].PatientId);

            var responseResult = response.Result;

            responseResult.Should().BeOfType <OkObjectResult>();
        }
Ejemplo n.º 2
0
        public void TestDeletePatient()
        {
            // Act
            IActionResult result = _patientController.DeletePatient(_patient.Id);

            // Assert
            Assert.IsType <NoContentResult>(result);
            Assert.DoesNotContain(_mockPatientDbService.PatientList, patient => patient == _patient);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// loads anamnese overview
 /// </summary>
 /// <param name="pagesNavigation"></param>
 /// <param name="patientenDataGrid"></param>
 public AnamneseOverzicht(PagesNavigation pagesNavigation, DataGrid patientenDataGrid)
 {
     InitializeComponent();
     anamneseController.Overzicht(this);
     CreateAnamneseBtn.Click += (sender, e) => anamneseController.CreateAnamnese(sender, NavigationService, pagesNavigation, patientenDataGrid);
     deletebtn.Click         += (sender, e) => patientController.DeletePatient(pagesNavigation, patientenDataGrid);
 }
        public void DeletePatientActionResult_ValidDelete_RedirectsToViewPatients()
        {
            //Arrange
            var controller = new PatientController(logger.Object, patientRepo.Object, validator.Object);

            //Act
            var result = controller.DeletePatient(It.IsAny <int>()) as RedirectToActionResult;

            // Assert
            Assert.That(result.ActionName, Is.EqualTo("Index"));
        }
Ejemplo n.º 5
0
        public async void Delete_patient_Test()
        {
            var patientId = 2;

            _IPatientRepository.Setup(x => x.Delete(patientId))
            .ReturnsAsync(true);

            var response = await _patientController.DeletePatient(patientId);

            Assert.IsType <OkResult>(response);
        }
        public void DeletePatientTest()
        {
            //Arrange
            PatientController patientController = new PatientController();

            homeController.RegisterAsPatient(
                patient.Email,
                patient.Password,
                patient.Name,
                patient.PhoneNumber,
                patient.Diagnose,
                patient.BloodGroup);

            //Act
            patient = homeController.LoginAsPatient(patient.Email, patient.Password);
            patientController.DeletePatient(patient);

            //Assert
            Assert.IsTrue(homeController.LoginAsPatient(patient.Email, patient.Password) == null);
        }
Ejemplo n.º 7
0
        public void RegisterAsPatientTest()
        {
            //Arrange
            PatientController patientController = new PatientController();

            HomeController homeController = new HomeController();
            string         name           = "Test Patient 2";
            string         email          = "*****@*****.**";
            string         password       = "******";
            string         phoneNumber    = "0888123456";
            string         diagnose       = "test";
            string         bloodGroup     = "B-";

            //Act
            bool    expected = homeController.RegisterAsPatient(email, password, name, phoneNumber, bloodGroup, diagnose);
            Patient patient  = homeController.LoginAsPatient(email, password);

            //Assert
            Assert.IsTrue(patient != null);

            //Clean-Up
            patientController.DeletePatient(patient);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// handles patient page functions
 /// </summary>
 /// <param name="pagesNavigation"></param>
 /// <param name="patientenDataGrid"></param>
 public PatientDossier(PagesNavigation pagesNavigation, DataGrid patientenDataGrid)
 {
     InitializeComponent();
     patientController.Overzicht(this);
     deletebtn.Click += (sender, e) => patientController.DeletePatient(pagesNavigation, patientenDataGrid);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// The event handler method for PatientsDatatGrid CellContentClick
        /// </summary>
        private void PatientsDatatGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            patient = (UserDTO)patientsDatatGrid.Rows[e.RowIndex].DataBoundItem;
            if (patientsDatatGrid.Columns[e.ColumnIndex].Name == "ViewAppointment")
            {
                this.appointmentsDataGridView.Visible    = true;
                this.appointmentsDataGridView.DataSource = null;

                List <AppointmentDTO> appointmentDTO = this.appointmentController.GetPatientsAppointments(new Patient(patient.PatientId, patient.Id, true));

                if (appointmentDTO.Count <= 0)
                {
                    MessageBox.Show("No Appointments found in the system for the Patient.", "Not Found", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                this.appointmentsDataGridView.DataSource = appointmentDTO;
            }
            else if (patientsDatatGrid.Columns[e.ColumnIndex].Name == "EditPatient")
            {
                using (Form patientFormDialog = new PatientInformationDialog(patient))
                {
                    DialogResult result = patientFormDialog.ShowDialog();
                    if (result == DialogResult.OK || result == DialogResult.Cancel)
                    {
                        this.RefreshDataGrid();
                    }
                }
            }
            else if (patientsDatatGrid.Columns[e.ColumnIndex].Name == "CreateAppointment")
            {
                using (Form newAppointmentDialog = new NewAppointmentDialog(patient))
                {
                    DialogResult result = newAppointmentDialog.ShowDialog();
                    if (result == DialogResult.OK || result == DialogResult.Cancel)
                    {
                        this.RefreshDataGrid();
                    }
                }
            }
            else if (patientsDatatGrid.Columns[e.ColumnIndex].Name == "DeletePatient")
            {
                var hasUpcomingAppointment = this.appointmentController.GetPatientsAppointments(new Patient(patient.PatientId, patient.Id, true)).Exists(x => x.AppointmentDateTime >= DateTime.Now);
                if (!hasUpcomingAppointment)
                {
                    string message = "Are you sure you want to delete this patient?"
                                     + Environment.NewLine + $"Patient: {patient.FullName}";
                    string caption = $"Delete {patient.FirstName}  {patient.LastName}";
                    var    result  = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        if (patientController.DeletePatient(new Patient(patient.PatientId, patient.Id, true)))
                        {
                            MessageBox.Show("Patient deleted successfully");
                            PatientSearch();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Patient has upcoming appointment and can't be deleted.");
                }
            }
        }