private void RandomPatientButton_Click(object sender, RoutedEventArgs e) { using (ExampleData data = new ExampleData()) { CurrentPatient = data.ExamplePatient(); } }
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 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()); } }
private void RandomButton_Click(object sender, RoutedEventArgs e) { using (ExampleData data = new ExampleData()) { FoundPatientsListView.ItemsSource = data.ExamplePatient(int.Parse((PatientsNumberCombo.SelectedItem as ComboBoxItem).Content.ToString())); } }
public void SearchPatientBySurnameNameAndCityTest() { IDBModels fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Patient p1 = data.ExamplePatient(); Patient p2 = data.ExamplePatient(); testLogic.CreatePatient(p1); testLogic.CreatePatient(p2); List <Patient> list = (List <Patient>)testLogic.SearchPatient("", p1.Surname, p1.Name, p1.Address.City, 0, 1); Assert.AreEqual(p1.PESELNumber, list[0].PESELNumber); } }
public void InvalidArgumentsSearchPatientTest() { IDBModels fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Patient p1 = data.ExamplePatient(); Patient p2 = data.ExamplePatient(); testLogic.CreatePatient(p1); testLogic.CreatePatient(p2); List <Patient> list = (List <Patient>)testLogic.SearchPatient("", "", "", "", 0, 1); Assert.AreEqual(null, list); } }
public void CreatePatientTest() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Patient p = data.ExamplePatient(); testLogic.CreatePatient(p); Assert.AreEqual(1, fakeDBModel.__patients.Count); } }
public void CreateInvalidPatientTest() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Patient p = data.ExamplePatient(); p.Name = "ja"; bool ret = testLogic.CreatePatient(p); Assert.AreEqual(false, ret); } }
private void Button_Click(object sender, RoutedEventArgs e) { int added = 0; for (int i = 0; i < 100; i++) { using (ExampleData data = new ExampleData()) if (AppLogic.CreatePatient(data.ExamplePatient())) { added++; } } MessageBox.Show($"Dodadno {added} pacjentów."); }
public void UpdatePatientTest() { TestDBConnector fakeDBModel = new TestDBConnector(); Logic testLogic = new Logic(fakeDBModel); using (ExampleData data = new ExampleData(0)) { Patient p = data.ExamplePatient(); testLogic.CreatePatient(p); p.Name = "Ania"; bool ret = testLogic.UpdatePatient(p); Assert.AreEqual(true, ret); Assert.AreEqual("Ania", fakeDBModel.__patients[0].Name); } }
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()); } }