public Compensation GetByEmployeeId(string employeeId)
 {
     if (!string.IsNullOrEmpty(employeeId))
     {
         return(_compensationRepository.GetById(employeeId));
     }
     return(null);
 }
 public Compensation GetById(string id)
 {
     if (!String.IsNullOrEmpty(id))
     {
         return(_compensationRepository.GetById(id));
     }
     return(null);
 }
Exemple #3
0
        public List <Compensation> GetByEmployeeId(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                return(_compensationRepository.GetById(id).ToList());
            }

            return(null);
        }
Exemple #4
0
        public Compensation GetById(string id)
        {
            _logger.LogDebug($"Retrieving compensation. Id:{id}");
            if (!string.IsNullOrEmpty(id))
            {
                return(_compensationRepository.GetById(id));
            }

            _logger.LogDebug($"Unable to find compensation. Id:{id}");
            return(null);
        }
        public void GetById_Return_Compensation()
        {
            // Arrange
            Employee testEmployee = new Employee
            {
                EmployeeId    = "C32A28E2-2311-4F5E-B024-7D2E43F3FBB7",
                FirstName     = "Billy",
                LastName      = "Corgan",
                Department    = "Engineering",
                Position      = "Intern",
                DirectReports = new List <Employee>()
            };

            DateTime     localDateTime    = new DateTime(2020, 12, 23, 16, 36, 0);
            Compensation testCompensation = new Compensation
            {
                Employee      = testEmployee,
                EffectiveDate = localDateTime.ToUniversalTime(),
                Salary        = 40000
            };

            _compensationRepository.GetById("C32A28E2-2311-4F5E-B024-7D2E43F3FBB7").Returns(testCompensation);

            //Act
            Compensation actual = _compensationService.GetById("C32A28E2-2311-4F5E-B024-7D2E43F3FBB7");

            //Assert
            Assert.AreEqual(testCompensation.Salary, actual.Salary);
            Assert.AreEqual(testCompensation.EffectiveDate, actual.EffectiveDate);
            Assert.AreEqual(testCompensation.Employee.EmployeeId, actual.Employee.EmployeeId);
            Assert.AreEqual(testCompensation.Employee.FirstName, actual.Employee.FirstName);
            Assert.AreEqual(testCompensation.Employee.LastName, actual.Employee.LastName);
            Assert.AreEqual(testCompensation.Employee.Department, actual.Employee.Department);
            Assert.AreEqual(testCompensation.Employee.Position, actual.Employee.Position);
            Assert.IsNotNull(actual.Employee.DirectReports);
        }