Example #1
0
        public void Test_AddPatient_AddsPatientToDoctor()
        {
            //Arrange
            Doctor testDoctor = new Doctor("Carl");

            testDoctor.Save();

            Patient testPatient = new Patient("Howard", "02/28/1990");

            testPatient.Save();

            Patient testPatient2 = new Patient("Phil", "02/18/1993");

            testPatient2.Save();

            //Act
            testDoctor.AddPatient(testPatient);
            testDoctor.AddPatient(testPatient2);

            List <Patient> result   = testDoctor.GetPatients();
            List <Patient> testList = new List <Patient> {
                testPatient, testPatient2
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
Example #2
0
        public void Test_AddPatient_AddsPatientToDoctor()
        {
            //Arrange
            Doctor testDoctor = new Doctor("Household chores");

            testDoctor.Save();
            DateTime patientDueDate = new DateTime(1999, 12, 24);
            Patient  testPatient    = new Patient("Mow the lawn", patientDueDate);

            testPatient.Save();
            Patient testPatient2 = new Patient("Water the garden", patientDueDate);

            testPatient2.Save();

            //Act
            testDoctor.AddPatient(testPatient);
            testDoctor.AddPatient(testPatient2);
            List <Patient> result   = testDoctor.GetPatients();
            List <Patient> testList = new List <Patient> {
                testPatient, testPatient2
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
Example #3
0
        public void GetPatients_ReturnsAllDoctorPatients_PatientList()
        {
            //Arrange
            Doctor testDoctor = new Doctor("Joe");

            testDoctor.Save();

            Patient testPatient1 = new Patient("Sally", "3/30/1990");

            testPatient1.Save();

            Patient testPatient2 = new Patient("Molly", "9/10/2011");

            testPatient2.Save();

            //Act
            testDoctor.AddPatient(testPatient1);
            List <Patient> savedPatients = testDoctor.GetPatients();
            List <Patient> testList      = new List <Patient> {
                testPatient1
            };

            //Assert
            CollectionAssert.AreEqual(testList, savedPatients);
        }
        public ActionResult AddPatient(int doctorId)
        {
            Doctor  doctor  = Doctor.Find(doctorId);
            Patient patient = Patient.Find(Int32.Parse(Request.Form["patient-id"]));

            doctor.AddPatient(patient);
            return(RedirectToAction("Success", "Home"));
        }
Example #5
0
        public ActionResult AddPatient(int doctorId, int patientId)
        {
            Doctor  doctor  = Doctor.Find(doctorId);
            Patient patient = Patient.Find(patientId);

            doctor.AddPatient(patient);
            return(RedirectToAction("Show", new { id = doctorId }));
        }
Example #6
0
        public void Count_PatientsFrom_OneDoctor()
        {
            Doctor testDoctor = new Doctor("Jack");

            testDoctor.Save();
            Patient newPatient1 = new Patient("Mark", new DateTime());

            newPatient1.Save();
            testDoctor.AddPatient(newPatient1);
            Patient newPatient2 = new Patient("Erik", new DateTime());

            newPatient2.Save();
            testDoctor.AddPatient(newPatient2);
            Doctor foundDoctor = Doctor.Find(testDoctor.GetId());
            int    result      = foundDoctor.CountPatients();

            Assert.AreEqual(2, result);
        }
        public void Test_AddPatient_AddsPatientToDoctor()
        {
            Doctor testDoctor = new Doctor("test");

            testDoctor.Save();
            Patient testPatient = new Patient("test", new DateTime(1 / 2 / 2019));

            testPatient.Save();
            Patient testPatient2 = new Patient("test1", new DateTime(1 / 2 / 2019));

            testPatient2.Save();
            testDoctor.AddPatient(testPatient);
            testDoctor.AddPatient(testPatient2);
            List <Patient> result   = testDoctor.GetPatients();
            List <Patient> testList = new List <Patient> {
                testPatient, testPatient2
            };

            CollectionAssert.AreEqual(testList, result);
        }
        public void GetPatients_ReturnsAllDoctorPatients_PatientList()
        {
            Doctor testDoctor = new Doctor("test");

            testDoctor.Save();
            Patient testPatient = new Patient("test", new DateTime(1 / 2 / 2019));

            testPatient.Save();
            Patient testPatient2 = new Patient("test1", new DateTime(1 / 2 / 2019));

            testPatient2.Save();
            testDoctor.AddPatient(testPatient);
            List <Patient> savedPatients = testDoctor.GetPatients();
            List <Patient> testList      = new List <Patient> {
                testPatient
            };

            CollectionAssert.AreEqual(testList, savedPatients);
        }
Example #9
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (eventData.pointerPress.name == "updatePswdButton")          //如果当前按下的按钮是修改密码按钮
     {
         test.UpdatePassword(dc_firstPswdField.text.ToString(), dc_secondPswdField.text.ToString());
     }
     if (eventData.pointerPress.name == "changeInfoButton")
     {
         test.ChangeInfo(dcNameField.text.ToString(), dcSexField.text.ToString(), dcProField.text.ToString(), dcTeleField.text.ToString());
     }
     if (eventData.pointerPress.name == "addPatientButton")          //如果当前按下的按钮是添加患者按钮
     {
         test.AddPatient(ptIDField.text.ToString(), ptNameField.text.ToString(), ptSexField.text.ToString(), ptTeleField.text.ToString());
     }
     if (eventData.pointerPress.name == "deletePatientButton")               //如果当前按下的按钮是删除患者按钮
     {
         test.DeletePatient();
     }
 }
Example #10
0
        public void Delete_DeletesDoctorAssociationsFromDatabase_DoctorList()
        {
            //Arrange
            DateTime patientDueDate = new DateTime(1999, 12, 24);
            Patient  testPatient    = new Patient("Mow the lawn", patientDueDate);

            testPatient.Save();
            string testName   = "Home stuff";
            Doctor testDoctor = new Doctor(testName);

            testDoctor.Save();

            //Act
            testDoctor.AddPatient(testPatient);
            testDoctor.Delete();
            List <Doctor> resultPatientCategories = testPatient.GetCategories();
            List <Doctor> testPatientCategories   = new List <Doctor> {
            };

            //Assert
            CollectionAssert.AreEqual(testPatientCategories, resultPatientCategories);
        }
Example #11
0
        public void Delete_DeletesDoctorAssociationsFromDatabase_DoctorList()
        {
            //Arrange
            Patient testPatient = new Patient("Jim", "04/01/1987");

            testPatient.Save();

            string testName   = "Tony";
            Doctor testDoctor = new Doctor(testName);

            testDoctor.Save();

            //Act
            testDoctor.AddPatient(testPatient);
            testDoctor.Delete();

            List <Doctor> resultPatientDoctors = testPatient.GetDoctors();
            List <Doctor> testPatientDoctors   = new List <Doctor> {
            };

            //Assert
            CollectionAssert.AreEqual(testPatientDoctors, resultPatientDoctors);
        }
Example #12
0
        public void GetPatients_ReturnsAllDoctorPatients_PatientList()
        {
            //Arrange
            DateTime patientDueDate = new DateTime(1999, 12, 24);
            Doctor   testDoctor     = new Doctor("Household chores");

            testDoctor.Save();
            Patient testPatient1 = new Patient("Mow the lawn", patientDueDate);

            testPatient1.Save();
            Patient testPatient2 = new Patient("Buy plane ticket", patientDueDate);

            testPatient2.Save();

            //Act
            testDoctor.AddPatient(testPatient1);
            List <Patient> savedPatients = testDoctor.GetPatients();
            List <Patient> testList      = new List <Patient> {
                testPatient1
            };

            //Assert
            CollectionAssert.AreEqual(testList, savedPatients);
        }