Inheritance: MinuteTimeRange
Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 2
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.AreEqual( minutes.MinuteCount, minuteCount );
            Assert.AreEqual( minutes.StartYear, startYear );
            Assert.AreEqual( minutes.StartMonth, startMonth );
            Assert.AreEqual( minutes.StartDay, startDay );
            Assert.AreEqual( minutes.StartHour, startHour );
            Assert.AreEqual( minutes.StartMinute, startMinute );
            Assert.AreEqual( minutes.EndYear, 2004 );
            Assert.AreEqual( minutes.EndMonth, 2 );
            Assert.AreEqual( minutes.EndDay, 23 );
            Assert.AreEqual( minutes.EndHour, 0 );
            Assert.AreEqual( minutes.EndMinute, 3 );
            Assert.AreEqual( minutes.GetMinutes().Count, minuteCount );
            Assert.IsTrue( minutes.GetMinutes()[ 0 ].IsSamePeriod( new Minute( 2004, 2, 22, 23, 59 ) ) );
            Assert.IsTrue( minutes.GetMinutes()[ 1 ].IsSamePeriod( new Minute( 2004, 2, 23, 0, 0 ) ) );
            Assert.IsTrue( minutes.GetMinutes()[ 2 ].IsSamePeriod( new Minute( 2004, 2, 23, 0, 1 ) ) );
            Assert.IsTrue( minutes.GetMinutes()[ 3 ].IsSamePeriod( new Minute( 2004, 2, 23, 0, 2 ) ) );
        }
Ejemplo n.º 3
0
 // ----------------------------------------------------------------------
 public static void ShowMinutes( Minutes minutes, string caption = "Minutes" )
 {
     WriteLine( "{0}: {1}", caption, minutes );
     WriteIndentLine( "StartYear: {0}", minutes.StartYear );
     WriteIndentLine( "StartMonth: {0}", minutes.StartMonth );
     WriteIndentLine( "StartDay: {0}", minutes.StartDay );
     WriteIndentLine( "StartHour: {0}", minutes.StartHour );
     WriteIndentLine( "StartMinute: {0}", minutes.StartMinute );
     WriteIndentLine( "EndYear: {0}", minutes.EndYear );
     WriteIndentLine( "EndMonth: {0}", minutes.EndMonth );
     WriteIndentLine( "EndDay: {0}", minutes.EndDay );
     WriteIndentLine( "EndHour: {0}", minutes.EndHour );
     WriteIndentLine( "EndMinute: {0}", minutes.EndMinute );
     WriteIndentLine( "FirstMinuteStart: {0}", minutes.FirstMinuteStart );
     WriteIndentLine( "LastMinuteStart: {0}", minutes.LastMinuteStart );
     WriteLine();
 }
Ejemplo n.º 4
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.AreEqual( minutes.MinuteCount, 1 );
            Assert.AreEqual( minutes.StartYear, startYear );
            Assert.AreEqual( minutes.StartMonth, startMonth );
            Assert.AreEqual( minutes.StartDay, startDay );
            Assert.AreEqual( minutes.StartHour, startHour );
            Assert.AreEqual( minutes.StartMinute, startMinute );
            Assert.AreEqual( minutes.EndYear, 2004 );
            Assert.AreEqual( minutes.EndMonth, 2 );
            Assert.AreEqual( minutes.EndDay, startDay );
            Assert.AreEqual( minutes.EndHour, 17 );
            Assert.AreEqual( minutes.EndMinute, startMinute + 1 );
            Assert.AreEqual( minutes.GetMinutes().Count, 1 );
            Assert.IsTrue( minutes.GetMinutes()[ 0 ].IsSamePeriod( new Minute( 2004, 2, 22, 17, 42 ) ) );
        }
Ejemplo n.º 5
0
 // ----------------------------------------------------------------------
 public static void ShowCompactMinutes( Minutes minutes, string caption = "Minutes" )
 {
     WriteLine( "{0}: {1}", caption, minutes );
 }