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 void ContactTest()
 {
     var calcService = new CalcService();
     var controller = new HomeController();
     var result = controller.Contact() as ViewResult;
     var message = result.ViewData["Message"].ToString();
     Assert.IsNotNull(result);
     Assert.AreEqual("My contact details.", message);
 }
 public void AboutTest()
 {
     var calcService = new CalcService();
     var controller = new HomeController();
     var result = controller.About() as ViewResult;
     var message = result.ViewData["Message"].ToString();
     Assert.IsNotNull(result);
     Assert.AreEqual("How to use this calculator.", message);
 }