public void T5_Find_FindsDiagnosisInDB() { DateTime diagnosisDate = new DateTime(2016, 08, 04); Diagnosis testDiagnosis = new Diagnosis(1, 2, 1, diagnosisDate); testDiagnosis.Save(); Diagnosis foundDiagnosis = Diagnosis.Find(testDiagnosis.GetId()); Assert.Equal(testDiagnosis, foundDiagnosis); }
public void T4_Save_AssignsIdToDiagnosis() { DateTime diagnosisDate = new DateTime(2016, 08, 04); Diagnosis testDiagnosis = new Diagnosis(1, 2, 1, diagnosisDate); testDiagnosis.Save(); Diagnosis savedDiagnosis = Diagnosis.GetAll()[0]; int result = savedDiagnosis.GetId(); int testId = testDiagnosis.GetId(); Assert.Equal(testId, result); }
public override bool Equals(System.Object otherDiagnosis) { if (!(otherDiagnosis is Diagnosis)) { return(false); } else { Diagnosis newDiagnosis = (Diagnosis)otherDiagnosis; bool idEquality = this.GetId() == newDiagnosis.GetId(); bool patientIdEquality = this.GetPatientId() == newDiagnosis.GetPatientId(); bool symptomIdEquality = this.GetSymptomId() == newDiagnosis.GetSymptomId(); bool doctorIdEquality = this.GetDoctorId() == newDiagnosis.GetDoctorId(); bool diagnosisDateEquality = this.GetDiagnosisDate() == newDiagnosis.GetDiagnosisDate(); return(idEquality && patientIdEquality && symptomIdEquality && diagnosisDateEquality && doctorIdEquality); } }