Exemplo n.º 1
0
 public void Test2()
 {
     for (int i = 1; i <= 12; i++)
     {
         var cdate = ChineseDate.From(2020, i, 1);
         Console.WriteLine(cdate.ToString());
         var cdate2 = ChineseDate.From(2020, i, -1);
         Console.WriteLine(cdate2.ToString());
     }
     for (int i = 1; i <= 13; i++)
     {
         var cdate = ChineseDate.FromIndex(2020, i, 1);
         Console.WriteLine(cdate.ToString());
         var cdate2 = ChineseDate.FromIndex(2020, i, -1);
         Console.WriteLine(cdate2.ToString());
     }
 }
Exemplo n.º 2
0
        public void FromYearMonthDay()
        {
            var year  = 1901;
            var cdate = ChineseDate.From(year, 1, 1);

            while (year < 2100)
            {
                year += 1;
                var cd2 = ChineseDate.From(year, 1, 1);
                cdate = cdate.AddYears(1);
                Console.WriteLine(cdate.ToString());
                Assert.Equal(cd2, cdate);

                var cd3 = ChineseDate.From(year, -1, -1);
                Console.WriteLine(cd3.ToString());
                Assert.True(cd3.MonthIndex == cd3.MonthsInYear);
                Assert.True(cd3.Day == cd3.DayInMonth);
                var cd4 = ChineseDate.FromIndex(cd3.Year, cd3.MonthIndex, cd3.Day);
                Assert.Equal(cd3, cd4);
            }
        }