Example #1
0
        public void КонвертацияДатыИзДней3()
        {
            var myDate1 = new MyDate(29, 02, 2016);
            var days1   = myDate1.GetDaysCount();
            var myDate2 = MyDate.GetDateByDays(days1);

            Assert.AreEqual(myDate1.Day, myDate2.Day);
            Assert.AreEqual(myDate1.Month, myDate2.Month);
            Assert.AreEqual(myDate1.Year, myDate2.Year);
        }
Example #2
0
        public void ЧислоДнейВДате2()
        {
            var myDate = new MyDate(1, 1, 2);
            int result = 0;

            for (var i = 0; i < myDate.Year; i++)
            {
                if (MyDate.IsYearLeap(i))
                {
                    result += 366;
                }
                else
                {
                    result += 365;
                }
            }

            Assert.AreEqual(myDate.GetDaysCount(), result);
        }