Example #1
0
        public void testCreationFromDataReader()
        {
            using (var reader = EntityDataMock.mockEmployeeReader())
            {
                string correctString = $"" +
                                       $"{reader["name"]} {reader["surname"]}";

                Employee employee = new Employee(reader);
                Assert.AreEqual(employee.ToString(), correctString);
            }
        }
Example #2
0
 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);
     }
 }
Example #3
0
 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);
     }
 }