GetMonthsInYear() 공개 메소드

public GetMonthsInYear ( int year, int era ) : int
year int
era int
리턴 int
예제 #1
0
파일: WorkYear.cs 프로젝트: dotob/moni
        public WorkYear(int year, WorkDayParserSettings parserSettings, int hitListLookBackInWeeks, float hoursPerDay, PNSearchViewModel pnSearch, PositionSearchViewModel positionSearch)
        {
            this.hitListLookBackInWeeks = hitListLookBackInWeeks;
            this.pnSearch = pnSearch;
            this.positionSearch = positionSearch;
            this.Year = year;
            this.Months = new ObservableCollection<WorkMonth>();
            this.Weeks = new ObservableCollection<WorkWeek>();

            var germanSpecialDays = SpecialDaysUtils.GetGermanSpecialDays(year);

            var cal = new GregorianCalendar();
            for (int month = 1; month <= cal.GetMonthsInYear(year); month++)
            {
                WorkMonth wm = new WorkMonth(year, month, germanSpecialDays, parserSettings, hoursPerDay);
                this.Months.Add(wm);
                foreach (var workWeek in wm.Weeks)
                {
                    this.Weeks.Add(workWeek);
                    workWeek.PropertyChanged += this.workWeek_PropertyChanged;
                }
            }
            this.ProjectHitlist = new QuickFillObservableCollection<HitlistInfo>();
            this.PositionHitlist = new QuickFillObservableCollection<HitlistInfo>();
            this.UpdateProjectHitlistAsync();
            this.UpdatePositionHitlistAsync();
        }
 public void PosTest3()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(2004, 2, 29, 0, 0, 0, 0);
     int expectedValue = gC.GetMonthsInYear(dateTime.Year, gC.GetEra(dateTime));
     int actualValue;
     actualValue = kC.GetMonthsInYear(dateTime.Year + 2333, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
 public void PosTest2()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = new DateTime(DateTime.MaxValue.Ticks, DateTimeKind.Utc);
     int expectedValue = gC.GetMonthsInYear(dateTime.Year, gC.GetEra(dateTime));
     int actualValue;
     actualValue = kC.GetMonthsInYear(dateTime.Year + 2333, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
 public void PosTest5()
 {
     int era = c_AD_ERA;
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year;
     int expectedMonths, actualMonths;
     year = GetAYear(myCalendar);
     expectedMonths = c_MONTHS_IN_YEAR;
     actualMonths = myCalendar.GetMonthsInYear(year, era);
     Assert.Equal(expectedMonths, actualMonths);
 }
예제 #5
0
파일: WorkYear.cs 프로젝트: vipwolf/moni
        public WorkYear(int year, IEnumerable<ShortCut> shortCuts, int hitListLookBackInWeeks, float hoursPerDay, PNSearchViewModel pnSearch, PositionSearchViewModel positionSearch)
        {
            this.hitListLookBackInWeeks = hitListLookBackInWeeks;
              this.pnSearch = pnSearch;
              this.positionSearch = positionSearch;
              this.Year = year;
              this.Months = new ObservableCollection<WorkMonth>();
              this.Weeks = new ObservableCollection<WorkWeek>();

              var germanSpecialDays = SpecialDaysUtils.GetGermanSpecialDays(year);

              var cal = new GregorianCalendar();
              for (int month = 1; month <= cal.GetMonthsInYear(year); month++) {
            WorkMonth wm = new WorkMonth(year, month, germanSpecialDays, shortCuts, hoursPerDay);
            this.Months.Add(wm);
            foreach (var workWeek in wm.Weeks) {
              this.Weeks.Add(workWeek);
              workWeek.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.workWeek_PropertyChanged);
            }
              }
        }
 public void NegTest5()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, era;
     year = GetAYear(myCalendar);
     era = 3;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         myCalendar.GetMonthsInYear(year, era);
     });
 }
 public void NegTest4()
 {
     int era = c_CURRENT_ERA;
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year;
     year = myCalendar.MinSupportedDateTime.Year - 100;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         myCalendar.GetMonthsInYear(year, era);
     });
 }
 public void PosTest10()
 {
     int era = c_CURRENT_ERA;
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year;
     int expectedMonths, actualMonths;
     year = myCalendar.MinSupportedDateTime.Year;
     expectedMonths = c_MONTHS_IN_YEAR;
     actualMonths = myCalendar.GetMonthsInYear(year, era);
     Assert.Equal(expectedMonths, actualMonths);
 }