示例#1
0
        public void GetDoctors_ReturnsAllPatientDoctors_DoctorList()
        {
            //Arrange
            Patient testPatient = new Patient("Sandy", "07/18/1987");

            testPatient.Save();

            Doctor testDoctor1 = new Doctor("Phillip");

            testDoctor1.Save();

            Doctor testDoctor2 = new Doctor("Zachary");

            testDoctor2.Save();

            //Act
            testPatient.AddDoctor(testDoctor1);
            List <Doctor> result   = testPatient.GetDoctors();
            List <Doctor> testList = new List <Doctor> {
                testDoctor1
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
示例#2
0
        public void GetDoctors_ReturnsAllPatientDoctors_DoctorList()
        {
            //Arrange
            DateTime testBirthday = new DateTime(1991, 06, 06);
            Patient  testPatient  = new Patient("Yoko", testBirthday);

            testPatient.Save();

            Doctor testDoctor1 = new Doctor("Bono", "cancer");

            testDoctor1.Save();

            Doctor testDoctor2 = new Doctor("Lemon", "optical");

            testDoctor2.Save();

            //Act
            testPatient.AddDoctor(testDoctor1);
            List <Doctor> result   = testPatient.GetDoctors();
            List <Doctor> testList = new List <Doctor> {
                testDoctor1
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
        public ActionResult AddDoctor(int patientId, int doctorId)
        {
            Patient patient = Patient.Find(patientId);
            Doctor  doctor  = Doctor.Find(doctorId);

            patient.AddDoctor(doctor);
            return(RedirectToAction("Show", new { id = patientId }));
        }
示例#4
0
        public ActionResult AddDoctor(int patientId)
        {
            Patient patient = Patient.Find(patientId);
            Doctor  doctor  = Doctor.Find(Int32.Parse(Request.Form["doctor-id"]));

            patient.AddDoctor(doctor);
            return(RedirectToAction("Success", "Home"));
        }
示例#5
0
        public void AddDoctor_AddsDoctorToPatient_DoctorList()
        {
            Patient testPatient = new Patient("test", new DateTime(1 / 2 / 2019));

            testPatient.Save();
            Doctor testDoctor = new Doctor("test1");

            testDoctor.Save();
            testPatient.AddDoctor(testDoctor);
            List <Doctor> result   = testPatient.GetDoctors();
            List <Doctor> testList = new List <Doctor> {
                testDoctor
            };

            CollectionAssert.AreEqual(testList, result);
        }
示例#6
0
        public void GetDoctors_ReturnsAllPatientDoctors_DoctorList()
        {
            Patient testPatient = new Patient("test", new DateTime(1 / 2 / 2019));

            testPatient.Save();
            Doctor testDoctor1 = new Doctor("test");

            testDoctor1.Save();
            Doctor testDoctor2 = new Doctor("test1");

            testDoctor2.Save();
            testPatient.AddDoctor(testDoctor1);
            List <Doctor> result   = testPatient.GetDoctors();
            List <Doctor> testList = new List <Doctor> {
                testDoctor1
            };

            CollectionAssert.AreEqual(testList, result);
        }
示例#7
0
        public void AddDoctor_AddsDoctorToPatient_DoctorList()
        {
            //Arrange
            Patient testPatient = new Patient("Sam", "9/24/1990");

            testPatient.Save();

            Doctor testDoctor = new Doctor("Howard");

            testDoctor.Save();

            //Act
            testPatient.AddDoctor(testDoctor);

            List <Doctor> result   = testPatient.GetDoctors();
            List <Doctor> testList = new List <Doctor> {
                testDoctor
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
示例#8
0
        public void  AddDoctor_AddsDoctorToPatient_DoctorList()
        {
            //Arrange
            DateTime testBirthday = new DateTime(1991, 06, 06);
            Patient  testPatient  = new Patient("Yoko", testBirthday);

            testPatient.Save();

            Doctor testDoctor = new Doctor("Jon", "Allergy");

            testDoctor.Save();

            //Act
            testPatient.AddDoctor(testDoctor);

            List <Doctor> result   = testPatient.GetDoctors();
            List <Doctor> testList = new List <Doctor> {
                testDoctor
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
示例#9
0
        public void Delete_DeletesPatientAssociationsFromDatabase_PatientList()
        {
            //Arrange
            Doctor testDoctor = new Doctor("Joey");

            testDoctor.Save();

            string  testName      = "Jerry";
            string  testBirthDate = "01/01/1900";
            Patient testPatient   = new Patient(testName, testBirthDate);

            testPatient.Save();

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

            List <Patient> resultDoctorPatients = testDoctor.GetPatients();
            List <Patient> testDoctorPatients   = new List <Patient> {
            };

            //Assert
            CollectionAssert.AreEqual(testDoctorPatients, resultDoctorPatients);
        }
示例#10
0
        public void Delete_DeletesPatientAssociationFromDatabase_PatientList()
        {
            //Arrange
            Doctor testDoctor = new Doctor("Bono", "cancer");

            testDoctor.Save();

            string   testName     = "Yoko";
            DateTime testBirthday = new DateTime(1991, 06, 06);
            Patient  testPatient  = new Patient(testName, testBirthday);

            testPatient.Save();

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

            List <Patient> resultDoctorPatients = testDoctor.GetPatients();
            List <Patient> testDoctorPatients   = new List <Patient> {
            };

            //Assert
            CollectionAssert.AreEqual(testDoctorPatients, resultDoctorPatients);
        }