public void HourlySalary_Case_TypeContract()
        {
            string typeContract = TypeContract.HourlySalary;
            var    salary       = new Money(1_150m, Currency.USD);

            var hourlySalary = new HourlySalaryContract(salary);

            Assert.AreEqual(typeContract, hourlySalary.TypeContract);
        }
Esempio n. 2
0
        private EmployeeDetail CreateHourlySalaryEmployee(EmployeeExternal employeeExternal)
        {
            var hourlySalaryBase     = new Money(employeeExternal.HourlySalary, Currency.USD);
            var hourlySalaryContract = new HourlySalaryContract(hourlySalaryBase);

            return(new EmployeeDetail(employeeExternal.Id, employeeExternal.Name, string.Empty,
                                      hourlySalaryContract.TypeContract, hourlySalaryContract.Salary,
                                      hourlySalaryContract.AnnualSalary, employeeExternal.RoleName, employeeExternal.RoleDescription));
        }
        public void HourlySalary_Case_CalculatedAnnualSalary()
        {
            var expected     = new Money(1_656_000m, Currency.USD);
            var salary       = new Money(1_150m, Currency.USD);
            var hourlySalary = new HourlySalaryContract(salary);

            var annualSalary = hourlySalary.CalculatedAnnualSalary();

            Assert.AreEqual(expected.Amount, annualSalary.Amount);
            Assert.AreEqual(expected.Currency, annualSalary.Currency);
        }
        public override void Create(RequestEmployee requestEmployee)
        {
            var requestEmployeeHourlySalary = new RequestEmployeeHourlySalary(requestEmployee);

            var salary = new Money(requestEmployeeHourlySalary.Amount, Currency.USD);

            var hourlySalaryContract = new HourlySalaryContract(salary);

            Employee employee = new Employee(requestEmployeeHourlySalary.Name, requestEmployeeHourlySalary.LastName, hourlySalaryContract.TypeContract, hourlySalaryContract.Salary, hourlySalaryContract.AnnualSalary, requestEmployeeHourlySalary.IdRole);

            _employeeService.Save(employee);
        }