private void RandomButton_Click(object sender, RoutedEventArgs e) { using (ExampleData data = new ExampleData()) { FoundPatientsListView.ItemsSource = data.ExampleDoctor(int.Parse((PatientsNumberCombo.SelectedItem as ComboBoxItem).Content.ToString())); } }
public void ShowVisitsTestCount() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Doctor dr = data.ExampleDoctor(); Patient p = data.ExamplePatient(); testLogic.AddDoctor(dr); testLogic.CreatePatient(p); DateTime dt = data.ExampleTime(); dt = dt.AddMinutes(60 - dt.Minute); for (DateTime _dt = dt; _dt < dt.AddHours(3); _dt = _dt.AddMinutes(15)) { testLogic.AddVisit(_dt, p, dr); } dr.LicenseNumber = "55555"; testLogic.AddDoctor(dr); for (DateTime _dt = dt; _dt < dt.AddHours(4); _dt = _dt.AddMinutes(15)) { testLogic.AddVisit(_dt, p, dr); } IEnumerable <Visit> list = testLogic.ShowVisits(dt.Date, dt.Hour.ToString(), 24.ToString(), dr.Surname, "", dr.Specialization, true, 0, 50); Assert.AreEqual(50, list.Count()); } }
public void ShowVisitsTestVisitsCount() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Doctor dr = data.ExampleDoctor(); Patient p = data.ExamplePatient(); testLogic.AddDoctor(dr); testLogic.CreatePatient(p); DateTime dt = data.ExampleTime(); dt = dt.AddMinutes(60 - dt.Minute); testLogic.AddVisit(dt.AddMinutes(45), p, dr); dr.LicenseNumber = "555555"; testLogic.AddDoctor(dr); dr.LicenseNumber = "123456"; testLogic.AddDoctor(dr); IEnumerable <Visit> list = testLogic.ShowVisits(dt.Date, dt.Hour.ToString(), 24.ToString(), dr.Surname, "", dr.Specialization, false, 0, 50); IEnumerable <Visit> withPatients = list.Where(v => v.Patient != null); Assert.AreEqual(1, withPatients.Count()); } }
public void SearchDoctorBySpecAndSurnameTest() { IDBModels fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Doctor dr1 = data.ExampleDoctor(); Doctor dr2 = data.ExampleDoctor(); testLogic.AddDoctor(dr1); testLogic.AddDoctor(dr2); List <Doctor> list = (List <Doctor>)testLogic.SearchDoctor(dr1.Specialization, dr1.Surname, "", "", 0, 1); Assert.AreEqual(dr1.LicenseNumber, list[0].LicenseNumber); } }
public void AddDoctorTest() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Doctor dr1 = data.ExampleDoctor(); testLogic.AddDoctor(dr1); Assert.AreEqual(1, fakeDBModel.__doctors.Count); } }
public void ShowVisitsTestAnyVisit() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Doctor dr = data.ExampleDoctor(); testLogic.AddDoctor(dr); DateTime dt = data.ExampleTime(); IEnumerable <Visit> list = testLogic.ShowVisits(dt.Date, dt.Hour.ToString(), 24.ToString(), dr.Surname, "", dr.Specialization, true, 0, 1); Assert.AreNotEqual(null, list.First().Date); } }
public void ShowVisitsTestNull() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { ; Doctor dr = data.ExampleDoctor(); DateTime dt = data.ExampleTime(); var list = testLogic.ShowVisits(dt, 8.ToString(), 20.ToString(), dr.Name, "", dr.Specialization, true, 0, 0); Assert.AreEqual(null, list); } }
public void AddVisitTest() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Patient p = data.ExamplePatient(); Doctor dr = data.ExampleDoctor(); DateTime dt = data.ExampleTime(); testLogic.AddVisit(dt, p, dr); Assert.AreEqual(1, fakeDBModel.__visits.Count); } }
public void ShowPatientVisitsTest() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Patient p = data.ExamplePatient(); Doctor dr = data.ExampleDoctor(); DateTime dt = data.ExampleTime(); testLogic.CreatePatient(p); testLogic.AddDoctor(dr); testLogic.AddVisit(dt, p, dr); List <Visit> list = (List <Visit>)testLogic.ShowPatientVisits(p); Assert.AreEqual(p.PESELNumber, list[0].Patient.PESELNumber); Assert.AreEqual(dr.LicenseNumber, list[0].Doctor.LicenseNumber); Assert.AreEqual(dt, list[0].DT); } }
public void ShowVisitsTestDoctorsCount() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Doctor dr = data.ExampleDoctor(); Patient p = data.ExamplePatient(); testLogic.AddDoctor(dr); testLogic.CreatePatient(p); DateTime dt = data.ExampleTime(); dt = dt.AddMinutes(60 - dt.Minute); dr.LicenseNumber = "555555"; testLogic.AddDoctor(dr); dr.LicenseNumber = "123456"; testLogic.AddDoctor(dr); IEnumerable <Visit> list = testLogic.ShowVisits(dt.Date, dt.Hour.ToString(), 24.ToString(), dr.Surname, "", dr.Specialization, true, 0, 50); IEnumerable <Visit> drList = list.GroupBy(v => v.Doctor.LicenseNumber).Select(group => group.First()); Assert.AreEqual(3, drList.Count()); } }