Exemplo n.º 1
0
        public ActionResult Index()
        {
            var repo = new BlogPostRepo();
            var list = repo.GetAllBlogPosts();

            return View(list);
        }
Exemplo n.º 2
0
        public ActionResult Test()
        {
            // request by Matt
            BlogPostRepo repo = new BlogPostRepo();
            var blogs = repo.GetAllBlogPosts();

            return View(blogs);
        }
Exemplo n.º 3
0
        public void CanAddBlogPost()
        {
            BlogPostRepo repo = new BlogPostRepo();

            var posts = repo.GetAllBlogPosts();

            int preAddPostCount = posts.Count;

            BlogPost testPost = new BlogPost();
            testPost.Title = "Unit Test";
            testPost.DatePosted = DateTime.Now;
            testPost.Content = "Unit Test - CanAddBlogPost";

            repo.AddBlogPost(testPost);
            var postsAfterAdd = repo.GetAllBlogPosts();

            Assert.AreEqual(postsAfterAdd.Count, preAddPostCount + 1);
        }
Exemplo n.º 4
0
        public void CanGetAllBlogPosts()
        {
            BlogPostRepo repo = new BlogPostRepo();

            var blogposts = repo.GetAllBlogPosts();

            var count = repo.GetBlogId();

            Assert.AreEqual(blogposts.Count, count);
        }