コード例 #1
0
        public void IntersectTest()
        {
            TemporalExpression te;
            //sunday or wednesday
            te = new TEWeekDay(DayOfWeek.Wednesday) | new TEWeekDay(DayOfWeek.Sunday);

            Assert.IsTrue(te.Includes(new DateTime(2010, 6, 13)));
            Assert.IsTrue(te.Includes(new DateTime(2010, 6, 9)));
            Assert.IsTrue(te.Includes(new DateTime(2010, 7, 18)));
            Assert.IsTrue(te.Includes(new DateTime(2010, 7, 14)));
            Assert.IsTrue(te.Includes(new DateTime(2011, 6, 22)));

            Assert.IsFalse(te.Includes(new DateTime(2010, 6, 14)));
            Assert.IsFalse(te.Includes(new DateTime(2010, 6, 15)));
            Assert.IsFalse(te.Includes(new DateTime(2010, 7, 19)));
            Assert.IsFalse(te.Includes(new DateTime(2011, 6, 14)));
        }
コード例 #2
0
        public void TE_Weekday()
        {
            //single day
            TEWeekDay tew = new TEWeekDay(DayOfWeek.Wednesday);
            Assert.IsTrue(tew.Includes(new DateTime(2010, 6, 2)));
            Assert.IsTrue(tew.Includes(new DateTime(2010, 6, 23)));
            Assert.IsTrue(tew.Includes(new DateTime(2011, 6, 8)));
            Assert.IsTrue(tew.Includes(new DateTime(2010, 7, 7)));
            Assert.IsFalse(tew.Includes(new DateTime(2010, 6, 1)));
            Assert.IsFalse(tew.Includes(new DateTime(2010, 6, 14)));
            Assert.IsFalse(tew.Includes(new DateTime(2010, 7, 12)));

            //range
            TEWeekDay tewr = new TEWeekDay(DayOfWeek.Monday, DayOfWeek.Friday);

            Assert.IsFalse(tew.Includes(new DateTime(2010, 6, 6)));
            Assert.IsTrue(tewr.Includes(new DateTime(2010, 6, 7)));
            Assert.IsTrue(tewr.Includes(new DateTime(2010, 6, 8)));
            Assert.IsTrue(tewr.Includes(new DateTime(2010, 6, 9)));
            Assert.IsTrue(tewr.Includes(new DateTime(2010, 6, 10)));
            Assert.IsTrue(tewr.Includes(new DateTime(2010, 6, 11)));
            Assert.IsFalse(tew.Includes(new DateTime(2010, 6, 12)));

            Assert.IsFalse(tew.Includes(new DateTime(2010, 7, 4)));
            Assert.IsTrue(tewr.Includes(new DateTime(2010, 7, 5)));
            Assert.IsTrue(tewr.Includes(new DateTime(2010, 7, 7)));

            Assert.IsTrue(tewr.Includes(new DateTime(2011, 6, 15)));
        }