public void CheckComputeMaturity() { PolicyBL policyBL = new PolicyBL(); List <Policy> policies = new List <Policy>() { new Policy() { PolicyNumber = "A1200", StartDate = DateTime.Parse("01/06/1986"), Premium = 1000, Membership = true, DiscretionaryBonus = 1000, UpliftPercentage = 40 } }; policyBL.ComputeMaturity(policies); Assert.AreNotEqual(policies[0].Maturity, decimal.MinValue); }
/// <summary> /// Action does the Policy maturity calculation for input data received by CSV /// </summary> /// <returns>Confirmation Message</returns> public ActionResult Assessment() { try { string inputFile = Server.MapPath(ConstantVariables.inputFilePath); string outputXMLFile = Server.MapPath(ConstantVariables.outputXMLFilePath); PolicyBL policyBL = new PolicyBL(); //Read input CSV and get the equivalent policy list List <Policy> policies = policyBL.PopulatePolicyFromCSV(inputFile); if (policies != null) { //Compute Maturity for policy list based on business logic policyBL.ComputeMaturity(policies); //Write a xml file for computed maturity policy list new XMLWriter().WriteXML(policies, outputXMLFile); } } catch (Exception ex) { Log.Error("Exception on Home controller Assessment action", ex); } return(View()); }