public void ShouldCreateEmployees() { // Arrange EmployeeRepository repository = new EmployeeRepository(ConfigSettings.MySqlDatabaseConnectionName); List<EmployeeEntity> entities = EmployeeData.GetItemsForInsert(); repository.ClearCollection(); // Act entities = repository.Create(entities); // Assert Assert.IsNotNull(entities); Assert.AreEqual(2, entities.Count); }
public void ShouldReadEmployeeWithId() { // Arrange EmployeeRepository repository = new EmployeeRepository(ConfigSettings.MySqlDatabaseConnectionName); EmployeeEntity entity = EmployeeData.GetItemForInsert(); repository.ClearCollection(); // Act entity = repository.Create(entity); // Act var actual = repository.Read(entity.Id); // Assert Assert.AreEqual(entity.EntityId, actual.EntityId); }
public void ShouldUpdateEmployee() { // Arrange EmployeeRepository repository = new EmployeeRepository(ConfigSettings.MySqlDatabaseConnectionName); EmployeeEntity entity = EmployeeData.GetItemForInsert(); repository.ClearCollection(); entity = repository.Create(entity); entity.HasVehicle = true; // Act EmployeeEntity actual = repository.Update(entity); // Assert Assert.AreEqual(entity.HasVehicle, actual.HasVehicle); }