public void IndexPostTest()
        {
            var calcService = new CalcService();
            var controller = new HomeController();
            var model = new HomeModel();
            model.Number = "";
            ErrorTest(controller.Index(model) as PartialViewResult);

            model.Number = "asdf";
            ErrorTest(controller.Index(model) as PartialViewResult);

            model.Number = "-1";
            ErrorTest(controller.Index(model) as PartialViewResult);

            model.Number = "0";
            ErrorTest(controller.Index(model) as PartialViewResult);

            model.Number = "1.001";
            ErrorTest(controller.Index(model) as PartialViewResult);

            model.Number = "16";
            var result = controller.Index(model) as PartialViewResult;
            model = result.Model as HomeModel;
            Assert.IsNotNull(result);
            Assert.IsTrue(result.ViewData.ModelState.IsValid);
            Assert.AreEqual("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16", model.AllNumbers);
            Assert.AreEqual("1, 3, 5, 7, 9, 11, 13, 15", model.OddNumbers);
            Assert.AreEqual("2, 4, 6, 8, 10, 12, 14, 16", model.EvenNumbers);
            Assert.AreEqual("1, 2, C, 4, E, C, 7, 8, C, E, 11, C, 13, 14, Z, 16", model.SubstitutedNumbers);
            Assert.AreEqual("1, 1, 2, 3, 5, 8, 13", model.FibonacciNumbers);
        }
        public async Task<ActionResult> Calculate(HomeModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            try
            {
                model.Result = await GetAllSequences(model.InputNumber);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
            }

            return View(model);
        }
 public ActionResult Calculate()
 {
     HomeModel model = new HomeModel();
     return View(model);
 }