예제 #1
0
        private EmployeeDetail CreateMonthlySalaryEmployee(EmployeeExternal employeeExternal)
        {
            var salary = new Money(employeeExternal.MonthlySalary, Currency.USD);
            MonthlySalaryContract monthlySalaryContract = new MonthlySalaryContract(salary);

            return(new EmployeeDetail(employeeExternal.Id, employeeExternal.Name, string.Empty, monthlySalaryContract.TypeContract, monthlySalaryContract.Salary, monthlySalaryContract.AnnualSalary, employeeExternal.RoleName, employeeExternal.RoleDescription));
        }
        public void MonthlySalaryContract_Case_TypeContract()
        {
            string typeContract = TypeContract.MonthlySalary;
            var    salary       = new Money(10_500m, Currency.USD);

            var monthlySalaryContract = new MonthlySalaryContract(salary);

            Assert.AreEqual(typeContract, monthlySalaryContract.TypeContract);
        }
        public void MonthlySalaryContract_Case_CalculatedAnnualSalary()
        {
            var expected = new Money(150_000m, Currency.USD);
            var salary   = new Money(12_500m, Currency.USD);
            var monthlySalaryContract = new MonthlySalaryContract(salary);

            var annualSalary = monthlySalaryContract.CalculatedAnnualSalary();

            Assert.AreEqual(expected, annualSalary);
        }
예제 #4
0
        public override void Create(RequestEmployee requestEmployee)
        {
            var requestEmployeeMonthlySalary = new RequestEmployeeMonthlySalary(requestEmployee);

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

            var monthlySalaryContract = new MonthlySalaryContract(salary);

            var employee = new Employee(requestEmployeeMonthlySalary.Name, requestEmployee.LastName, monthlySalaryContract.TypeContract, monthlySalaryContract.Salary, monthlySalaryContract.AnnualSalary, requestEmployeeMonthlySalary.IdRole);

            _employeeService.Save(employee);
        }
예제 #5
0
        public void Employee_Case_newEmployee()
        {
            string name           = "Alan";
            string lastName       = "Turing";
            var    salary         = new Money(5_000m, Currency.USD);
            var    salaryContract = new MonthlySalaryContract(salary);
            var    employee       = new Employee(name, lastName, salaryContract.TypeContract, salary, salaryContract.AnnualSalary, 2);

            Assert.AreEqual(name, employee.Name);
            Assert.AreEqual(lastName, employee.LastName);
            Assert.AreEqual(new Money(60_000m, Currency.USD), employee.AnnualSalary);
            Assert.AreEqual(salary, employee.Salary);
            Assert.AreEqual(salaryContract.TypeContract, employee.TypeContract);
            Assert.AreEqual(2, employee.IdRole);
        }