Exemplo n.º 1
0
        public void CalcAge_WithValidStringInput_ReturnsValidResult()
        {
            var expected = 3650;
            var input    = "10";
            var actual   = ageCalculator.CalcAge(input);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
 public IActionResult AddChef(Chef newChef)
 {
     if (ModelState.IsValid)
     {
         newChef.Age = AgeCalculator.CalcAge(newChef.DOB);
         dbContext.Add(newChef);
         dbContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View("NewChef"));
     }
 }
Exemplo n.º 3
0
    public void CalculateYourAge()
    {
        dayVal   = Convert.ToInt32(day.text);
        monthVal = Convert.ToInt32(month.text);
        yearVal  = Convert.ToInt32(year.text);

        otherDay = new DateTime(yearVal, monthVal, dayVal);
        if (otherDay == null)
        {
            Debug.Log("Failed");
        }
        else
        {
            otherText.text = ("Your age in days is " + calculator.CalcAge(otherDay).ToString());
        }
    }