GetWeeks() 공개 메소드

public GetWeeks ( ) : ITimePeriodCollection
리턴 ITimePeriodCollection
예제 #1
0
        public void SingleWeeksTest()
        {
            const int startYear = 2004;
            const int startWeek = 22;
            Weeks weeks = new Weeks( startYear, startWeek, 1 );

            Assert.AreEqual( weeks.Year, startYear );
            Assert.AreEqual( weeks.WeekCount, 1 );
            Assert.AreEqual( weeks.StartWeek, startWeek );
            Assert.AreEqual( weeks.EndWeek, startWeek );
            Assert.AreEqual( weeks.GetWeeks().Count, 1 );
            Assert.IsTrue( weeks.GetWeeks()[ 0 ].IsSamePeriod( new Week( 2004, 22 ) ) );
        }
예제 #2
0
        public void MultiWeekTest()
        {
            const int startYear = 2004;
            const int startWeek = 22;
            const int weekCount = 4;
            Weeks weeks = new Weeks( startYear, startWeek, weekCount );

            Assert.AreEqual( weeks.Year, startYear );
            Assert.AreEqual( weeks.WeekCount, weekCount );
            Assert.AreEqual( weeks.StartWeek, startWeek );
            Assert.AreEqual( weeks.EndWeek, startWeek + weekCount - 1 );
            Assert.AreEqual( weeks.GetWeeks().Count, weekCount );
            Assert.IsTrue( weeks.GetWeeks()[ 0 ].IsSamePeriod( new Week( 2004, 22 ) ) );
        }
예제 #3
0
        // ----------------------------------------------------------------------
        public static void ShowAll( int periodCount, int year, int weekOfYear, TimeCalendarConfig calendarConfig )
        {
            WriteLine( "Input: year={0}, week={1}", year, weekOfYear );
            WriteLine();

            WeekTimeRange weekTimeRange;
            if ( periodCount == 1 )
            {
                Week week = new Week( year, weekOfYear, new TimeCalendar( calendarConfig ) );
                weekTimeRange = week;

                Week previousWeek = week.GetPreviousWeek();
                Week nextWeek = week.GetNextWeek();

                ShowWeek( week );
                ShowCompactWeek( previousWeek, "Previous Week" );
                ShowCompactWeek( nextWeek, "Next Week" );
                WriteLine();
            }
            else
            {
                Weeks weeks = new Weeks( year, weekOfYear, periodCount, new TimeCalendar( calendarConfig ) );
                weekTimeRange = weeks;

                ShowWeeks( weeks );
                WriteLine();

                foreach ( Week week in weeks.GetWeeks() )
                {
                    ShowCompactWeek( week );
                }
                WriteLine();
            }

            foreach ( Day day in weekTimeRange.GetDays() )
            {
                DayDemo.ShowCompactDay( day );
            }
            WriteLine();
        }
예제 #4
0
        public void CalendarWeeksTest()
        {
            const int startYear = 2004;
            const int startWeek = 22;
            const int weekCount = 5;
            Weeks weeks = new Weeks( startYear, startWeek, weekCount );

            Assert.AreEqual( weeks.Year, startYear );
            Assert.AreEqual( weeks.WeekCount, weekCount );
            Assert.AreEqual( weeks.StartWeek, startWeek );
            Assert.AreEqual( weeks.EndWeek, startWeek + weekCount - 1 );
            Assert.AreEqual( weeks.GetWeeks().Count, weekCount );
            Assert.IsTrue( weeks.GetWeeks()[ 0 ].IsSamePeriod( new Week( 2004, 22 ) ) );
            Assert.IsTrue( weeks.GetWeeks()[ 1 ].IsSamePeriod( new Week( 2004, 23 ) ) );
            Assert.IsTrue( weeks.GetWeeks()[ 2 ].IsSamePeriod( new Week( 2004, 24 ) ) );
            Assert.IsTrue( weeks.GetWeeks()[ 3 ].IsSamePeriod( new Week( 2004, 25 ) ) );
            Assert.IsTrue( weeks.GetWeeks()[ 4 ].IsSamePeriod( new Week( 2004, 26 ) ) );
        }