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);
            }
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            var posts = postsRepository.All();

            return(View(posts));
        }
Exemplo n.º 3
0
 public IEnumerable <Post> Get()
 {
     return(_repository.All());
 }