예제 #1
0
        public void Patient_GetAll_DatabaseEmptyOnload()
        {
            List <Patient> testList    = Patient.GetAll();
            List <Patient> controlList = new List <Patient> {
            };

            Assert.Equal(controlList, testList);
        }
예제 #2
0
        public void Patient_Save_SaveToDatabase()
        {
            Patient newPatient = new Patient("John", "john123", "123", new DateTime(1996, 04, 25));

            newPatient.Save();

            Patient testPatient = Patient.GetAll()[0];

            Assert.Equal(newPatient, testPatient);
        }
        private void ultraBtnPDelete_Click(object sender, EventArgs e)
        {
            objHospitalDB = new HospitalDB();
            Patient    objPatient    = new Patient(objHospitalDB);
            PatientRow objPatientRow = new PatientRow();

            objPatientRow.Patient_ID = Convert.ToInt32(this.Pat_id);
            objPatient.Delete(objPatientRow);
            ultraGridPatient.DataSource = objPatient.GetAll();

            /* ultraGridPatient.Rows[this.ultraGridPatient.ActiveRow.Index].Delete(true);
             * SqlCommand query = objHospitalDB.CreateCommand("delete from Patient where Patient_ID='" + this.Pat_id + "';", false);
             * int p = query.ExecuteNonQuery();
             * MessageBox.Show(p + "Deleted");*/
        }
예제 #4
0
        public void Test_Save_AssignsIdToObject()
        {
            //Arrange
            Patient testPatient = new Patient("John", "April 1 1954", 5);

            //Act
            testPatient.Save();
            Patient savedPatient = Patient.GetAll()[0];

            int result = savedPatient.GetId();
            int testId = testPatient.GetId();

            //Assert
            Assert.Equal(testId, result);
        }
예제 #5
0
        public void  Test_Save_SavesToDatabase()
        {
            //Arrange
            Patient testPatient = new Patient("John", "April 1 1945", 5);

            //Act
            testPatient.Save();
            List <Patient> result   = Patient.GetAll();
            List <Patient> testList = new List <Patient> {
                testPatient
            };

            //Assert
            Assert.Equal(testList, result);
        }
예제 #6
0
        public HomeModule()
        {
            Get["/"] = _ => {
                List <Doctor> AllDoctors = Doctor.GetAll();
                return(View["index.cshtml", AllDoctors]);
            };
            Get["/patients"] = _ => {
                List <Patient> AllPatients = Patient.GetAll();
                return(View["patients.cshtml", AllPatients]);
            };
            Get["/doctors"] = _ => {
                List < Doctors AllDoctors = Doctors GetAll();

                return(View["doctors.cshtml", AllDoctors]);
            };
        }
예제 #7
0
        public void Patient_Delete_DeletesSinglePatient()
        {
            Patient patient1 = new Patient("John", "john123", "123", new DateTime(1996, 04, 25));

            patient1.Save();
            Patient patient2 = new Patient("Samuel", "john123", "123", new DateTime(1996, 04, 25));

            patient2.Save();

            patient1.DeleteSinglePatient();

            List <Patient> testList    = Patient.GetAll();
            List <Patient> controlList = new List <Patient> {
                patient2
            };

            Assert.Equal(controlList, testList);
        }
예제 #8
0
        public void Test_DatabaseEmptyAtFirst()
        {
            int result = Patient.GetAll().Count;

            Assert.Equal(0, result);
        }