public void WhenInsertingEmployeeShouldSaveIt() { // Arrange const string ExpectedFirstName = "FirstName"; const string ExpectedLastName = "LastName"; var employeeRepository = new EntityRepository<Employee>(this.Context); var employee = CreateEmployee(ExpectedFirstName, ExpectedLastName); // Act var insertedEmployee = employeeRepository.Insert(employee); this.Context.SaveChanges(); var query = new EmployeeIdQuery(insertedEmployee.Id); var actual = employeeRepository.Single(query); // Assert Assert.IsNotNull(actual); Assert.AreEqual(ExpectedFirstName, actual.FirstName); Assert.AreEqual(ExpectedLastName, actual.LastName); }
public Employee SingleById(Guid id) { var query = new EmployeeIdQuery(id); return this.employeeRepository.Single(query, new[] { "Profile", "Profile.Bio" }); }
public void Delete(Employee entity) { var query = new EmployeeIdQuery(entity.Id); var entityToDelete = this.employeeRepository.Single(query); this.employeeRepository.Delete(entityToDelete); }