public async Task GetAnimeEpisodes_BebopId_ShouldParseCowboyBebopEpisode() { AnimeEpisodes bebop = await _jikan.GetAnimeEpisodes(1); Assert.Equal(26, bebop.EpisodeCollection.Count); Assert.Equal("Asteroid Blues", bebop.EpisodeCollection.First().Title); }
public void ShouldParseCowboyBebopEpisode() { AnimeEpisodes bebop = Task.Run(() => jikan.GetAnimeEpisodes(1)).Result; Assert.Equal(26, bebop.EpisodeCollection.Count); Assert.Equal("Asteroid Blues", bebop.EpisodeCollection.First().Title); }
public async Task GetAnimeEpisodes_BebopId_ShouldParseCowboyBebopEpisode() { // When var bebop = await _jikan.GetAnimeEpisodes(1); // Then using (new AssertionScope()) { bebop.EpisodeCollection.Should().HaveCount(26); bebop.EpisodeCollection.First().Title.Should().Be("Asteroid Blues"); } }
public async Task Recommend([Remainder] string query) { if (query.Length < 3) { await Context.Channel.SendErrorAsync("Your input must have at least 3 characters !", "Please try again!"); return; } var animeSearchConfig = new AnimeSearchConfig { Type = AnimeType.EveryType }; var animeSearchResult = await _jikan.SearchAnime($"{query}", animeSearchConfig); var animeSearch = animeSearchResult.Results; if (animeSearch == null) { await Context.Channel.SendErrorJikanAsync($"Not found any anime for {query}", "Error ! Please recheck your spelling", Context.User); return; } var animeSearchEntry = EvaluateAnime(query, animeSearch); //Computing misses //var computing = LevenshteinDistanceComputingService.Evaluation(query.ToLower(), animeSearchEntry.Title.ToLower()); var percentage = query.Length / (double)animeSearchEntry.Title.Length * 100; if (percentage >= 33) { var episodes = await _jikan.GetAnimeEpisodes(animeSearchEntry.MalId).ConfigureAwait(false); var pages = episodes.EpisodeCollection.Select(result => new EmbedPage { Title = $"**{result.Title}**", Description = $"Have anything to discuss with other viewers ? " + $"\nClick here to enter the MAL forum! " + $"\n**[Forum]({result.ForumUrl})**", AlternateAuthorTitle = "MyAnimeList", AlternateAuthorIcon = "https://cdn.myanimelist.net/img/sp/icon/apple-touch-icon-256.png", Url = result.VideoUrl, TimeStamp = Now, ImageUrl = $"{animeSearchEntry.ImageURL}" }) .ToList(); var options = new PaginatedAppearanceOptions { InformationText = $"**Episodes list for [{animeSearchEntry.Title}]**", Next = new Emoji("▶️"), Back = new Emoji("◀️"), Last = new Emoji("↪️"), First = new Emoji("↩️"), Timeout = TimeSpan.FromSeconds(60) }; var paginatedMessage = new PaginatedMessage { Pages = pages, Content = $"**Showing episodes details for [{animeSearchEntry.Title}]**", Options = options, FooterOverride = new EmbedFooterBuilder().WithText($"Requested by {Context.User.Username}") .WithIconUrl(Context.User.GetAvatarUrl() ?? Context.User.GetDefaultAvatarUrl()), TimeStamp = Now, Color = new Color(Utils.RandomColor(), Utils.RandomColor(), Utils.RandomColor()) }; await PagedReplyAsync(paginatedMessage, new ReactionList()); } else { await Context.Channel.SendErrorJikanAsync("Match percentage is below 33%", $"We can't not find any suitable anime and its episodes with input : [{query}]", Context.User); } }