예제 #1
0
        public async Task GetAsync_WhenCalled_GetSeasonsFromDb()
        {
            var seasonQuery = new SeasonQuery
            {
                PageNumber      = 1,
                PageSize        = 10,
                SortBy          = "name",
                IsSortAscending = true
            };

            var expectedSeasons = new PaginatedList <Season>
            {
                Pagination = new Pagination
                {
                    PageNumber = 1,
                    PageSize   = 10
                },
                Items = new List <Season>()
                {
                    new Season {
                        Id = 1
                    },
                    new Season {
                        Id = 2
                    },
                    new Season {
                        Id = 3
                    },
                }
            };

            _seasonRepository.Setup(s => s.GetAsync(seasonQuery)).ReturnsAsync(expectedSeasons);

            var result = await _seasonService.GetAsync(seasonQuery);

            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.EqualTo(expectedSeasons));
        }