/// <summary> /// The method to determine the day number of the year for a day/month/year /// </summary> /// <param name="day">The day of the month to calculated.</param> /// <param name="month">The month to calculated.</param> /// <param name="year">The year to calculated.</param> /// <returns>The day number 1 Jan is day 1,</returns> internal static int DayNumber(int day, int month, int year) { int total = 0; if (DateCalculator.DateValid(day, month, year)) { for (int index = 1; index < month; index++) { total += DateCalculator.DaysPerMonth(index, year); } total += day; } return(total); }
public void DateCalculatorVerifyDateValid(int year, int month, int day, bool expectedValid) { bool valid = DateCalculator.DateValid(day, month, year); Assert.AreEqual(expectedValid, valid, "Verify that the DateValid the expected value for month ", month); }