public void CalculateYoungsterAdding()
        {
            InsuranceCalculator test = new InsuranceCalculator(DateTime.Parse("2000-5-13"), 1000, false, 0);
            double result            = test.CalculateInsurance();

            Assert.AreEqual(result, 27, 5);
        }
        public void CalculateComprehensiveCover()
        {
            InsuranceCalculator test = new InsuranceCalculator(DateTime.Parse("1990-5-13"), 1000, true, 0);
            double result            = test.CalculateInsurance();

            Assert.AreEqual(result, 40);
        }
        public void CalculateThirdPartyCover()
        {
            InsuranceCalculator test = new InsuranceCalculator(DateTime.Parse("1990-5-13"), 1000, false, 0);
            double result            = test.CalculateInsurance();

            Assert.AreEqual(result, 25);
        }
        public void CalculateUnderAge()
        {
            InsuranceCalculator test = new InsuranceCalculator(DateTime.Parse("2005-5-13"), 1000, true, 0);
            double result            = test.CalculateInsurance();

            Assert.AreEqual(result, -1);
        }
        public void CalculateExtraCharge(int penaltyPoints, int expected)
        {
            InsuranceCalculator test = new InsuranceCalculator(DateTime.Parse("1990-5-13"), 1000, false, penaltyPoints);

            Assert.AreEqual(test.CalculateInsurance(), expected);
        }
示例#6
0
 public ActionResult Result(InsuranceCalculator ins)
 {
     ViewBag.Title   = "This is the Paycheck ;)";
     ViewBag.Message = ins.CalculateInsurance().ToString();
     return(View(ins));
 }