Пример #1
0
        public async Task GetCardInfo_NotExistingAnime_ShouldReturnEmptyInfo()
        {
            // Given
            const int wrongId = int.MaxValue;
            var       api     = new AnimeApi(requester);

            // When
            var apiResult = await api.GetCardInfoAsync(wrongId);

            // Then
            apiResult.Should().BeNull();
        }
Пример #2
0
        public async Task GetSearchEntries_NotExistingAnime_ShouldReturnEmptyCollection()
        {
            // Given
            var api = new AnimeApi(requester);

            var query = new SearchAnimeQuery
            {
                Title = "qwertyuiopasdghjkl"
            };

            // When
            var apiResult = await api.GetSearchEntriesAsync(query);

            // Then
            apiResult.Results.Should().BeEmpty();
        }
Пример #3
0
        public async Task GetCardInfo_ExistingAnime_ShouldReturnCardInfo()
        {
            // Given
            const int cowboyBebopId = 1;
            var       api           = new AnimeApi(requester);

            // When
            var apiResult = await api.GetCardInfoAsync(cowboyBebopId);

            // Then
            using var scope = new AssertionScope();
            apiResult.Title.Should().Be("Cowboy Bebop");
            apiResult.Type.Should().Be("TV");
            apiResult.ImageUrl.Should().NotBeNullOrWhiteSpace();
            apiResult.MalId.Should().Be(cowboyBebopId);
            apiResult.Status.Should().Be("Finished Airing");
        }
Пример #4
0
        public async Task GetComparison_ExistingAnime_ShouldReturnComparisonEntities()
        {
            // Given
            const int bleachId    = 269;
            const int deathNoteId = 1535;
            var       api         = new AnimeApi(requester);

            var query = new CompareAnimeQuery
            {
                AnimeMalIds = new List <long> {
                    bleachId, deathNoteId
                }
            };

            // When
            var apiResult = await api.GetComparison(query);

            // Then
            apiResult.Count.Should().Be(7);
        }
Пример #5
0
        public async Task GetSearchEntries_ExistingAnime_ShouldReturnSearchEntries()
        {
            // Given
            const int cowboyBebopId = 1;
            var       api           = new AnimeApi(requester);

            var query = new SearchAnimeQuery
            {
                Title = "Cowboy Bebop"
            };

            // When
            var apiResult = await api.GetSearchEntriesAsync(query);

            // Then
            using var scope = new AssertionScope();
            var firstResult = apiResult.Results.First();

            apiResult.Results.Count.Should().Be(4);
            firstResult.Title.Should().Be("Cowboy Bebop");
            firstResult.ImageUrl.Should().NotBeNullOrWhiteSpace();
            firstResult.MalId.Should().Be(cowboyBebopId);
        }
Пример #6
0
 public AnimeApiTests()
 {
     instance = new AnimeApi();
 }