/// <summary> /// Finds the closest anime (based on the user query) /// </summary> public void GetAndSetToClosestAnime() { searchResultOfAnime = jikanInterface.SearchAnime(_animeName).Result; if (searchResultOfAnime == null) { GetAndSetToRandomAnime(); } else { _animeName = searchResultOfAnime.Results.First().Title; _malId = searchResultOfAnime.Results.First().MalId; anime = jikanInterface.GetAnime(_malId).Result; //If NSFW content is looked up, search up another anime if (anime.Rating.Contains("Rx")) { GetAndSetToRandomAnime(); } else { animeName = _animeName; _scoreOfAnime = (float)searchResultOfAnime.Results.First().Score; _reviewsOfAnime = jikanInterface.GetAnimeReviews(_malId).Result; _animePictures = jikanInterface.GetAnimePictures(_malId).Result; } } }
public async Task GetAnimeReviews_BebopId_ShouldParseCowboyBebopReviews() { AnimeReviews bebop = await _jikan.GetAnimeReviews(1); Assert.Equal("TheLlama", bebop.Reviews.First().Reviewer.Username); Assert.Equal(7406, bebop.Reviews.First().MalId); Assert.Equal(26, bebop.Reviews.First().Reviewer.EpisodesSeen); Assert.True(bebop.Reviews.First().HelpfulCount > 1400); Assert.Equal(10, bebop.Reviews.First().Reviewer.Scores.Overall); Assert.Equal(9, bebop.Reviews.First().Reviewer.Scores.Animation); }
public async Task GetAnimeReviews_BebopId_ShouldParseCowboyBebopReviews() { // When var bebop = await _jikan.GetAnimeReviews(1); // Then var firstReview = bebop.Reviews.First(); using (new AssertionScope()) { firstReview.Reviewer.Username.Should().Be("TheLlama"); firstReview.MalId.Should().Be(7406); firstReview.Reviewer.EpisodesSeen.Should().Be(26); firstReview.HelpfulCount.Should().BeGreaterThan(1400); firstReview.Reviewer.Scores.Overall.Should().Be(10); firstReview.Reviewer.Scores.Animation.Should().Be(9); } }