public void All() { // Arrange var count = 2; for (int i = 1; i <= count; i++) { _repository.Insert(new Post { Id = i, Text = i.ToString() }); } // Act var actual = _repository.All(); // Assert Assert.NotNull(actual); Assert.Equal(count, actual.Count()); for (int i = 1; i <= count; i++) { Assert.Contains(actual, p => p.Id == i); } }
public ActionResult Index() { var posts = postsRepository.All(); return(View(posts)); }
public IEnumerable <Post> Get() { return(_repository.All()); }