public static CompensationSummaryRequestContract GetCompensationSummaryRequestContract() { return(new CompensationSummaryRequestContract { NumberOfPaychecks = 26, Employee = EmployeeContractData.GetEmployeeContractExpectedDiscount() }); }
public void TestCheckIfApplicable_IsNotApplicable() { var employee = EmployeeContractData.GetEmployeeContractNoExpectedDiscount(); var isApplicable = _nameDiscount.CheckIfApplicable(employee); Assert.IsFalse(isApplicable); }
public void TestCalculateValue() { var employee = EmployeeContractData.GetEmployeeContractExpectedDiscount(); var discountValue = _nameDiscount.CalculateValue(employee); var expectedValue = decimal.Round(employee.AnnualElectedBenefitsCost * NameDiscount.NAME_DISCOUNT_PERCENTAGE, 2, MidpointRounding.AwayFromZero); Assert.AreEqual(expectedValue, discountValue); }
public void TestCalculateEmployeeDependentPaycheckDeduction() { var employee = EmployeeContractData.GetEmployeeContractNoExpectedDiscount().WithDependentNoExpectedDiscount(); var numberOfPaychecks = 26; var deduction = _deductionCalculators.CalculateEmployeeDependentPaycheckDeduction(employee.Dependents.First(), numberOfPaychecks); var expectedDeduction = decimal.Round(employee.Dependents.First().AnnualElectedBenefitsCost / numberOfPaychecks, 2, MidpointRounding.AwayFromZero); Assert.AreEqual(expectedDeduction, deduction); }
public void CalculateBeneficiaryDiscountPaycheckValue_WithNoDiscount() { var randomDiscount = 0m; _mockDiscount.Setup(x => x.CalculateValue(It.IsAny <BeneficiaryContract>())).Returns(randomDiscount); _mockDiscount.Setup(x => x.CheckIfApplicable(It.IsAny <BeneficiaryContract>())).Returns(false); var employee = EmployeeContractData.GetEmployeeContractNoExpectedDiscount(); var numberOfPaychecks = 26; var discount = _discountCalculators.CalculateBeneficiaryDiscountPaycheckValue(employee, new List <IDiscount> { _mockDiscount.Object }, numberOfPaychecks); var expectedDiscount = decimal.Round(randomDiscount / numberOfPaychecks, 2, MidpointRounding.AwayFromZero); Assert.AreEqual(expectedDiscount, discount); _mockDiscount.Verify(x => x.CheckIfApplicable(It.IsAny <BeneficiaryContract>()), Times.Once); _mockDiscount.Verify(x => x.CalculateValue(It.IsAny <BeneficiaryContract>()), Times.Never); }