public void SetEmployees_RequestNotExistingEmployees_SetsEmployeesInRepository() { // arrange Mock<IRepository> mockedRepository = CreateMockedRepository(); var service = new EmployeeService(mockedRepository.Object); const int employeeId1 = 23; const int employeeId2 = 24; var employeeInfos = new [] { new EmployeeInfo { Id = employeeId1 }, new EmployeeInfo { Id = employeeId2 }, }; // act service.SetEmployees(employeeInfos); // assert mockedRepository.Verify(p => p.SetEmployeeBatch(It.Is<IEnumerable<Employee>>(es => es.Count() == 2))); }
public void SetEmployees_EmployeesNullReference_ThrowsException() { // arrange Mock<IRepository> mockedRepository = CreateMockedRepository(); var service = new EmployeeService(mockedRepository.Object); // act service.SetEmployees(null); }