public void ConnectionStringNameTest() // znak - do spytania { SurgeryModelContainer smc = new SurgeryModelContainer(); IDBModels dbm = new DBModels(smc); Assert.AreEqual(smc.Database.Connection.DataSource, "NOTEBOOK96\\SQLEXPRESS"); }
public void DatabaseNameConnectedTest() // znak - do spytania { SurgeryModelContainer smc = new SurgeryModelContainer(); IDBModels dbm = new DBModels(smc); Assert.AreEqual(smc.Database.Connection.Database, "ClinicDB"); }
public void AccessDatabaseTest() { SurgeryModelContainer smc = new SurgeryModelContainer(); IDBModels dbm = new DBModels(smc); Assert.AreNotEqual(smc.Database, null); }
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); }
public Logic(IDBModels dbConnection = null) { if (dbConnection == null) { SurgeryModelContainer smc = new SurgeryModelContainer(); this.dbConnection = new DBModels(smc); } else { this.dbConnection = dbConnection; } }
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); }
public DBModels(SurgeryModelContainer smc) { sc = smc; }