public void TestMoviesGetMovieKeywords() { //GetMovieKeywords(int id) KeywordsContainer resp = _config.Client.GetMovieKeywords(AGoodDayToDieHard); Assert.IsNotNull(resp); }
public void TestKeywordMovies() { // Ignore missing json IgnoreMissingJson("results[array] / media_type"); KeywordsContainer keywords = Config.Client.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard).Result; Assert.NotNull(keywords); Assert.NotNull(keywords.Keywords); Assert.True(keywords.Keywords.Count > 0); // Get first keyword Keyword testKeyword = keywords.Keywords.First(); // Get movies SearchContainerWithId <SearchMovie> movies = Config.Client.GetKeywordMoviesAsync(testKeyword.Id).Result; SearchContainerWithId <SearchMovie> moviesItalian = Config.Client.GetKeywordMoviesAsync(testKeyword.Id, "it").Result; SearchContainerWithId <SearchMovie> moviesPage2 = Config.Client.GetKeywordMoviesAsync(testKeyword.Id, 2).Result; Assert.NotNull(movies); Assert.NotNull(moviesItalian); Assert.NotNull(moviesPage2); Assert.Equal(testKeyword.Id, movies.Id); Assert.Equal(testKeyword.Id, moviesItalian.Id); Assert.Equal(testKeyword.Id, moviesPage2.Id); Assert.True(movies.Results.Count > 0); Assert.True(moviesItalian.Results.Count > 0); if (movies.TotalResults > movies.Results.Count) { Assert.True(moviesPage2.Results.Count > 0); } else { Assert.Equal(0, moviesPage2.Results.Count); } Assert.Equal(1, movies.Page); Assert.Equal(1, moviesItalian.Page); Assert.Equal(2, moviesPage2.Page); // All titles on page 1 must be the same bool allTitlesIdentical = true; for (int index = 0; index < movies.Results.Count; index++) { Assert.Equal(movies.Results[index].Id, moviesItalian.Results[index].Id); // At least one title must differ in title if (movies.Results[index].Title != moviesItalian.Results[index].Title) { allTitlesIdentical = false; } } Assert.False(allTitlesIdentical); }
public async Task TestKeywordMovies() { SearchContainerWithId <SearchMovie> movies = await TMDbClient.GetKeywordMoviesAsync(IdHelper.AgentKeyword); Assert.Equal(IdHelper.AgentKeyword, movies.Id); Assert.NotEmpty(movies.Results); KeywordsContainer movie = await TMDbClient.GetMovieKeywordsAsync(movies.Results.First().Id); Assert.Contains(movie.Keywords, x => IdHelper.AgentKeyword == x.Id); }
public void TestKeywordMovies() { KeywordsContainer keywords = _config.Client.GetMovieKeywords(AGoodDayToDieHard); Assert.IsNotNull(keywords); Assert.IsNotNull(keywords.Keywords); Assert.IsTrue(keywords.Keywords.Count > 0); // Get first keyword Keyword testKeyword = keywords.Keywords.First(); // Get movies SearchContainer <MovieResult> movies = _config.Client.GetKeywordMovies(testKeyword.Id); SearchContainer <MovieResult> moviesItalian = _config.Client.GetKeywordMovies(testKeyword.Id, "it"); SearchContainer <MovieResult> moviesPage2 = _config.Client.GetKeywordMovies(testKeyword.Id, 2); Assert.IsNotNull(movies); Assert.IsNotNull(moviesItalian); Assert.IsNotNull(moviesPage2); Assert.IsTrue(movies.Results.Count > 0); Assert.IsTrue(moviesItalian.Results.Count > 0); if (movies.TotalResults > movies.Results.Count) { Assert.IsTrue(moviesPage2.Results.Count > 0); } else { Assert.AreEqual(0, moviesPage2.Results.Count); } Assert.AreEqual(1, movies.Page); Assert.AreEqual(1, moviesItalian.Page); Assert.AreEqual(2, moviesPage2.Page); // All titles on page 1 must be the same bool allTitlesIdentical = true; for (int index = 0; index < movies.Results.Count; index++) { Assert.AreEqual(movies.Results[index].Id, moviesItalian.Results[index].Id); // At least one title must differ in title if (movies.Results[index].Title != moviesItalian.Results[index].Title) { allTitlesIdentical = false; } } Assert.IsFalse(allTitlesIdentical); }
public void TestMoviesGetMovieKeywords() { KeywordsContainer resp = Config.Client.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard).Result; Assert.NotNull(resp); Keyword keyword = resp.Keywords.SingleOrDefault(s => s.Id == 186447); Assert.NotNull(keyword); Assert.Equal(186447, keyword.Id); Assert.Equal("rogue", keyword.Name); }
public void TestMoviesGetMovieKeywords() { KeywordsContainer resp = _config.Client.GetMovieKeywords(AGoodDayToDieHard); Assert.IsNotNull(resp); Keyword keyword = resp.Keywords.SingleOrDefault(s => s.Id == 186447); Assert.IsNotNull(keyword); Assert.AreEqual(186447, keyword.Id); Assert.AreEqual("rogue", keyword.Name); }
public void TestKeywordGet() { KeywordsContainer keywords = Config.Client.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard).Result; Assert.NotNull(keywords); Assert.NotNull(keywords.Keywords); Assert.True(keywords.Keywords.Count > 0); // Try to get all keywords foreach (Keyword testKeyword in keywords.Keywords) { Keyword getKeyword = Config.Client.GetKeywordAsync(testKeyword.Id).Result; Assert.NotNull(getKeyword); Assert.Equal(testKeyword.Id, getKeyword.Id); Assert.Equal(testKeyword.Name, getKeyword.Name); } }
public void TestKeywordGet() { KeywordsContainer keywords = _config.Client.GetMovieKeywords(AGoodDayToDieHard); Assert.IsNotNull(keywords); Assert.IsNotNull(keywords.Keywords); Assert.IsTrue(keywords.Keywords.Count > 0); // Try to get all keywords foreach (Keyword testKeyword in keywords.Keywords) { Keyword getKeyword = _config.Client.GetKeyword(testKeyword.Id); Assert.IsNotNull(getKeyword); Assert.AreEqual(testKeyword.Id, getKeyword.Id); Assert.AreEqual(testKeyword.Name, getKeyword.Name); } }
private void GetMovieDBInfo(string searchMedia, string selectedLang, string fallbackLang, string selectedCertCountry, string fallbackCertCountry) { InitLists(); SearchContainer <SearchMovie> movieList = _tmDbClient.SearchMovie(searchMedia, selectedLang); if (movieList == null || movieList.TotalResults <= 0) { movieList = _tmDbClient.SearchMovie(searchMedia, fallbackLang); } if (movieList == null || movieList.TotalResults <= 0) { return; } SearchMovie resultMovie = new SearchMovie(); if (movieList.TotalResults > 1) { DBMultipleSelection selectWindow = new DBMultipleSelection { Owner = this, MovieDBSearchResults = movieList }; if (selectWindow.ShowDialog() == true) { resultMovie = selectWindow.MovieDBSelectionResult; } } else { resultMovie = movieList.Results.First(); } if (resultMovie.Id == 0) { return; } Movie searchResult = _tmDbClient.GetMovie(resultMovie.Id, selectedLang) ?? _tmDbClient.GetMovie(resultMovie.Id, fallbackLang); if (searchResult == null) { return; } ImagesWithId imageList = _tmDbClient.GetMovieImages(resultMovie.Id); Casts movieCasts = _tmDbClient.GetMovieCasts(resultMovie.Id); KeywordsContainer movieKeywords = _tmDbClient.GetMovieKeywords(resultMovie.Id); Trailers movieTrailers = _tmDbClient.GetMovieTrailers(resultMovie.Id); Releases movieReleases = _tmDbClient.GetMovieReleases(resultMovie.Id); MovieTitle.Text = searchResult.Title; MovieOriginalTitle.Text = searchResult.OriginalTitle; MovieGenre.Text = searchResult.Genres != null ? string.Join(" / ", searchResult.Genres.ConvertAll(input => input.Name)) : string.Empty; MovieRuntime.Text = searchResult.Runtime.ToString("g"); if (AppSettings.MovieDBRatingSource == 0) { MovieRating.Text = searchResult.VoteAverage.ToString("g"); MovieVotes.Text = searchResult.VoteCount.ToString("g"); } else { ImdbClient imdb = new ImdbClient(); ImdbMovieData movieData = imdb.GetMovieById(searchResult.ImdbId); MovieRating.Text = movieData.Rating.ToString("g"); MovieVotes.Text = movieData.RatingCount.ToString("g"); } MovieYear.Text = searchResult.ReleaseDate.Year.ToString("g"); MovieTagline.Text = searchResult.Tagline; MoviePlot.Text = searchResult.Overview; if (movieKeywords != null && movieKeywords.Keywords != null) { MovieKeywords.Text = string.Join(", ", movieKeywords.Keywords.ConvertAll(input => input.Name)); } else { MovieKeywords.Text = string.Empty; } MovieImdbId.Text = searchResult.ImdbId; MovieCountry.Text = searchResult.ProductionCountries != null ? string.Join(" / ", searchResult.ProductionCountries.ConvertAll(input => input.Name)) : string.Empty; if (movieCasts != null && movieCasts.Crew != null) { MovieDirector.Text = string.Join(" / ", movieCasts.Crew.Where(crew => crew.Job == "Director") .ToList() .ConvertAll(input => input.Name)); MovieWriters.Text = string.Join(" / ", movieCasts.Crew.Where( crew => crew.Job == "Writer" || crew.Job == "Screenplay") .ToList() .ConvertAll(input => input.Name)); } else { MovieDirector.Text = string.Empty; MovieWriters.Text = string.Empty; } MovieStudio.Text = searchResult.ProductionCompanies != null ? string.Join(" / ", searchResult.ProductionCompanies.ConvertAll(input => input.Name)) : string.Empty; MovieSetName.Text = searchResult.BelongsToCollection != null ? string.Join(" / ", searchResult.BelongsToCollection.ConvertAll(input => input.Name)) : string.Empty; if (movieTrailers != null && movieTrailers.Youtube != null && movieTrailers.Youtube.Count > 0) { MovieTrailer.Text = "plugin://plugin.video.youtube/?action=play_video&videoid=" + movieTrailers.Youtube.First().Source; } else { MovieTrailer.Text = string.Empty; } Country selCountry = movieReleases.Countries.SingleOrDefault(country => country.Iso_3166_1.ToLowerInvariant() == selectedCertCountry); string certPrefix = AppSettings.MovieDBPreferredCertPrefix; if (selCountry == null) { selCountry = movieReleases.Countries.SingleOrDefault( country => country.Iso_3166_1.ToLowerInvariant() == fallbackCertCountry); certPrefix = AppSettings.MovieDBFallbackCertPrefix; } if (selCountry == null) { selCountry = movieReleases.Countries.First(); certPrefix = string.Empty; } MovieMPAARating.Text = certPrefix + selCountry.Certification; // loading image sizes string posterOriginal = _tmDbClient.Config.Images.PosterSizes.Last(); string posterPreview = _tmDbClient.Config.Images.PosterSizes.Count >= 2 ? _tmDbClient.Config.Images.PosterSizes[_tmDbClient.Config.Images.PosterSizes.Count - 2] : _tmDbClient.Config.Images.PosterSizes.Last(); string backdropOriginal = _tmDbClient.Config.Images.BackdropSizes.Last(); string backdropPreview = _tmDbClient.Config.Images.BackdropSizes.Count >= 3 ? _tmDbClient.Config.Images.BackdropSizes[ _tmDbClient.Config.Images.BackdropSizes.Count - 3] : _tmDbClient.Config.Images.BackdropSizes.Last(); // remove duplicate entries imageList.Backdrops.RemoveAt(imageList.Backdrops.FindIndex(data => data.FilePath == searchResult.BackdropPath)); imageList.Posters.RemoveAt(imageList.Posters.FindIndex(data => data.FilePath == searchResult.PosterPath)); // create image lists _postersList.Add(new MovieDBPosterImage { Title = "Default", UrlOriginal = _tmDbClient.GetImageUrl(posterOriginal, searchResult.PosterPath).AbsoluteUri, UrlPreview = _tmDbClient.GetImageUrl(posterPreview, searchResult.PosterPath).AbsoluteUri }); _backdropsList.Add(new MovieDBImageInfo { Title = "Default", UrlOriginal = _tmDbClient.GetImageUrl(backdropOriginal, searchResult.BackdropPath).AbsoluteUri, UrlPreview = _tmDbClient.GetImageUrl(backdropPreview, searchResult.BackdropPath).AbsoluteUri }); int cnt = 1; foreach (ImageData poster in imageList.Posters) { _postersList.Add(new MovieDBPosterImage { Title = "Online image " + cnt, UrlOriginal = _tmDbClient.GetImageUrl(posterOriginal, poster.FilePath).AbsoluteUri, UrlPreview = _tmDbClient.GetImageUrl(posterPreview, poster.FilePath).AbsoluteUri }); cnt++; } MoviePosterList.ItemsSource = _postersList; MoviePosterList.SelectedIndex = 0; cnt = 1; foreach (ImageData backdrop in imageList.Backdrops) { _backdropsList.Add(new MovieDBImageInfo { Title = "Online image " + cnt, UrlOriginal = _tmDbClient.GetImageUrl(backdropOriginal, backdrop.FilePath).AbsoluteUri, UrlPreview = _tmDbClient.GetImageUrl(backdropPreview, backdrop.FilePath).AbsoluteUri }); cnt++; } MovieBackdropList.ItemsSource = _backdropsList; MovieBackdropList.SelectedIndex = 0; foreach (Cast cast in movieCasts.Cast) { _castList.Casts.Add(new MovieDBCast { Name = cast.Name, Role = cast.Character, Thumbnail = _tmDbClient.GetImageUrl("original", cast.ProfilePath).AbsoluteUri }); } MovieCastListView.ItemsSource = _castList.Casts; ResultTabControl.SelectedIndex = 1; }
public async Task TestKeywordsMissing() { KeywordsContainer keywords = await TMDbClient.GetMovieKeywordsAsync(IdHelper.MissingID); Assert.Null(keywords); }
public async Task TestGetMovieKeywordsAsync() { KeywordsContainer keywords = await TMDbClient.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard); await Verify(keywords); }
public async void TestMoviesGetMovieKeywords() { KeywordsContainer resp = await TMDbClient.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard); await Verify(resp); }
public void TestKeywordsMissing() { KeywordsContainer keywords = Config.Client.GetMovieKeywordsAsync(IdHelper.MissingID).Result; Assert.Null(keywords); }