コード例 #1
0
        public void calculate_bonus_provision()
        {
            //Arrange
            BonusPercentage bonusPercentage = new BonusPercentage();
            bonusPercentage.Percentage = 0.05M;
            Employee employee = new Employee();
            employee.Rate = 25000;
            var data = new MonthlyCost();
            data.Employee = employee;
            //Act
            var result = data.BonusProvision(bonusPercentage);

            //Assert
            Assert.AreEqual(104.17M, result);
        }
コード例 #2
0
        public ActionResult Edit(Employee employee)
        {
            try
            {

                if (ModelState.IsValid)
                {
                    _unitOfWork.EmployeeRepository.Update(employee);
                    _unitOfWork.Save();
                    return RedirectToAction("Index");
                }
            }
            catch (DataException)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem perisit please contact IT");
            }
            PopulateCarGradesDropDownList(employee.CarGradeID);
            PopulatePensionsDropDownList(employee.PensionID);
            PopulateBupaRatesDropDownList(employee.BupaRateID);
            return View(employee);
        }