Exemplo n.º 1
0
        public void _overday()
        {
            DateTime dt  = new DateTime(2006, 09, 22, 23, 59, 55, 0);
            DateTime dt1 = new DateTime(2006, 09, 22, 23, 59, 59, 0);
            DateTime dt2 = new DateTime(2006, 09, 22, 00, 00, 00, 0);

            //TimePoint tp = new TimePoint(dt, TimePointFrequency.PerDay);
            TimePoint tp = new TimePoint(dt.Hour, dt.Minute, dt.Second); //, TimePointFrequency.PerDay);

            Assert.IsTrue(tp.InTimePoint(dt1));
            Assert.IsTrue(tp.InTimePoint(dt2));
        }
Exemplo n.º 2
0
        public void test_in_timepoint_peryear()
        {
            TimePoint tp = DefaultTP;

            //tp.Frequency  = TimePointFrequency.PerYear;

            tp = new TimePoint(9, 18, 12, 0, 0);
            Assert.IsTrue(tp.InTimePoint(CDT("2006-9-18 12:0:0")));
            Assert.IsTrue(tp.InTimePoint(CDT("2006-9-18 12:0:06")));
            Assert.IsTrue(tp.InTimePoint(CDT("2007-9-18 12:0:0")));
            Assert.IsTrue(tp.InTimePoint(CDT("2005-9-18 12:0:10")));
            Assert.IsTrue(!tp.InTimePoint(CDT("2005-10-18 12:0:0")));

            Assert.IsTrue(!tp.InTimePoint(CDT("2006-9-18 11:0:0")));
            Assert.IsTrue(!tp.InTimePoint(CDT("2006-9-18 13:0:0")));
            Assert.IsTrue(!tp.InTimePoint(CDT("2006-10-18 12:0:0")));
            Assert.IsTrue(!tp.InTimePoint(CDT("2006-8-18 12:0:0")));
            Assert.IsTrue(!tp.InTimePoint(CDT("2006-11-18 12:0:0")));
        }
Exemplo n.º 3
0
        public void test_in_timepoint_permonth()
        {
            TimePoint tp = new TimePoint(18, 12, 0, 0);

            Assert.IsFalse(tp.InTimePoint(CDT("2006-9-18 11:59:59")));
            Assert.IsFalse(tp.InTimePoint(CDT("2006-9-18 12:00:11")));

            Assert.IsTrue(tp.InTimePoint(CDT("2006-9-18 12:00:00")));
            Assert.IsTrue(tp.InTimePoint(CDT("2006-9-18 12:00:10")));

            Assert.IsTrue(tp.InTimePoint(CDT("2001-1-18 12:00:00")));
            Assert.IsTrue(tp.InTimePoint(CDT("2006-2-18 12:00:05")));
            Assert.IsTrue(tp.InTimePoint(CDT("2006-3-18 12:00:10")));

            Assert.IsTrue(!tp.InTimePoint(CDT("2006-10-17 12:00:00")));
            Assert.IsTrue(!tp.InTimePoint(CDT("2006-11-19 12:00:10")));
        }
Exemplo n.º 4
0
        public void test_in_timepoint_once()
        {
            //new DateTime(2006,9,18,12,0,0,0);

            TimePoint tp = new TimePoint(2006, 9, 18, 12, 0, 0);

            //tp.Frequency  = TimePointFrequency.Once;

            Assert.IsTrue(tp.InTimePoint(CDT("2006-9-18 12:0:0")));
            Assert.IsTrue(tp.InTimePoint(CDT("2006-9-18 12:0:06")));

            Assert.IsTrue(!tp.InTimePoint(CDT("2006-9-18 11:0:0")));
            Assert.IsTrue(!tp.InTimePoint(CDT("2006-9-18 13:0:0")));
            Assert.IsTrue(!tp.InTimePoint(CDT("2006-9-17 12:0:0")));
            Assert.IsTrue(!tp.InTimePoint(CDT("2006-8-18 12:0:0")));
            Assert.IsTrue(!tp.InTimePoint(CDT("2005-9-18 12:0:0")));
        }