public void CalcAge_WithValidStringInput_ReturnsValidResult() { var expected = 3650; var input = "10"; var actual = ageCalculator.CalcAge(input); Assert.AreEqual(expected, actual); }
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")); } }
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()); } }