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)); }
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); }