예제 #1
0
 private void RandomPatientButton_Click(object sender, RoutedEventArgs e)
 {
     using (ExampleData data = new ExampleData())
     {
         CurrentPatient = data.ExamplePatient();
     }
 }
예제 #2
0
        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());
            }
        }
예제 #3
0
        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());
            }
        }
예제 #4
0
 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()));
     }
 }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
            }
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
        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);
            }
        }
예제 #9
0
        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.");
        }
예제 #10
0
        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);
            }
        }
예제 #11
0
        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);
            }
        }
예제 #12
0
        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);
            }
        }
예제 #13
0
        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());
            }
        }