Esempio n. 1
0
        public void AddEditandDeletePatientTest()
        {
            Patient patient = new Patient
            {
                Name        = "ExampleName",
                Surname     = "ExampleSurname",
                PESELNumber = "00000000000",
                PhoneNumber = "000000000",
                Address     = new Address
                {
                    City         = "ExampleCity",
                    Country      = "ExampleCountry",
                    HomeNumber   = 0,
                    Street       = "ExampleStreet",
                    StreetNumber = 0
                }
            };

            SurgeryModelContainer smc = new SurgeryModelContainer();
            IDBModels             dbm = new DBModels(smc);

            int beforeAddPatientsCount = smc.Patients.Count();

            dbm.AddPatient(patient.Name, patient.Surname, patient.PhoneNumber, patient.PESELNumber, patient.Address);
            int afterAddPatientsCount = smc.Patients.Count();

            dbm.EditPatient(patient.PESELNumber, patient.Name, "EditedSurname", patient.PhoneNumber, patient.PESELNumber, patient.Address);
            var editedPatient          = dbm.ListPatientsByPESEL("00000000000", 0, 10);
            int numberOfEditedPatients = editedPatient.Count;

            dbm.DeletePatient("00000000000");
            int afterDeletePatientsNumber = smc.Patients.Count();

            Assert.AreEqual(afterAddPatientsCount, beforeAddPatientsCount + 1);
            Assert.AreEqual(afterAddPatientsCount, afterDeletePatientsNumber + 1);
            Assert.AreEqual("EditedSurname", editedPatient[0].Surname);
        }