Exemplo n.º 1
0
        public void FindNextTest()
        {
            DateTime now = ClockProxy.Clock.Now;
            DateTime currentCalendarYear = Now.CalendarYear;
            DateTime nextCalendarYear    = currentCalendarYear.AddYears(1);

            DateTimeSet dateTimeSet = new DateTimeSet();

            Assert.Null(dateTimeSet.FindNext(now));

            dateTimeSet.Add(currentCalendarYear);
            Assert.Null(dateTimeSet.FindNext(now));

            dateTimeSet.Add(nextCalendarYear);
            Assert.Equal(dateTimeSet.FindNext(now), nextCalendarYear);
            Assert.Equal(dateTimeSet.FindNext(currentCalendarYear), nextCalendarYear);

            dateTimeSet.Remove(currentCalendarYear);
            Assert.Equal(dateTimeSet.FindNext(now), nextCalendarYear);

            dateTimeSet.Remove(nextCalendarYear);
            Assert.Null(dateTimeSet.FindNext(now));
        }         // FindNextTest
Exemplo n.º 2
0
        public void FindNextTest() {
            DateTime now = ClockProxy.Clock.Now;
            DateTime currentCalendarYear = TimeTool.CurrentCalendarYear;
            DateTime nextCalendarYear = currentCalendarYear.AddYears(1);

            DateTimeSet dateTimeSet = new DateTimeSet();
            Assert.AreEqual(dateTimeSet.FindNext(now), null);

            dateTimeSet.Add(currentCalendarYear);
            Assert.AreEqual(dateTimeSet.FindNext(now), null);

            dateTimeSet.Add(nextCalendarYear);
            Assert.AreEqual(dateTimeSet.FindNext(now), nextCalendarYear);
            Assert.AreEqual(dateTimeSet.FindNext(currentCalendarYear), nextCalendarYear);

            dateTimeSet.Remove(currentCalendarYear);
            Assert.AreEqual(dateTimeSet.FindNext(now), nextCalendarYear);

            dateTimeSet.Remove(nextCalendarYear);
            Assert.AreEqual(dateTimeSet.FindNext(now), null);
        }