public void CanAddBlog() { InMemoryRepo repo = new InMemoryRepo(); var blog = new BlogPost { Title = "The Fourth Blog Test Title", Content = "Here's another fantastic blog about business stuff!", PostDate = new DateTime(2018, 07, 03), RemoveDate = new DateTime(2018, 09, 03), IsApproved = false, BlogNotes = "This is the best blog so far!", BlogWriter = new Model.Identities.AppUser { UserName = "******" }, }; repo.AddBlog(blog); var blogList = repo.GetAllBlogs(); Assert.AreEqual(4, blogList.Count()); repo.GetBlog(4); Assert.AreEqual(4, blog.BlogPostId); Assert.AreEqual("The Fourth Blog Test Title", blog.Title); Assert.AreEqual("Here's another fantastic blog about business stuff!", blog.Content); Assert.AreEqual(new DateTime(2018, 07, 03), blog.PostDate); Assert.AreEqual(new DateTime(2018, 09, 03), blog.RemoveDate); Assert.AreEqual(false, blog.IsApproved); Assert.AreEqual("This is the best blog so far!", blog.BlogNotes); Assert.AreEqual("*****@*****.**", blog.BlogWriter.UserName); }
public void CanLoadBlogRoll() { InMemoryRepo repo = new InMemoryRepo(); var blogList = repo.GetAllBlogs(); Assert.AreEqual(4, blogList.Count()); BlogPost blog = blogList.FirstOrDefault(b => b.BlogPostId == 1); Assert.AreEqual(1, blog.BlogPostId); Assert.AreEqual("The First Blog Test Title", blog.Title); Assert.AreEqual("This is the blog body. I am going to keep typing until it is now a really big body", blog.Content); Assert.AreEqual(new DateTime(2018, 07, 01), blog.PostDate); Assert.AreEqual(new DateTime(2018, 09, 01), blog.RemoveDate); Assert.AreEqual(true, blog.IsApproved); Assert.AreEqual("This blog rocks!! A note from admin.", blog.BlogNotes); Assert.AreEqual("*****@*****.**", blog.BlogWriter.UserName); }