public async Task GetMovieData_MovieDoesNotExist_MovieNotFoundResponse() { var omdbClient = new OmdbClient(_clientFactory, _appSettings); var res = await omdbClient.GetMovieData("This Movie Doesn't Exist", 1900); Assert.False(res.Success); }
public async Task Command(string movie, int year = 0) { var movieInfo = await _omdbClient.GetMovieData(movie, year); if (!movieInfo.Success) { await ReplyAsync("Movie could not be found"); return; } var movieData = movieInfo.Object; var builder = new EmbedBuilder() .WithTitle(movieData.Title) .WithUrl(GetImdbUrl(movieData.ImdbID)) .WithColor(Color.Blue) .WithTimestamp(DateTimeOffset.Now) .WithFooter(footer => { footer .WithText("Prepared At"); }) .WithThumbnailUrl(movieData.Poster) .AddField("Plot", movieData.Plot) .AddField("Rating", GetRatings(movieData.Ratings)) .AddField("Box Office", movieData.BoxOffice); await ReplyAsync(embed : builder.Build()); }
public async Task GetMovieData_WellFormedMovieInput_MovieDataReturned() { var omdbClient = new OmdbClient(_clientFactory, _appSettings); var res = await omdbClient.GetMovieData("The Invisible Man", 2020); Assert.True(res.Success); Assert.Equal("The Invisible Man", res.Object.Title); }
public async Task GetMovieData_MovieIsNull_ArgumentNullException() { var omdbClient = new OmdbClient(_clientFactory, _appSettings); await Assert.ThrowsAsync <ArgumentNullException>(() => omdbClient.GetMovieData(null, 1900)); }