Write your own blog engine, part 4
Adding posts I finally arrive at the "raison d'ĂȘtre" of a blog: adding posts. I want to be able to add posts and have them be returned in the next GET call to the home page. I also want to be able to add posts out of order by explicitly indicating the date/time of the new post (so that it gets sorted somewhere else than the top position). I'll start with an acceptance test for the first part: [TestMethod] public void AddingAPostReturnsItOnTheHomePage() { var guid = Guid.NewGuid(); var POST_DATA = string.Format("Title={0}&Content=This is a test", guid); var cookie = Post("/Account/LogOn", "Username=user&Password=pass"); Post("/Home/AddPost", POST_DATA, cookie); Get(); var articles = root.SelectNodes("/html/body/article").ToList(); Assert.IsTrue(articles.Any()); var topArticle = articles.First(); var header = topArticle.SelectSingleNode(...