Пример #1
0
        public void FindCorrectYear_LastYear()
        {
            Timestamp ts = new Timestamp();

            DateTime packet = new DateTime(2016, 11, 18, 0, 1, 1, DateTimeKind.Utc);
            DateTime hint   = packet.AddMonths(3);

            ts.FindCorrectYear(
                packet.Month,
                packet.Day,
                packet.Hour,
                packet.Minute,
                hint,
                out int year);

            Assert.Equal(packet.Year, year);
        }
Пример #2
0
        public void FindCorrectYear_LeapYear()
        {
            Timestamp ts = new Timestamp();

            DateTime packet = new DateTime(2015, 2, 28, 0, 1, 1, DateTimeKind.Utc);
            DateTime hint   = packet.AddMonths(1);

            ts.FindCorrectYear(
                packet.Month,
                packet.Day + 1,
                packet.Hour,
                packet.Minute,
                hint,
                out int year);

            Assert.Equal(2012, year);
        }
Пример #3
0
        public void FindCorrectYear_3MinutesAhead()
        {
            Timestamp ts = new Timestamp();

            DateTime packet = new DateTime(2017, 1, 1, 0, 1, 1, DateTimeKind.Utc);
            DateTime hint   = packet.AddMinutes(-3);

            ts.FindCorrectYear(
                packet.Month,
                packet.Day,
                packet.Hour,
                packet.Minute,
                hint,
                out int year);

            Assert.Equal(hint.Year, year);
        }