public IHttpActionResult GetCostPreview(Employee employee)
        {
            var employeeBenefit = new EmployeeBenefitCalculator(employee);

            var result = employeeBenefit.CalculateEmployeeBenefitCost() + employeeBenefit.CalculateDepedentBenefitCost();

            return(Ok(result));
        }
        public void CalculateDependentEmployeeBenefitCost_WhenNoDependents_ReturnsZero()
        {
            var employee = EmployeeBuilder.DefaultEmployee().Build();

            var employeeBenefit = new EmployeeBenefitCalculator(employee);

            var result = employeeBenefit.CalculateDepedentBenefitCost();

            Assert.That(result, Is.EqualTo(0m));
        }
        public void CalculateEmployeeBenefitCost_WhenNameStartsWithA_ReturnsAdjustedCost()
        {
            var employee = EmployeeBuilder.DefaultEmployee().WithAFirstName().Build();

            var employeeBenefit = new EmployeeBenefitCalculator(employee);

            var result = employeeBenefit.CalculateEmployeeBenefitCost();

            var expected = EmployeeCost * AdjustmentRate;

            Assert.That(result, Is.EqualTo(expected));
        }
        public void CalculateDependentEmployeeBenefitCost_WithOneDependent_Returns500()
        {
            var employee = EmployeeBuilder
                           .DefaultEmployee()
                           .AddDependent()
                           .Build();

            var employeeBenefit = new EmployeeBenefitCalculator(employee);

            var result = employeeBenefit.CalculateDepedentBenefitCost();

            Assert.That(result, Is.EqualTo(DependentCost));
        }
        public void CalculateDependentEmployeeBenefitCost_WithDependentStartsWithA_ReturnsAdjustedValue()
        {
            var employee = EmployeeBuilder
                           .DefaultEmployee()
                           .AddDependentThatStartsWithA()
                           .Build();

            var employeeBenefit = new EmployeeBenefitCalculator(employee);

            var result   = employeeBenefit.CalculateDepedentBenefitCost();
            var expected = DependentCost * AdjustmentRate;

            Assert.That(result, Is.EqualTo(expected));
        }
        public void GetPayChecks_EmployeeWithNoDependents_RetunsCorrectAmount()
        {
            var employee = EmployeeBuilder
                           .DefaultEmployee()
                           .Build();

            var employeeBenefit = new EmployeeBenefitCalculator(employee);

            var result = employeeBenefit.GetPayChecksForYear();

            var expected = ((EmployeeSalary * PayCheckCount - EmployeeCost));

            Assert.That(result.Sum(), Is.EqualTo(expected));
        }
        public void GetPayChecks_EmployeeWithAName_ReturnsCorrectAmount()
        {
            var employee = EmployeeBuilder
                           .DefaultEmployee()
                           .WithAFirstName()
                           .Build();

            var employeeBenefit = new EmployeeBenefitCalculator(employee);

            var result = employeeBenefit.GetPayChecksForYear();

            var expected = (EmployeeSalary * PayCheckCount - (EmployeeCost * AdjustmentRate));

            Assert.That(result.Sum(), Is.EqualTo(expected));
        }