public void CanGetBlogPostById() { BlogPostRepo repo = new BlogPostRepo(); int testId1 = 1; int testId2 = 2; BlogPost blogpost1 = repo.GetBlogPostById(testId1); BlogPost blogpost2 = repo.GetBlogPostById(testId2); Assert.AreEqual(blogpost1.BlogID, testId1.ToString()); Assert.AreEqual(blogpost2.BlogID, testId2.ToString()); }
public void CanEditBlogPost() { BlogPostRepo repo = new BlogPostRepo(); BlogPost testPost = repo.GetBlogPostById(1); var titleBeforeEdited = testPost.Title; var titleAfterEdited = titleBeforeEdited + "UnitTest"; testPost.Title = titleAfterEdited; repo.EditBlogPost(testPost); BlogPost resultPost = repo.GetBlogPostById(1); Assert.AreNotEqual(resultPost.Title, titleBeforeEdited); Assert.AreEqual(resultPost.Title, titleAfterEdited); }