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);
        }
        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);
        }
        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);
        }
        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);
        }
 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);
 }
        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);
        }
        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);
        }