Exemplo n.º 1
0
 public IActionResult Index(FirstResponsiveWebAppModel model)
 {
     if (ModelState.IsValid)
     {
         ViewBag.Name = model.Name;
         ViewBag.Age  = model.AgeThisYear();
     }
     else
     {
         ViewBag.Name = "";
         ViewBag.Age  = 0;
     }
     return(View(model));
 }
Exemplo n.º 2
0
        public void AgeByEndOfYear()
        {
            //Arrange
            int birthYear = 1987;

            int expected = 34;
            int actual;

            //act
            FirstResponsiveWebAppModel nick = new FirstResponsiveWebAppModel
            {
                BirthYear = birthYear
            };

            actual = nick.AgeThisYear();

            //assert
            Assert.Equal(expected, actual);
        }