コード例 #1
0
        public void AddPlanTest()
        {
            InsurancePlan plan = mgr.GetPlanByType("Basic");

            plan.Type = "NewType";

            mgr.AddPlan(plan);

            plan = mgr.GetPlanByType("NewType");

            Assert.IsNotNull(plan);
            Assert.AreEqual("NewType", plan.Type);
        }
コード例 #2
0
        /// <summary>
        /// Creates a plan and then sends to DbMgr to be saved
        /// </summary>
        /// <param name="name"></param>
        /// <param name="PYMB"></param>
        /// <param name="APD"></param>
        /// <param name="OPMI"></param>
        /// <param name="OPMF"></param>
        /// <param name="priamryFee"></param>
        /// <param name="dependentFee"></param>
        /// <param name="primaryChange"></param>
        /// <param name="dependentChange"></param>
        /// <param name="optional"></param>
        /// <returns></returns>
        public bool CreatePlan(String name, double PYMB, double APD, double OPMI,
                               double OPMF, double primaryFee, double dependentFee,
                               double primaryChange, double dependentChange, bool optional,
                               List <Service> serviceList)
        {
            List <InsurancePlan> plans = (List <InsurancePlan>)Mgr.GetPlans();

            //error checking here
            if (name != null && name != "" && PYMB >= 0 && APD >= 0 && OPMI >= 0 && OPMF >= 0 &&
                primaryChange >= 0 && dependentChange >= 0)
            {
                foreach (var item in plans)
                {
                    if (name.Equals(item.Type))
                    {
                        return(false);
                    }
                }
                // create a new insurance plan
                InsurancePlan plan = new InsurancePlan
                {
                    Type               = name,
                    PYMB               = PYMB,
                    APD                = APD,
                    OPMIndividual      = OPMI,
                    OPMFamily          = OPMF,
                    PrimaryFee         = primaryFee,
                    DependentFee       = dependentFee,
                    PrimaryChangeFee   = primaryChange,
                    DependentChangeFee = dependentChange,
                    Optional           = optional,
                    ServiceCosts       = serviceList
                };

                Mgr.AddPlan(plan);

                return(true);
            }

            else
            {
                return(false);
            }
        }