public void SetReservationsOfEmployee_RequestsNotExistingEmployeeId_ThrowsException() { // arrange Mock<IRepository> mockedRepository = CreateMockedRepository(); var service = new EmployeeReservationService(mockedRepository.Object); var reservations = new[] { new ReservationInfo { CustomerId = 1, Start = new DateTime(2013, 1, 1), End = new DateTime(2013, 1, 2) } }; // act service.SetReservationsOfEmployee(0, reservations); }
public void SetReservationsOfEmployee_ReservationsNullReference_ThrowsException() { // arrange Mock<IRepository> mockedRepository = CreateMockedRepository(); var service = new EmployeeReservationService(mockedRepository.Object); // act service.SetReservationsOfEmployee(1, null); }
public void SetReservationsOfEmployee_RequestsExistingEmployeeId_SetsEmployeeWithReservationsInRepository() { // arrange Mock<IRepository> mockedRepository = CreateMockedRepository(); var service = new EmployeeReservationService(mockedRepository.Object); var reservations = new[] { new ReservationInfo { CustomerId = 1, Start = new DateTime(2013, 1, 1), End = new DateTime(2013, 1, 2) } }; // act service.SetReservationsOfEmployee(1, reservations); // assert mockedRepository.Verify(p => p.SetEmployee(It.Is<Employee>(e => e.Reservations.Count() == 1))); }