예제 #1
0
        public void TestIsPublished_UnpublishDateSet()
        {
            var unpublishDate = new DateTime(1999, 12, 31);

            var subject = new Event();
            subject.PublishDate = null;
            subject.UnpublishDate = unpublishDate;

            var now = new DateTime(1999, 12, 30);
            Assert.IsTrue(subject.IsPublishedAsOf(now));

            now = new DateTime(1999, 12, 31);
            Assert.IsTrue(subject.IsPublishedAsOf(now));

            now = new DateTime(2000, 1, 1);
            Assert.IsFalse(subject.IsPublishedAsOf(now));
        }
예제 #2
0
        public void TestIsPublished_RangeDefined()
        {
            var publishDate = new DateTime(1999, 12, 31);
            var unpublishDate = new DateTime(2000, 1, 2);
            var subject = new Event();
            subject.PublishDate = publishDate;
            subject.UnpublishDate = unpublishDate;

            var now = new DateTime(1999, 12, 30);
            Assert.IsFalse(subject.IsPublishedAsOf(now));

            now = new DateTime(1999, 12, 31);
            Assert.IsTrue(subject.IsPublishedAsOf(now));

            now = new DateTime(2000, 1, 1);
            Assert.IsTrue(subject.IsPublishedAsOf(now));

            now = new DateTime(2000, 1, 2);
            Assert.IsTrue(subject.IsPublishedAsOf(now));

            now = new DateTime(2000, 1, 3);
            Assert.IsFalse(subject.IsPublishedAsOf(now));
        }
예제 #3
0
 public void TestIsPublished_NoPublishDates()
 {
     var subject = new Event();
     Assert.IsTrue(subject.IsPublishedAsOf(DateTime.Now));
 }