Esempio n. 1
0
 public IResult ActivateEmployee(IActivateEmployeeParameters values)
 {
     try
     {
         return(_employeesServiceProvider.ActivateEmployee(values));
     }
     catch (Exception ex)
     {
         _exceptionLogger.LogException(ex);
         return(new FailureResult(""));
     }
 }
Esempio n. 2
0
        public IResult ActivateEmployee(IActivateEmployeeParameters values)
        {
            var employeeKey = KeyParserHelper.ParseResult <IEmployeeKey>(values.EmployeeKey);
            var employee    = _coreUnitOfWork.EmployeesRepository.FindBy(e => e.EmployeeId.Equals(employeeKey.ResultingObject.EmployeeKey_Id));

            if (employee == null)
            {
                return(new InvalidResult <IEmployeeDetailsReturn>(null, string.Format(UserMessages.EmployeeByKeyNotFound, values.EmployeeKey)));
            }

            employee.EmailAddress = values.EmailAddress;
            employee.IsActive     = true;
            _coreUnitOfWork.Commit();
            return(new SuccessResult("Employee activated successfully."));
        }
            public void SetsEmployeeEmailAddress_IfEmployeeKeyIsProvided()
            {
                // Arrange
                IActivateEmployeeParameters actualUpdateValues = null;

                MockEmployeesService.Setup(m => m.ActivateEmployee(It.IsAny <IActivateEmployeeParameters>()))
                .Callback((IActivateEmployeeParameters input) => actualUpdateValues = input)
                .Returns(new SuccessResult());

                // Act
                SystemUnderTest.Register(RegisterParameters);

                // Assert
                Assert.IsNotNull(actualUpdateValues);
                Assert.AreEqual(RegisterParameters.Email, actualUpdateValues.EmailAddress);
                MockEmployeesService.Verify(m => m.ActivateEmployee(It.IsAny <IActivateEmployeeParameters>()), Times.Once());
            }