public void testCreationFromDataReader() { using (var reader = EntityDataMock.mockEmployeeReader()) { string correctString = $"" + $"{reader["name"]} {reader["surname"]}"; Employee employee = new Employee(reader); Assert.AreEqual(employee.ToString(), correctString); } }
public void testToUpdateSuccess() { using (var reader = EntityDataMock.mockEmployeeReader()) { string correctString = $"name='{reader["name"]}', surname='{reader["surname"]}', " + $"birth_date='{DateTime.Parse(reader["birth_date"].ToString()).ToString("yyyy/MM/dd")}', " + $"date_of_employment='{DateTime.Parse(reader["date_of_employment"].ToString()).ToString("yyyy/MM/dd")}'," + $"hourly_payment={reader["hourly_payment"]}"; Employee employee = new Employee(reader); Assert.AreEqual(employee.ToUpdate(), correctString); } }
public void testToInsertSuccess() { using (var reader = EntityDataMock.mockEmployeeReader()) { string correctString = $"(name, surname, birth_date, " + $"date_of_employment, hourly_payment)" + $"VALUES('{reader["name"]}', " + $"'{reader["surname"]}', " + $"'{DateTime.Parse(reader["birth_date"].ToString()).ToString("yyyy/MM/dd")}', " + $"'{DateTime.Parse(reader["date_of_employment"].ToString()).ToString("yyyy/MM/dd")}', " + $"{reader["hourly_payment"]});"; Employee employee = new Employee(reader); Assert.AreEqual(employee.ToInsert(), correctString); } }