Ejemplo n.º 1
0
        public void CalendarMinutesTest()
        {
            const int startYear   = 2004;
            const int startMonth  = 2;
            const int startDay    = 22;
            const int startHour   = 23;
            const int startMinute = 59;
            const int minuteCount = 4;
            Minutes   minutes     = new Minutes(startYear, startMonth, startDay, startHour, startMinute, minuteCount);

            Assert.Equal <int>(minutes.MinuteCount, minuteCount);
            Assert.Equal <int>(minutes.StartYear, startYear);
            Assert.Equal <int>(minutes.StartMonth, startMonth);
            Assert.Equal <int>(minutes.StartDay, startDay);
            Assert.Equal <int>(minutes.StartHour, startHour);
            Assert.Equal <int>(minutes.StartMinute, startMinute);
            Assert.Equal(2004, minutes.EndYear);
            Assert.Equal(2, minutes.EndMonth);
            Assert.Equal(23, minutes.EndDay);
            Assert.Equal(0, minutes.EndHour);
            Assert.Equal(3, minutes.EndMinute);
            Assert.Equal(minutes.GetMinutes().Count, minuteCount);
            Assert.True(minutes.GetMinutes()[0].IsSamePeriod(new Minute(2004, 2, 22, 23, 59)));
            Assert.True(minutes.GetMinutes()[1].IsSamePeriod(new Minute(2004, 2, 23, 0, 0)));
            Assert.True(minutes.GetMinutes()[2].IsSamePeriod(new Minute(2004, 2, 23, 0, 1)));
            Assert.True(minutes.GetMinutes()[3].IsSamePeriod(new Minute(2004, 2, 23, 0, 2)));
        } // CalendarMinutesTest
Ejemplo n.º 2
0
        // ----------------------------------------------------------------------
        public static void ShowAll(int periodCount, int year, YearMonth month, int day, int hour, int minuteValue)
        {
            WriteLine("Input: count={0}, year={1}, month={2}, day={3}, hour={4}, minute={5}", periodCount, year, month, day, hour, minuteValue);
            WriteLine();

            if (periodCount == 1)
            {
                Minute minute         = new Minute(year, (int)month, day, hour, minuteValue);
                Minute previousMinute = minute.GetPreviousMinute();
                Minute nextMinute     = minute.GetNextMinute();

                ShowMinute(minute);
                ShowCompactMinute(previousMinute, "Previous Minute");
                ShowCompactMinute(nextMinute, "Next Minute");
                WriteLine();
            }
            else
            {
                Minutes minutes = new Minutes(year, (int)month, day, hour, minuteValue, periodCount);

                ShowMinutes(minutes);
                WriteLine();

                foreach (Minute minute in minutes.GetMinutes())
                {
                    ShowCompactMinute(minute);
                }
                WriteLine();
            }
        }         // ShowAll
Ejemplo n.º 3
0
        public void SingleMinutesTest()
        {
            const int startYear   = 2004;
            const int startMonth  = 2;
            const int startDay    = 22;
            const int startHour   = 17;
            const int startMinute = 42;
            Minutes   minutes     = new Minutes(startYear, startMonth, startDay, startHour, startMinute, 1);

            Assert.Equal(1, minutes.MinuteCount);
            Assert.Equal <int>(minutes.StartYear, startYear);
            Assert.Equal <int>(minutes.StartMonth, startMonth);
            Assert.Equal <int>(minutes.StartDay, startDay);
            Assert.Equal <int>(minutes.StartHour, startHour);
            Assert.Equal <int>(minutes.StartMinute, startMinute);
            Assert.Equal(2004, minutes.EndYear);
            Assert.Equal(2, minutes.EndMonth);
            Assert.Equal <int>(minutes.EndDay, startDay);
            Assert.Equal(17, minutes.EndHour);
            Assert.Equal <int>(minutes.EndMinute, startMinute + 1);
            Assert.Equal(1, minutes.GetMinutes().Count);
            Assert.True(minutes.GetMinutes()[0].IsSamePeriod(new Minute(2004, 2, 22, 17, 42)));
        }         // SingleMinutesTest