public void ShowCalculatorOnLineAction_Returns_View()
        {
            var model = new CalculatorItemModel();

            model.AddUtilitiesToCalculatorItemModel();

            Assert.IsTrue(model.Utilities.Count != 0);
        }
Exemple #2
0
        public ActionResult ShowCalculatorOnLine()
        {
            var model = new CalculatorItemModel();

            model.AddUtilitiesToCalculatorItemModel();

            return(View(model));
        }
Exemple #3
0
        public ActionResult CalculateCharges(CalculatorItemModel inputModel)
        {
            var model = new CalculatorItemModel();

            model.AddUtilitiesToCalculatorItemModel();

            if (ModelState.IsValid)
            {
                if (inputModel.ElectricUsage == 0 && inputModel.WaterUsage == 0 && inputModel.HeatUsage == 0 && inputModel.GasUsage == 0)
                {
                    ViewBag.ErrorMessage = Localization.YouMustEnterAtLeastOneUtilityUsage;

                    return(View("~/Views/Calculator/ShowCalculatorOnLine.cshtml", model));
                }

                model.CalculateCharges(inputModel);

                return(View("~/Views/Calculator/ShowCharges.cshtml", model));
            }

            return(View("~/Views/Calculator/ShowCalculatorOnLine.cshtml", model));
        }