Пример #1
0
        public BenefitResults CalculateBenefits(string employee, IList<string> dependents)
        {
            BenefitDecorator bd = new ANameDecorator(_benefitBase, employee);

            foreach (var d in dependents)
            {
                if (!String.IsNullOrEmpty(d))
                {
                    bd = new ANameDecorator(new DependentDecorator(bd), d);
                }
            }

            decimal benefitYear = bd.GetCost();
            decimal totalYear = benefitYear + _salary;

            return new BenefitResults
                {
                    BenefitYear = benefitYear,
                    BenefitCheck = decimal.Round(benefitYear / _payPeriods, 2),
                    TotalYear = totalYear,
                    TotalCheck = decimal.Round(totalYear / _payPeriods, 2)
                };
        }
Пример #2
0
        public void Calc_1_Dependent_1_ANameDecorator_AName()
        {
            BenefitBase bb = new BenefitBase(_benefitRepository);

            DependentDecorator dd = new DependentDecorator(bb);

            ANameDecorator ad = new ANameDecorator(dd, "xdfsde tttreeee Areess");

            Assert.AreEqual(ad.GetCost(), 1350M);
        }
Пример #3
0
        public void Calc_1_ANameDecorator_NonA()
        {
            BenefitBase bb = new BenefitBase(_benefitRepository);

            ANameDecorator ad = new ANameDecorator(bb, "tudfjf gdgfsd");

            Assert.AreEqual(ad.GetCost(), _baseCost);
        }
Пример #4
0
        public void Calc_1_ANameDecorator_LowerA_LastName()
        {
            BenefitBase bb = new BenefitBase(_benefitRepository);

            ANameDecorator ad = new ANameDecorator(bb, "asdfbert afjkddd");

            Assert.AreEqual(ad.GetCost(), 900M);
        }
Пример #5
0
        public void Calc_1_ANameDecorator_CapitalA_LastName()
        {
            BenefitBase bb = new BenefitBase(_benefitRepository);

            ANameDecorator ad = new ANameDecorator(bb, "bblbert Asdfasdf");

            Assert.AreEqual(ad.GetCost(), 900M);
        }