Ejemplo n.º 1
0
        public async Task GetAwardsLimitOffsetTest()
        {
            var dbContext = _serviceProvider.GetRequiredService <BookContext>();

            await CreateSampleTask(dbContext);

            var service = new AwardsService(dbContext);

            AwardRequest request = new AwardRequest {
                Sort = AwardSort.Id, Limit = 1, Offset = 1
            };
            var response = await service.GetAwardsAsync(request);

            Assert.NotNull(response);
            Assert.Equal(1, response.Values.Count);
            Assert.Equal(2, response.Values[0].AwardId);
            Assert.Equal("Hugo", response.Values[0].Name);
        }
Ejemplo n.º 2
0
        public async Task GetAwardsSortRusnameTest()
        {
            var dbContext = _serviceProvider.GetRequiredService <BookContext>();

            await CreateSampleTask(dbContext);

            var service = new AwardsService(dbContext);

            AwardRequest request = new AwardRequest {
                Sort = AwardSort.Rusname
            };
            var response = await service.GetAwardsAsync(request);

            Assert.NotNull(response);
            Assert.Equal(3, response.Values.Count);
            Assert.Equal("Nebula", response.Values[0].Name);
            Assert.Equal("Oscar", response.Values[1].Name);
            Assert.Equal("Hugo", response.Values[2].Name);
        }
Ejemplo n.º 3
0
        public async Task GetAwardsTest()
        {
            var dbContext = _serviceProvider.GetRequiredService <BookContext>();

            await CreateSampleTask(dbContext);

            var service = new AwardsService(dbContext);

            AwardRequest request = new AwardRequest {
                Sort = AwardSort.Id
            };
            var response = await service.GetAwardsAsync(request);

            Assert.NotNull(response);
            Assert.Equal(3, response.Values.Count);
            Assert.Equal(1, response.Values[0].AwardId);
            Assert.Equal("Nebula", response.Values[0].Name);

            Assert.NotNull(response.Values[0].FirstContestDate);
            //Assert.Equal(1992, response[0].FirstContestDate.Value.Year);
            Assert.NotNull(response.Values[0].LastContestDate);
            //Assert.Equal(2015, response[0].LastContestDate.Value.Year);
        }