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)); }
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)); }
public void TestIsPublished_NoPublishDates() { var subject = new Event(); Assert.IsTrue(subject.IsPublishedAsOf(DateTime.Now)); }