public void PassAgeAtEndOfYear()
        {
            // Tests a birthdate of 12/31/2021 with method AgeByEndOfYear()
            // Arrange
            AgeModel age = new AgeModel();

            age.BirthDate = new DateTime(2021, 12, 31, 12, 0, 0);
            int expected = 0;

            // Act
            int actual = age.AgeByEndOfYear();

            // Assert
            Assert.Equal(actual, expected);
        }
 public IActionResult Index(AgeModel model)
 {
     if (ModelState.IsValid)                              // Check valid state
     {
         ViewBag.Age            = model.AgeThisYear();    // Call AgeThisYear() function and assign
         ViewBag.AgeAtEndOfYear = model.AgeByEndOfYear(); // Call AgeByEndOfYear() function and assign
         ViewBag.Name           = model.Name;             // Assign name
     }
     else // Assign defaults
     {
         ViewBag.Age            = 0;
         ViewBag.AgeAtEndOfYear = 0;
         ViewBag.Name           = "";
     }
     return(View(model));
 }