Esempio n. 1
0
        public void ConnectionStringNameTest() // znak - do spytania
        {
            SurgeryModelContainer smc = new SurgeryModelContainer();
            IDBModels             dbm = new DBModels(smc);

            Assert.AreEqual(smc.Database.Connection.DataSource, "NOTEBOOK96\\SQLEXPRESS");
        }
Esempio n. 2
0
        public void DatabaseNameConnectedTest() // znak - do spytania
        {
            SurgeryModelContainer smc = new SurgeryModelContainer();
            IDBModels             dbm = new DBModels(smc);

            Assert.AreEqual(smc.Database.Connection.Database, "ClinicDB");
        }
Esempio n. 3
0
        public void AccessDatabaseTest()
        {
            SurgeryModelContainer smc = new SurgeryModelContainer();
            IDBModels             dbm = new DBModels(smc);

            Assert.AreNotEqual(smc.Database, null);
        }
Esempio n. 4
0
        public void ClosedConnectionTest()
        {
            SurgeryModelContainer smc = new SurgeryModelContainer();
            IDBModels             dbm = new DBModels(smc);

            System.Data.Common.DbConnection dbcon = smc.Database.Connection;

            Assert.AreEqual(smc.Database.Connection.State, ConnectionState.Closed);
        }
Esempio n. 5
0
 public Logic(IDBModels dbConnection = null)
 {
     if (dbConnection == null)
     {
         SurgeryModelContainer smc = new SurgeryModelContainer();
         this.dbConnection = new DBModels(smc);
     }
     else
     {
         this.dbConnection = dbConnection;
     }
 }
Esempio n. 6
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);
        }
Esempio n. 7
0
 public DBModels(SurgeryModelContainer smc)
 {
     sc = smc;
 }