public void InsPlan_GetDedRemainDisplay_IndividualAndFamilyDeductiblesInsRemaining() { string suffix = "20"; Patient pat = PatientT.CreatePatient(suffix); //guarantor long patNum = pat.PatNum; Patient pat2 = PatientT.CreatePatient(suffix); PatientT.SetGuarantor(pat2, pat.PatNum); Patient pat3 = PatientT.CreatePatient(suffix); PatientT.SetGuarantor(pat3, pat.PatNum); Carrier carrier = CarrierT.CreateCarrier(suffix); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum); long planNum = plan.PlanNum; InsSub sub = InsSubT.CreateInsSub(pat.PatNum, planNum); //guarantor is subscriber long subNum = sub.InsSubNum; PatPlan patPlan = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum); //all three patients have the same plan PatPlan patPlan2 = PatPlanT.CreatePatPlan(1, pat2.PatNum, subNum); //all three patients have the same plan PatPlan patPlan3 = PatPlanT.CreatePatPlan(1, pat3.PatNum, subNum); //all three patients have the same plan BenefitT.CreateDeductibleGeneral(planNum, BenefitCoverageLevel.Individual, 75); BenefitT.CreateDeductibleGeneral(planNum, BenefitCoverageLevel.Family, 150); ClaimProcT.AddInsUsedAdjustment(pat3.PatNum, planNum, 0, subNum, 75); //Adjustment goes on the third patient Procedure proc = ProcedureT.CreateProcedure(pat2, "D2750", ProcStat.C, "20", 1280); //proc for second patient with a deductible already applied. ClaimProcT.AddInsPaid(pat2.PatNum, planNum, proc.ProcNum, 304, subNum, 50, 597); proc = ProcedureT.CreateProcedure(pat, "D4355", ProcStat.TP, "", 135); //proc is for the first patient long procNum = proc.ProcNum; //Lists List <ClaimProc> claimProcs = ClaimProcs.Refresh(patNum); Family fam = Patients.GetFamily(patNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(patNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <ClaimProcHist> histList = ClaimProcs.GetHistList(patNum, benefitList, patPlans, planList, DateTime.Today, subList); List <ClaimProcHist> loopList = new List <ClaimProcHist>(); //Validate List <ClaimProcHist> HistList = ClaimProcs.GetHistList(pat.PatNum, benefitList, patPlans, planList, DateTime.Today, subList); double dedFam = Benefits.GetDeductGeneralDisplay(benefitList, planNum, patPlan.PatPlanNum, BenefitCoverageLevel.Family); double ded = Benefits.GetDeductGeneralDisplay(benefitList, planNum, patPlan.PatPlanNum, BenefitCoverageLevel.Individual); double dedRem = InsPlans.GetDedRemainDisplay(HistList, DateTime.Today, planNum, patPlan.PatPlanNum, -1, planList, pat.PatNum, ded, dedFam); //test family and individual deductible together Assert.AreEqual(25, dedRem); dedRem = InsPlans.GetDedRemainDisplay(HistList, DateTime.Today, planNum, patPlan.PatPlanNum, -1, planList, pat.PatNum, ded, -1); //test individual deductible by itself Assert.AreEqual(75, dedRem); }