public void CopyToTest() { DateTime currentCalendarYear = Now.CalendarYear; DateTime previousCalendarYear = currentCalendarYear.AddYears(-1); DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet(); dateTimeSet.Add(nextCalendarYear); dateTimeSet.Add(currentCalendarYear); dateTimeSet.Add(previousCalendarYear); DateTime[] array = new DateTime[3]; dateTimeSet.CopyTo(array, 0); Assert.Equal(array[0], previousCalendarYear); Assert.Equal(array[1], currentCalendarYear); Assert.Equal(array[2], nextCalendarYear); } // CopyToTest
public void CopyToTest() { DateTime currentCalendarYear = TimeTool.CurrentCalendarYear; DateTime previousCalendarYear = currentCalendarYear.AddYears(-1); DateTime nextCalendarYear = currentCalendarYear.AddYears(1); DateTimeSet dateTimeSet = new DateTimeSet { nextCalendarYear, currentCalendarYear, previousCalendarYear }; DateTime[] array = new DateTime[3]; dateTimeSet.CopyTo(array, 0); Assert.AreEqual(array[0], previousCalendarYear); Assert.AreEqual(array[1], currentCalendarYear); Assert.AreEqual(array[2], nextCalendarYear); }