Exemplo n.º 1
0
        public void All_ShouldReturnValidPublications()
        {
            // Arrange
            StarStuffDbContext db = this.Database;
            PublicationService publicationService = new PublicationService(db);

            this.SeedDatabase(db);

            const int page     = 2;
            const int pageSize = 5;

            List <Publication> fakePublications = this.GetFakePublications()
                                                  .Skip((page - 1) * pageSize)
                                                  .Take(pageSize)
                                                  .ToList();

            int i = -1;

            // Act
            IEnumerable <ListPublicationsServiceModel> publications = publicationService.All(page, pageSize);

            // Assert
            foreach (var actual in publications)
            {
                Publication expected = fakePublications[++i];

                this.ComparePublications(expected, actual);
            }
        }