public void GetAllBlogs_WhenExistingBlogFound_ReturnsBlog() { var blogInDatabase = new Blog { Id = 1, Post = null, Url = "http://www.company.com" }; var expectedBlogModel = new BlogModel { Id = blogInDatabase.Id, Url = blogInDatabase.Url }; _repository.Setup(library => library.FindAll()) .Returns(new List <Blog> { blogInDatabase }.AsQueryable()); var actual = _blogProcessor.GetAllBlogs(); actual.Should().NotBeEmpty() .And.HaveCount(1) .And.ContainItemsAssignableTo <BlogModel>() .And.ContainEquivalentOf(expectedBlogModel); }
public IActionResult Get() { var blogs = _blogProcessor.GetAllBlogs(); return(new JsonResult(blogs)); }