Exemple #1
0
        public void T8_Delete_DeleteRelationshipsInOtherTables()
        {
            Patient testPatient = new Patient("Anderson", "1234 Main Street");

            testPatient.Save();

            Patient testPatient2 = new Patient("And", "1234");

            testPatient2.Save();
            Symptom testSymptom = new Symptom("Stable", "Heart");

            testSymptom.Save();
            DateTime diagnosisDate = new DateTime(2016, 08, 04);

            Diagnosis testDiagnosis = new Diagnosis(testPatient.GetId(), 1, testSymptom.GetId(), diagnosisDate);

            testDiagnosis.Save();

            Diagnosis testDiagnosis2 = new Diagnosis(testPatient2.GetId(), 1, testSymptom.GetId(), diagnosisDate);

            testDiagnosis2.Save();

            testPatient.Delete();

            List <Diagnosis> result   = Diagnosis.GetAll();
            List <Diagnosis> testList = new List <Diagnosis> {
                testDiagnosis2
            };

            Assert.Equal(testList, result);
        }
Exemple #2
0
        public void T5_Find_FindsSymptomInDB()
        {
            Symptom testSymptom = new Symptom("Anderson", "1234 Main Street");

            testSymptom.Save();

            Symptom foundSymptom = Symptom.Find(testSymptom.GetId());

            Assert.Equal(testSymptom, foundSymptom);
        }
Exemple #3
0
        public void T4_Save_AssignsIdToSymptom()
        {
            Symptom testSymptom = new Symptom("Anderson", "1234 Main Street");

            testSymptom.Save();

            Symptom savedSymptom = Symptom.GetAll()[0];
            int     result       = savedSymptom.GetId();
            int     testId       = testSymptom.GetId();

            Assert.Equal(testId, result);
        }
        public override bool Equals(System.Object otherSymptom)
        {
            if (!(otherSymptom is Symptom))
            {
                return(false);
            }
            else
            {
                Symptom newSymptom             = (Symptom)otherSymptom;
                bool    idEquality             = this.GetId() == newSymptom.GetId();
                bool    nameEquality           = this.GetName() == newSymptom.GetName();
                bool    classificationEquality = this.GetClassification() == newSymptom.GetClassification();
                bool    contagiousEquality     = this.IsContagious() == newSymptom.IsContagious();

                return(idEquality && nameEquality && classificationEquality && contagiousEquality);
            }
        }
Exemple #5
0
        public void T3_Save_SavesToDB()
        {
            Patient testPatient = new Patient("Anderson", "1234 Main Street");

            testPatient.Save();
            Symptom testSymptom = new Symptom("Stable", "Heart");

            testSymptom.Save();
            DateTime diagnosisDate = new DateTime(2016, 08, 04);

            Diagnosis testDiagnosis = new Diagnosis(testPatient.GetId(), 1, testSymptom.GetId(), diagnosisDate);

            testDiagnosis.Save();

            List <Diagnosis> result   = Diagnosis.GetAll();
            List <Diagnosis> testList = new List <Diagnosis> {
                testDiagnosis
            };

            Assert.Equal(testList, result);
        }