public void GetById_NullEmployeeId_ReturnsNull() { // Arrange var logger = new Mock <ILogger <IReportingStructureService> >(); var employeeRepository = new Mock <IEmployeeRepository>(); // Execute var reportingStructure = new ReportingStructureService(logger.Object, employeeRepository.Object).GetById(null); // Assert reportingStructure.Should().BeNull(); }
public void GetById_ValidEmployeeId_ReturnsReportingStructure() { // Arrange const int expectedNumberOfReports = 4; var logger = new Mock <ILogger <IReportingStructureService> >(); var employeeRepository = new Mock <IEmployeeRepository>(); employeeRepository.Setup(repository => repository.GetById(_expectedEmployee.EmployeeId)) .Returns(_expectedEmployee); // Execute var reportingStructure = new ReportingStructureService(logger.Object, employeeRepository.Object).GetById(_expectedEmployee.EmployeeId); // Assert reportingStructure.Should().NotBeNull(); reportingStructure.Employee.FirstName.Should().Be(_expectedEmployee.FirstName); reportingStructure.Employee.LastName.Should().Be(_expectedEmployee.LastName); reportingStructure.NumberOfReports.Should().Be(expectedNumberOfReports); }