Пример #1
0
        public void calculate_total_cost_with_only_evision_cost()
        {
            //Arrange
            var data = new MonthlyCost();
            data.EvisionCost = 2000;

            //Act
            var cost = data.TotalCost;

            //Assert
            Assert.AreEqual(2000, cost);
        }
Пример #2
0
        public void calculate_total_cost()
        {
            //Arrange
            var data = new MonthlyCost();
            data.EvisionCost = 2000;
            data.OtherCosts = 500;

            //Act
            var cost = data.TotalCost;

            //Assert
            Assert.AreEqual(2500,cost);
        }
Пример #3
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);
        }
Пример #4
0
        public void totaldays()
        {
            //Arrange
            var data = new MonthlyCost();
            data.ContractCosts = new List<ContractCost>();
            data.OverheadCosts = new List<OverheadCost>();
            data.ContractCosts.Add(new ContractCost() { Days = 5 });
            data.ContractCosts.Add(new ContractCost() { Days = 10 });
            data.OverheadCosts.Add(new OverheadCost() { Days = 5 });

            //Act
            var days = data.TotalDays;

            //Assert
            Assert.AreEqual(20, days);
        }
        public ActionResult Create(MonthlyCost monthlycost)
        {
            try
            {

                if (ModelState.IsValid)
                {
                    _unitOfWork.MonthlyCostRepository.Update(monthlycost);
                    _unitOfWork.Save();
                    return RedirectToAction("Index");
                }
            }
            catch (DataException)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem perisit please contact IT");
            }
            PopulateEmployeesDropDownList(monthlycost.EmployeeID);
            PopulatePeriodsDropDownList(monthlycost.PeriodID);
            return View(monthlycost);
        }
Пример #6
0
 public ActionResult Create(Period period)
 {
     if (ModelState.IsValid)
     {
         _unitOfWork.PeriodRepository.Insert(period);
         var employees = _unitOfWork.EmployeeRepository.Get(i => i.LeaveDate == null);
         foreach (var item in employees)
         {
             MonthlyCost monthlyCost = new MonthlyCost
             {
                 Employee = item,
                 Period = period
             };
             _unitOfWork.MonthlyCostRepository.Insert(monthlyCost);
         }
         _unitOfWork.Save();
         return RedirectToAction("Index");
     }
     return View(period);
 }
Пример #7
0
        public void totaldays_overhead_only()
        {
            //Arrange
            var data = new MonthlyCost();
            data.OverheadCosts = new List<OverheadCost>();
            data.OverheadCosts.Add(new OverheadCost() { Days = 10 });
            data.OverheadCosts.Add(new OverheadCost() { Days = 15 });

            //Act
            var days = data.TotalDays;

            //Assert
            Assert.AreEqual(25, days);
        }
Пример #8
0
        public void totaldays_contract_only()
        {
            //Arrange
            var data = new MonthlyCost();
            data.ContractCosts = new List<ContractCost>();
            data.ContractCosts.Add(new ContractCost() { Days = 10 });
            data.ContractCosts.Add(new ContractCost() { Days = 15 });

            //Act
            var days = data.TotalDays;

            //Assert
            Assert.AreEqual(25, days);
        }