Beispiel #1
0
        public void CanGetPostsByMonthArchive()
        {
            UnitTestHelper.SetupBlog();
            ICollection <ArchiveCount> counts = Archives.GetPostCountByMonth();

            Assert.AreEqual(0, counts.Count);

            Entry entry = UnitTestHelper.CreateEntryInstanceForSyndication("me", "title", "body");

            UnitTestHelper.Create(entry);
            counts = Archives.GetPostCountByMonth();
            Assert.AreEqual(1, counts.Count);

            foreach (ArchiveCount archiveCount in counts)
            {
                Assert.AreEqual(1, archiveCount.Count, "Expected one post in the archive.");
                Assert.AreEqual(DateTime.Now.Date.AddDays(-1 * DateTime.Now.Date.Day + 1), archiveCount.Date,
                                "Expected date to be this month.");
                Assert.AreEqual(null, archiveCount.Title);
                Assert.AreEqual(0, archiveCount.Id);
                return;
            }
        }